scripts/run_tests.sh: be compatible with old bash versions

Prior to bash 4.4, using an empty array with 'set -u' produced an error.
Work around it.
This commit is contained in:
Eric Biggers 2020-10-18 14:21:25 -07:00
parent 68a5b89a1b
commit ca42459cd7

View File

@ -142,20 +142,20 @@ native_build_and_test() {
# we test disabling. We just disable the features roughly in order from # we test disabling. We just disable the features roughly in order from
# newest to oldest for each architecture, cumulatively. In practice, # newest to oldest for each architecture, cumulatively. In practice,
# that's good enough to cover all the code. # that's good enough to cover all the code.
local features=() local features=('')
if ! [[ "$*" =~ "-march=native" ]]; then if ! [[ "$*" =~ "-march=native" ]]; then
case "$(uname -m)" in case "$(uname -m)" in
i386|x86_64) i386|x86_64)
features=(avx512bw avx2 avx bmi2 pclmul sse2) features+=(avx512bw avx2 avx bmi2 pclmul sse2)
;; ;;
arm*|aarch*) arm*|aarch*)
features=(crc32 pmull neon) features+=(crc32 pmull neon)
;; ;;
esac esac
fi fi
local disable_str="" local disable_str=""
local feature local feature
for feature in "" "${features[@]}"; do for feature in "${features[@]}"; do
if [ -n "$feature" ]; then if [ -n "$feature" ]; then
if [ -n "$disable_str" ]; then if [ -n "$disable_str" ]; then
disable_str+="," disable_str+=","