From de4f3f4bb7a5dbbef4d2b5b6c1b0b97b4795e5e7 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: remove concept of skipping tests Just require that the needed programs have been installed. --- scripts/run_tests.sh | 68 ++++++++++---------------------------------- 1 file changed, 15 insertions(+), 53 deletions(-) diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index de963b7..9cffbab 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -24,12 +24,6 @@ SANITIZE_CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined,integer" ############################################################################### -TESTS_SKIPPED=0 -log_skip() { - log "[WARNING, TEST SKIPPED]: $@" - TESTS_SKIPPED=1 -} - log() { echo "[$(date)] $@" } @@ -39,20 +33,6 @@ run_cmd() { "$@" > /dev/null } -have_valgrind() { - if ! type -P valgrind > /dev/null; then - log_skip "valgrind not found; can't run tests with valgrind" - return 1 - fi -} - -have_ubsan() { - if ! type -P clang > /dev/null; then - log_skip "clang not found; can't run tests with UBSAN" - return 1 - fi -} - ############################################################################### native_build_and_test() { @@ -125,15 +105,11 @@ native_tests() { done done - if have_valgrind; then - log "Running tests with Valgrind" - WRAPPER="$VALGRIND" native_build_and_test - fi + log "Running tests with Valgrind" + WRAPPER="$VALGRIND" native_build_and_test - if have_ubsan; then - log "Running tests with undefined behavior sanitizer" - WRAPPER= native_build_and_test CC=clang CFLAGS="$SANITIZE_CFLAGS" - fi + log "Running tests with undefined behavior sanitizer" + WRAPPER= native_build_and_test CC=clang CFLAGS="$SANITIZE_CFLAGS" } # Test the library built with FREESTANDING=1. @@ -151,14 +127,10 @@ freestanding_tests() { return 1 fi - if have_valgrind; then - WRAPPER="$VALGRIND" native_build_and_test FREESTANDING=1 - fi + WRAPPER="$VALGRIND" native_build_and_test FREESTANDING=1 - if have_ubsan; then - WRAPPER= native_build_and_test FREESTANDING=1 \ - CC=clang CFLAGS="$SANITIZE_CFLAGS" - fi + WRAPPER= native_build_and_test FREESTANDING=1 \ + CC=clang CFLAGS="$SANITIZE_CFLAGS" } ############################################################################### @@ -176,30 +148,20 @@ gzip_tests() { done done - if have_valgrind; then - log "Running gzip program tests with Valgrind" - GZIP="$VALGRIND $PWD/gzip" GUNZIP="$VALGRIND $PWD/gunzip" \ - TESTDATA="$TESTDATA" ./scripts/gzip_tests.sh - fi + log "Running gzip program tests with Valgrind" + GZIP="$VALGRIND $PWD/gzip" GUNZIP="$VALGRIND $PWD/gunzip" \ + TESTDATA="$TESTDATA" ./scripts/gzip_tests.sh - if have_ubsan; then - log "Running gzip program tests with undefined behavior sanitizer" - run_cmd make -j$NPROC CC=clang CFLAGS="$SANITIZE_CFLAGS" gzip gunzip - GZIP="$PWD/gzip" GUNZIP="$PWD/gunzip" \ - TESTDATA="$TESTDATA" ./scripts/gzip_tests.sh - fi + log "Running gzip program tests with undefined behavior sanitizer" + run_cmd make -j$NPROC CC=clang CFLAGS="$SANITIZE_CFLAGS" gzip gunzip + GZIP="$PWD/gzip" GUNZIP="$PWD/gunzip" \ + TESTDATA="$TESTDATA" ./scripts/gzip_tests.sh } ############################################################################### log "Starting libdeflate tests" - native_tests freestanding_tests gzip_tests - -if (( TESTS_SKIPPED )); then - log "No tests failed, but some tests were skipped. See above." -else - log "All tests passed!" -fi +log "All tests passed!"