From f32f83727bd2cef39998bcc9e74653d3a5ccd18f Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 16 Apr 2017 12:18:16 -0400 Subject: tests.sh: Allow individual tests to be specified on the command line --- tests.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests.sh b/tests.sh index 61aab2a..5fed800 100755 --- a/tests.sh +++ b/tests.sh @@ -324,6 +324,12 @@ BSD=yes GNU=yes ALL=yes +function enable_tests() { + for test; do + eval run_$test=yes + done +} + for arg; do case "$arg" in --bfs=*) @@ -352,6 +358,10 @@ for arg; do --update) UPDATE=yes ;; + test_*) + EXPLICIT=yes + enable_tests "$arg" + ;; *) echo "Unrecognized option '$arg'." >&2 exit 1 @@ -359,16 +369,12 @@ for arg; do esac done -function enable_tests() { - for test; do - eval run_$test=yes - done -} - -enable_tests "${posix_tests[@]}" -[ "$BSD" ] && enable_tests "${bsd_tests[@]}" -[ "$GNU" ] && enable_tests "${gnu_tests[@]}" -[ "$ALL" ] && enable_tests "${bfs_tests[@]}" +if [ -z "$EXPLICIT" ]; then + enable_tests "${posix_tests[@]}" + [ "$BSD" ] && enable_tests "${bsd_tests[@]}" + [ "$GNU" ] && enable_tests "${gnu_tests[@]}" + [ "$ALL" ] && enable_tests "${bfs_tests[@]}" +fi function bfs_sort() { awk -F/ '{ print NF - 1 " " $0 }' | sort -n | cut -d' ' -f2- -- cgit v1.2.3