scripts/run_tests.sh: remove concept of test groups

Now that run_tests.sh has been cleaned up to remove (or move) test
groups that weren't very useful, remove the concept of test groups and
just run all the tests.
This commit is contained in:
Eric Biggers 2020-10-18 14:21:26 -07:00
parent 63efed8dee
commit 634291abd6
2 changed files with 6 additions and 56 deletions

View File

@ -13,7 +13,7 @@ matrix:
- sudo apt-get install -y libz-dev gcc-multilib libz-dev:i386 - 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 libc6-dev-i386 valgrind clang gcc-4.8-multilib gcc-mingw-w64-i686
script: script:
- scripts/run_tests.sh native freestanding - scripts/run_tests.sh
- name: clang static analyzer - name: clang static analyzer
os: linux os: linux
@ -30,7 +30,7 @@ matrix:
before_install: before_install:
- sudo apt-get install -y libz-dev valgrind clang - sudo apt-get install -y libz-dev valgrind clang
script: script:
- scripts/run_tests.sh native freestanding - scripts/run_tests.sh
- name: gzip and cross-compile-for-Windows tests (Linux) - name: gzip and cross-compile-for-Windows tests (Linux)
os: linux os: linux
@ -39,7 +39,6 @@ matrix:
- sudo apt-get install -y libz-dev valgrind - sudo apt-get install -y libz-dev valgrind
gcc-mingw-w64-x86-64 libz-mingw-w64-dev gcc-mingw-w64-x86-64 libz-mingw-w64-dev
script: script:
- scripts/run_tests.sh gzip
- make CC=i686-w64-mingw32-gcc CFLAGS=-Werror all test_programs - make CC=i686-w64-mingw32-gcc CFLAGS=-Werror all test_programs
- make CC=x86_64-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: before_install:
- sudo apt-get install -y libz-dev valgrind clang - sudo apt-get install -y libz-dev valgrind clang
script: script:
- scripts/run_tests.sh native freestanding - scripts/run_tests.sh

View File

@ -1,36 +1,13 @@
#!/bin/bash #!/bin/bash
# #
# Test script for libdeflate # 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 set -eu -o pipefail
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
TESTGROUPS=(all) if [ $# -ne 0 ]; then
echo 1>&2 "Usage: $0"
set_test_groups() { exit 2
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 "$@"
fi fi
if [ -z "${TESTDATA:-}" ]; then if [ -z "${TESTDATA:-}" ]; then
@ -62,27 +39,6 @@ run_cmd() {
"$@" > /dev/null "$@" > /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() { have_valgrind() {
if ! type -P valgrind > /dev/null; then if ! type -P valgrind > /dev/null; then
log_skip "valgrind not found; can't run tests with valgrind" log_skip "valgrind not found; can't run tests with valgrind"
@ -142,7 +98,6 @@ native_build_and_test() {
} }
native_tests() { native_tests() {
test_group_included native || return 0
local compiler compilers_to_try=(gcc) local compiler compilers_to_try=(gcc)
local cflags cflags_to_try=("") local cflags cflags_to_try=("")
shopt -s nullglob shopt -s nullglob
@ -183,7 +138,6 @@ native_tests() {
# Test the library built with FREESTANDING=1. # Test the library built with FREESTANDING=1.
freestanding_tests() { freestanding_tests() {
test_group_included freestanding || return 0
WRAPPER= native_build_and_test FREESTANDING=1 WRAPPER= native_build_and_test FREESTANDING=1
if nm libdeflate.so | grep -q ' U '; then if nm libdeflate.so | grep -q ' U '; then
@ -210,7 +164,6 @@ freestanding_tests() {
############################################################################### ###############################################################################
gzip_tests() { gzip_tests() {
test_group_included gzip || return 0
local gzip gunzip local gzip gunzip
run_cmd make -j$NPROC gzip gunzip run_cmd make -j$NPROC gzip gunzip
@ -240,8 +193,6 @@ gzip_tests() {
############################################################################### ###############################################################################
log "Starting libdeflate tests" log "Starting libdeflate tests"
log " TESTGROUPS=(${TESTGROUPS[@]})"
log " TESTDATA=$TESTDATA"
native_tests native_tests
freestanding_tests freestanding_tests