diff options
author | Kir Kolyshkin <kolyshkin@gmail.com> | 2022-04-13 04:03:29 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2022-08-31 01:42:25 +0300 |
commit | 6128eb6185b4ca61b2ec4fabe3dc28565e7f643c (patch) | |
tree | e1cb8bfabfd57dc680a720a66833f54e577c0f88 | |
parent | ebe87704316990613dd765e19786e62948ccd80e (diff) |
test/others/crit/test.sh: use bash array
In fact an array (aptly named array) is already used in run_test2,
so let's just make it an array right from the start.
While at it, remove ls invocation.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
-rwxr-xr-x | test/others/crit/test.sh | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/test/others/crit/test.sh b/test/others/crit/test.sh index 7db88e0a9..5d13066e7 100755 --- a/test/others/crit/test.sh +++ b/test/others/crit/test.sh @@ -6,7 +6,7 @@ set -x # shellcheck source=test/others/env.sh source ../env.sh -images_list="" +images_list=() function gen_imgs { PID=$(../loop) @@ -17,15 +17,15 @@ function gen_imgs { exit 1 fi - images_list=$(ls -1 ./*.img) - if [ -z "$images_list" ]; then + images_list=(./*.img) + if [ "${#images_list[@]}" -eq 0 ]; then echo "Failed to generate images" exit 1 fi } function run_test1 { - for x in $images_list + for x in "${images_list[@]}" do echo "=== $x" if [[ $x == *pages* ]]; then @@ -46,9 +46,7 @@ function run_test1 { function run_test2 { - mapfile -t array <<< "$images_list" - - PROTO_IN=${array[0]} + PROTO_IN="${images_list[0]}" JSON_IN=$(mktemp -p ./ tmp.XXXXXXXXXX.json) OUT=$(mktemp -p ./ tmp.XXXXXXXXXX.log) |