Skip to content

Commit

Permalink
update test running scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
i80287 committed Oct 24, 2024
1 parent fd27f2f commit f721971
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 63 deletions.
11 changes: 11 additions & 0 deletions tests/prepare_stage_for_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/env bash

function prepare_tests_data_and_cd_to_build_dir() {
build_dir="$1"
if [ -d "$build_dir" ]; then rm -r "$build_dir"; fi
mkdir -p "$build_dir"
cp ../number_theory/u64-primes.txt "./$build_dir/u64-primes.txt"
cp ../number_theory/u128-primes.txt "./$build_dir/u128-primes.txt"
cp ../tf_idf_actrie/Anglo_Saxon_Chronicle.txt "./$build_dir/Anglo_Saxon_Chronicle.txt"
cd "./$build_dir" || return 1
}
22 changes: 11 additions & 11 deletions tests/run_clang_tests.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash

build_dir=cmake-build-tests-clang
#!/bin/env bash

set -e

if [ -d "$build_dir" ]; then rm -r "$build_dir"; fi
mkdir -p "$build_dir"
cp ../number_theory/u64-primes.txt ./$build_dir/u64-primes.txt
cp ../number_theory/u128-primes.txt ./$build_dir/u128-primes.txt
cp ../tf_idf_actrie/Anglo_Saxon_Chronicle.txt ./$build_dir/Anglo_Saxon_Chronicle.txt
cd ./$build_dir
build_dir=cmake-build-tests-clang

. ./prepare_stage_for_tests.sh
prepare_tests_data_and_cd_to_build_dir "$build_dir"

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S .. -B . &&
make all --jobs "$(nproc)" &&
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_C_COMPILER=clang \
-D CMAKE_CXX_COMPILER=clang++ \
-S .. -B . &&
cmake --build . --parallel "$(nproc)" &&
env CTEST_OUTPUT_ON_FAILURE=1 make test
17 changes: 9 additions & 8 deletions tests/run_codechecker.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#!/bin/env bash

set -e

build_dir=cmake-build-codechecker
cmake_build_dir=cmake-build-dir

set -e

mkdir -p "$build_dir"
cp ./.clang-tidy ./$build_dir
cd ./$build_dir || exit 1
Expand All @@ -16,13 +16,14 @@ for cc_and_cxx in clang,clang++ gcc,g++ i686-w64-mingw32-gcc-posix,i686-w64-ming
mkdir -p "$cmake_build_dir"
set -- $cc_and_cxx
echo "cc = $1, c++ = $2"
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER="$1" \
-DCMAKE_CXX_COMPILER="$2" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_C_COMPILER="$1" \
-D CMAKE_CXX_COMPILER="$2" \
-D CMAKE_EXPORT_COMPILE_COMMANDS=1 \
-S .. \
-B $cmake_build_dir
cd ./$cmake_build_dir && make all --jobs "$(nproc)" && cd ..
cmake --build ./$cmake_build_dir --parallel "$(nproc)"
CodeChecker analyze \
./$cmake_build_dir/compile_commands.json \
--analyzer-config cppcheck:addons=../cppcheck/addons/misc.py \
Expand Down
21 changes: 10 additions & 11 deletions tests/run_gcc_mingw_32_tests.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/bash

build_dir=cmake-build-tests-gcc-mingw-w32
#!/bin/env bash

set -e

if [ -d "$build_dir" ]; then rm -r "$build_dir"; fi
mkdir -p "$build_dir"
cp ../number_theory/u64-primes.txt ./$build_dir/u64-primes.txt
cp ../number_theory/u128-primes.txt ./$build_dir/u128-primes.txt
cp ../tf_idf_actrie/Anglo_Saxon_Chronicle.txt ./$build_dir/Anglo_Saxon_Chronicle.txt
cd ./$build_dir
build_dir=cmake-build-tests-gcc-mingw-w32

