From 7b989b55f7c90e0855ccc0685eb77104a9622a2b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 9 Feb 2017 22:52:33 -0500 Subject: tests: Don't require bash associative arrays That's a bash 4 feature, while macOS is stuck on bash 3. --- tests.sh | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/tests.sh b/tests.sh index 3289f9a..95e7a9f 100755 --- a/tests.sh +++ b/tests.sh @@ -336,29 +336,16 @@ for arg; do esac done -declare -A run_tests - -for test in "${posix_tests[@]}"; do - run_tests["$test"]=yes -done - -if [ "$BSD" ]; then - for test in "${bsd_tests[@]}"; do - run_tests["$test"]=yes - done -fi - -if [ "$GNU" ]; then - for test in "${gnu_tests[@]}"; do - run_tests["$test"]=yes +function enable_tests() { + for test; do + declare -g run_$test=yes done -fi +} -if [ "$ALL" ]; then - for test in "${bfs_tests[@]}"; do - run_tests["$test"]=yes - done -fi +enable_tests "${posix_tests[@]}" +[ "$BSD" ] && enable_tests "${bsd_tests[@]}" +[ "$GNU" ] && enable_tests "${gnu_tests[@]}" +[ "$ALL" ] && enable_tests "${bfs_tests[@]}" function bfs_sort() { awk -F/ '{ print NF - 1 " " $0 }' | sort -n | cut -d' ' -f2- @@ -989,7 +976,9 @@ function test_printf_leak() { result=0 -for test in "${!run_tests[@]}"; do +for test in ${!run_*}; do + test=${test#run_} + if [ -t 1 ]; then printf '\r\033[J%s' "$test" else -- cgit v1.2.3