Compiler test scripts: added clang

This commit is contained in:
SChernykh
2025-07-06 22:47:18 +02:00
parent 2f51c38549
commit e179208053
8 changed files with 62 additions and 4 deletions

View File

@@ -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")

View File

@@ -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

View File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 /

View File

@@ -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")