. ./prepare_stage_for_tests.sh
prepare_tests_data_and_cd_to_build_dir "$build_dir"

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc-posix -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++-posix -S .. -B . &&
make all --jobs "$(nproc)"
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_C_COMPILER=i686-w64-mingw32-gcc-posix \
-D CMAKE_CXX_COMPILER=i686-w64-mingw32-g++-posix \
-S .. -B . &&
cmake --build . --parallel "$(nproc)"

shopt -s nullglob
for test_executable in *.exe; do
Expand Down
21 changes: 10 additions & 11 deletions tests/run_gcc_mingw_64_tests.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/bash

build_dir=cmake-build-tests-gcc-mingw-w64
#!/bin/env bash

set -e

if [ -d "$build_dir" ]; then rm -r "$build_dir"; fi
mkdir -p "$build_dir"
cp ../number_theory/u64-primes.txt ./$build_dir/u64-primes.txt
cp ../number_theory/u128-primes.txt ./$build_dir/u128-primes.txt
cp ../tf_idf_actrie/Anglo_Saxon_Chronicle.txt ./$build_dir/Anglo_Saxon_Chronicle.txt
cd ./$build_dir
build_dir=cmake-build-tests-gcc-mingw-w64

. ./prepare_stage_for_tests.sh
prepare_tests_data_and_cd_to_build_dir "$build_dir"

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc-posix -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix -S .. -B . &&
make all --jobs "$(nproc)"
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc-posix \
-D CMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix \
-S .. -B . &&
cmake --build . --parallel "$(nproc)"

shopt -s nullglob
for test_executable in *.exe; do
Expand Down
22 changes: 11 additions & 11 deletions tests/run_gcc_tests.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash

build_dir=cmake-build-tests-gcc
#!/bin/env bash

set -e

if [ -d "$build_dir" ]; then rm -r "$build_dir"; fi
mkdir -p "$build_dir"
cp ../number_theory/u64-primes.txt ./$build_dir/u64-primes.txt
cp ../number_theory/u128-primes.txt ./$build_dir/u128-primes.txt
cp ../tf_idf_actrie/Anglo_Saxon_Chronicle.txt ./$build_dir/Anglo_Saxon_Chronicle.txt
cd ./$build_dir
build_dir=cmake-build-tests-gcc

. ./prepare_stage_for_tests.sh
prepare_tests_data_and_cd_to_build_dir "$build_dir"

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -S .. -B . &&
make all --jobs "$(nproc)" &&
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_C_COMPILER=gcc \
-D CMAKE_CXX_COMPILER=g++ \
-S .. -B . &&
cmake --build . --parallel "$(nproc)" &&
env CTEST_OUTPUT_ON_FAILURE=1 make test
22 changes: 11 additions & 11 deletions tests/run_macos_clang_tests.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash

build_dir=cmake-build-tests-macos-clang
#!/bin/env bash

set -e

if [ -d "$build_dir" ]; then rm -r "$build_dir"; fi
mkdir -p "$build_dir"
cp ../number_theory/u64-primes.txt ./$build_dir/u64-primes.txt
cp ../number_theory/u128-primes.txt ./$build_dir/u128-primes.txt
cp ../tf_idf_actrie/Anglo_Saxon_Chronicle.txt ./$build_dir/Anglo_Saxon_Chronicle.txt
cd ./$build_dir
build_dir=cmake-build-tests-macos-clang

. ./prepare_stage_for_tests.sh
prepare_tests_data_and_cd_to_build_dir "$build_dir"

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S .. -B . &&
make all --jobs "$(sysctl -n hw.logicalcpu)" &&
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_C_COMPILER=clang \
-D CMAKE_CXX_COMPILER=clang++ \
-S .. -B . &&
cmake --build . --parallel "$(sysctl -n hw.logicalcpu)" &&
env CTEST_OUTPUT_ON_FAILURE=1 make test

0 comments on commit f721971

Please sign in to comment.