diff --git a/.travis.yml b/.travis.yml index 44ce3dc..27d0de1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: - sudo apt-get install -y libz-dev gcc-multilib libz-dev:i386 libc6-dev-i386 valgrind clang gcc-4.8-multilib gcc-mingw-w64-i686 script: - - scripts/run_tests.sh native freestanding + - scripts/run_tests.sh - name: clang static analyzer os: linux @@ -30,7 +30,7 @@ matrix: before_install: - sudo apt-get install -y libz-dev valgrind clang script: - - scripts/run_tests.sh native freestanding + - scripts/run_tests.sh - name: gzip and cross-compile-for-Windows tests (Linux) os: linux @@ -39,7 +39,6 @@ matrix: - sudo apt-get install -y libz-dev valgrind gcc-mingw-w64-x86-64 libz-mingw-w64-dev script: - - scripts/run_tests.sh gzip - make CC=i686-w64-mingw32-gcc CFLAGS=-Werror all test_programs - make CC=x86_64-w64-mingw32-gcc CFLAGS=-Werror all test_programs @@ -87,4 +86,4 @@ matrix: before_install: - sudo apt-get install -y libz-dev valgrind clang script: - - scripts/run_tests.sh native freestanding + - scripts/run_tests.sh diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index fcdc216..de963b7 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -1,36 +1,13 @@ #!/bin/bash # # Test script for libdeflate -# -# Usage: ./scripts/run_tests.sh [TESTGROUP]... [-TESTGROUP]... -# -# By default all tests are run, but it is possible to explicitly include or -# exclude specific test groups. -# set -eu -o pipefail cd "$(dirname "$0")/.." -TESTGROUPS=(all) - -set_test_groups() { - TESTGROUPS=("$@") - local have_exclusion=0 - local have_all=0 - for group in "${TESTGROUPS[@]}"; do - if [[ $group == -* ]]; then - have_exclusion=1 - elif [[ $group == all ]]; then - have_all=1 - fi - done - if (( have_exclusion && !have_all )); then - TESTGROUPS=(all "${TESTGROUPS[@]}") - fi -} - -if [ $# -gt 0 ]; then - set_test_groups "$@" +if [ $# -ne 0 ]; then + echo 1>&2 "Usage: $0" + exit 2 fi if [ -z "${TESTDATA:-}" ]; then @@ -62,27 +39,6 @@ run_cmd() { "$@" > /dev/null } -test_group_included() { - local included=0 group - for group in "${TESTGROUPS[@]}"; do - if [ "$group" = "$1" ]; then - included=1 # explicitly included - break - fi - if [ "$group" = "-$1" ]; then - included=0 # explicitly excluded - break - fi - if [ "$group" = "all" ]; then # implicitly included - included=1 - fi - done - if (( included )); then - log "Starting test group: $1" - fi - (( included )) -} - have_valgrind() { if ! type -P valgrind > /dev/null; then log_skip "valgrind not found; can't run tests with valgrind" @@ -142,7 +98,6 @@ native_build_and_test() { } native_tests() { - test_group_included native || return 0 local compiler compilers_to_try=(gcc) local cflags cflags_to_try=("") shopt -s nullglob @@ -183,7 +138,6 @@ native_tests() { # Test the library built with FREESTANDING=1. freestanding_tests() { - test_group_included freestanding || return 0 WRAPPER= native_build_and_test FREESTANDING=1 if nm libdeflate.so | grep -q ' U '; then @@ -210,7 +164,6 @@ freestanding_tests() { ############################################################################### gzip_tests() { - test_group_included gzip || return 0 local gzip gunzip run_cmd make -j$NPROC gzip gunzip @@ -240,8 +193,6 @@ gzip_tests() { ############################################################################### log "Starting libdeflate tests" -log " TESTGROUPS=(${TESTGROUPS[@]})" -log " TESTDATA=$TESTDATA" native_tests freestanding_tests