diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 1659471..7b8abcf 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -113,7 +113,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) set(GENERAL_FLAGS "${GENERAL_FLAGS} -mfix-cortex-a53-835769") endif() - set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wno-nan-infinity-disabled -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror") + set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wno-unknown-warning-option -Wno-nan-infinity-disabled -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror") if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20)) set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-error=cpp") diff --git a/scripts/compiler_tests/build_all.sh b/scripts/compiler_tests/build_all.sh index 7f35951..1f1ffc6 100755 --- a/scripts/compiler_tests/build_all.sh +++ b/scripts/compiler_tests/build_all.sh @@ -15,3 +15,8 @@ for i in 8 9 10 11 12 13 14 15; do gcc/build.sh $1 $i done + +for i in 17 18 19 20; +do + clang/build.sh $1 $i +done diff --git a/scripts/compiler_tests/clang/Dockerfile b/scripts/compiler_tests/clang/Dockerfile new file mode 100644 index 0000000..8842115 --- /dev/null +++ b/scripts/compiler_tests/clang/Dockerfile @@ -0,0 +1,4 @@ +FROM p2pool_compiler_tests_ubuntu +ARG P2POOL_VERSION GCC_VERSION +ADD test.sh /p2pool/ +RUN /p2pool/test.sh ${P2POOL_VERSION} ${GCC_VERSION} diff --git a/scripts/compiler_tests/clang/build.sh b/scripts/compiler_tests/clang/build.sh new file mode 100755 index 0000000..f74bea6 --- /dev/null +++ b/scripts/compiler_tests/clang/build.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Example usage: ./build.sh v4.8.1 20 + +cd "$(dirname "$0")" + +docker build --build-arg P2POOL_VERSION=$1 --build-arg GCC_VERSION=$2 -t p2pool_compiler_test_clang_$2 . + +docker create --name p2pool_compiler_test_clang_$2_container p2pool_compiler_test_clang_$2:latest +docker cp p2pool_compiler_test_clang_$2_container:/p2pool/logs.tar.gz clang_$2_logs.tar.gz +docker rm p2pool_compiler_test_clang_$2_container + +docker image rm -f p2pool_compiler_test_clang_$2 diff --git a/scripts/compiler_tests/clang/test.sh b/scripts/compiler_tests/clang/test.sh new file mode 100755 index 0000000..e30bcae --- /dev/null +++ b/scripts/compiler_tests/clang/test.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +cd /p2pool +git fetch --jobs=$(nproc) +git checkout $1 +git submodule update --recursive --jobs $(nproc) + +COMPILER="-DCMAKE_C_COMPILER=clang-$2 -DCMAKE_CXX_COMPILER=clang++-$2" + +cd /p2pool +mkdir build && cd build + +cmake .. -DCMAKE_BUILD_TYPE=Release $COMPILER 1>> /p2pool/output.log 2>&1 +make -j$(nproc) p2pool 1>> /p2pool/output.log 2>&1 +./p2pool --test 1>> /p2pool/output.log 2>&1 + +cd ../tests +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE=Release $COMPILER 1>> /p2pool/output.log 2>&1 +make -j$(nproc) p2pool_tests 1>> /p2pool/output.log 2>&1 +gunzip *.gz +./p2pool_tests 1>> /p2pool/output.log 2>&1 + +tar -czvf /p2pool/logs.tar.gz /p2pool/output.log diff --git a/scripts/compiler_tests/gcc/build.sh b/scripts/compiler_tests/gcc/build.sh index bc4a70a..c8de652 100755 --- a/scripts/compiler_tests/gcc/build.sh +++ b/scripts/compiler_tests/gcc/build.sh @@ -7,7 +7,7 @@ cd "$(dirname "$0")" docker build --build-arg P2POOL_VERSION=$1 --build-arg GCC_VERSION=$2 -t p2pool_compiler_test_gcc_$2 . docker create --name p2pool_compiler_test_gcc_$2_container p2pool_compiler_test_gcc_$2:latest -docker cp p2pool_compiler_test_gcc_$2_container:/p2pool/logs.tar.gz logs_$2.tar.gz +docker cp p2pool_compiler_test_gcc_$2_container:/p2pool/logs.tar.gz gcc_$2_logs.tar.gz docker rm p2pool_compiler_test_gcc_$2_container docker image rm -f p2pool_compiler_test_gcc_$2 diff --git a/scripts/compiler_tests/images/ubuntu/prepare.sh b/scripts/compiler_tests/images/ubuntu/prepare.sh index cb2e37c..a1192fc 100755 --- a/scripts/compiler_tests/images/ubuntu/prepare.sh +++ b/scripts/compiler_tests/images/ubuntu/prepare.sh @@ -6,7 +6,7 @@ echo "Installing prerequisites" export DEBIAN_FRONTEND=noninteractive apt-get update && apt-get upgrade -yq --no-install-recommends -apt-get install -yq --no-install-recommends ca-certificates curl bzip2 flex git gcc g++ cmake make libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev +apt-get install -yq --no-install-recommends ca-certificates curl bzip2 flex lsb-release wget software-properties-common gnupg git gcc g++ cmake make libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev echo "Installing GCC 8.5.0" @@ -120,6 +120,18 @@ mkdir build && cd build make -j$(nproc) make install +echo "Installing clang" + +cd /root + +curl -L -O https://apt.llvm.org/llvm.sh +chmod +x llvm.sh + +for i in 17 18 19 20; +do + ./llvm.sh $i +done + echo "Cloning the repository" cd / diff --git a/tests/cmake/flags.cmake b/tests/cmake/flags.cmake index 06f2c89..2a75f80 100644 --- a/tests/cmake/flags.cmake +++ b/tests/cmake/flags.cmake @@ -51,7 +51,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) set(GENERAL_FLAGS "-pthread") endif() - set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal") + set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wno-nan-infinity-disabled -Wno-unknown-warning-option") if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(OPTIMIZATION_FLAGS "-O0 -g3")