From fb3bbaad0bab786e22cc7149d171d39c3cbcffac Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 18 Oct 2020 14:21:26 -0700 Subject: [PATCH] scripts/run_tests.sh: define $MAKE variable ... so that we don't have to remember to add -j everytime. Also switch to a better way of getting the number of processors. --- scripts/run_tests.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 9cffbab..3e63c96 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -18,7 +18,8 @@ if [ -z "${TESTDATA:-}" ]; then | head -c 1000000 > "$TESTDATA" fi -NPROC=$(grep -c processor /proc/cpuinfo) +MAKE="make -j$(getconf _NPROCESSORS_ONLN)" + VALGRIND="valgrind --quiet --error-exitcode=100 --leak-check=full --errors-for-leak-kinds=all" SANITIZE_CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined,integer" @@ -39,8 +40,7 @@ native_build_and_test() { # Build libdeflate, including the test programs. Set the special test # support flag to get support for LIBDEFLATE_DISABLE_CPU_FEATURES. - make "$@" TEST_SUPPORT__DO_NOT_USE=1 \ - -j$NPROC all test_programs > /dev/null + $MAKE "$@" TEST_SUPPORT__DO_NOT_USE=1 all test_programs > /dev/null # When not using -march=native, run the tests multiple times with # different combinations of CPU features disabled. This is needed to @@ -138,7 +138,7 @@ freestanding_tests() { gzip_tests() { local gzip gunzip - run_cmd make -j$NPROC gzip gunzip + run_cmd $MAKE gzip gunzip for gzip in "$PWD/gzip" /bin/gzip; do for gunzip in "$PWD/gunzip" /bin/gunzip; do log "Running gzip program tests with GZIP=$gzip," \ @@ -153,7 +153,7 @@ gzip_tests() { TESTDATA="$TESTDATA" ./scripts/gzip_tests.sh log "Running gzip program tests with undefined behavior sanitizer" - run_cmd make -j$NPROC CC=clang CFLAGS="$SANITIZE_CFLAGS" gzip gunzip + run_cmd $MAKE CC=clang CFLAGS="$SANITIZE_CFLAGS" gzip gunzip GZIP="$PWD/gzip" GUNZIP="$PWD/gunzip" \ TESTDATA="$TESTDATA" ./scripts/gzip_tests.sh }