summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-02-11 19:11:35 -0700
committerJens Axboe <axboe@kernel.dk>2021-02-11 19:11:35 -0700
commitb94dc28f53d597ab8cf99886d43be64b1190e134 (patch)
treeb0ad2e1f9ff90a0a8024ab05af9f81a8697db5ee
parent10a9ff846dd62d2975f791c21731aafe1f8562bb (diff)
downloadliburing-b94dc28f53d597ab8cf99886d43be64b1190e134.tar.gz
liburing-b94dc28f53d597ab8cf99886d43be64b1190e134.tar.bz2
tests: make the per-test device/file map TEST_MAP
It's fine to be able to specify per test files, but it's a pain for other cases. Make TEST_FILES just be a generic list of files again, and use those if the file(s) for the test in question is empty. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/config5
-rwxr-xr-xtest/runtests.sh20
2 files changed, 20 insertions, 5 deletions
diff --git a/test/config b/test/config
index 1bd9b40..6c0925a 100644
--- a/test/config
+++ b/test/config
@@ -4,4 +4,7 @@
# TEST_EXCLUDE=""
#
# Define raw test devices (or files) for test cases, if any
-# declare -A TEST_FILES=()
+# declare -A TEST_MAP=()
+#
+# If no TEST_MAP entry exists for a test, use the ones given in TEST_FILES
+# TEST_FILES="/dev/somedevice /data/somefile"
diff --git a/test/runtests.sh b/test/runtests.sh
index 071bd35..e8f4ae5 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -8,7 +8,8 @@ TEST_DIR=$(dirname $0)
FAILED=""
SKIPPED=""
MAYBE_FAILED=""
-declare -A TEST_FILES
+TEST_FILES=""
+declare -A TEST_MAP
# Only use /dev/kmsg if running as root
DO_KMSG="1"
@@ -17,12 +18,18 @@ DO_KMSG="1"
# Include config.local if exists and check TEST_FILES for valid devices
if [ -f "$TEST_DIR/config.local" ]; then
. $TEST_DIR/config.local
- for dev in ${TEST_FILES[@]}; do
+ for dev in $TEST_FILES; do
if [ ! -e "$dev" ]; then
echo "Test file $dev not valid"
exit 1
fi
done
+ for dev in ${TEST_MAP[@]}; do
+ if [ ! -e "$dev" ]; then
+ echo "Test file in map $dev not valid"
+ exit 1
+ fi
+ done
fi
_check_dmesg()
@@ -109,10 +116,15 @@ run_test()
# Run all specified tests
for tst in $TESTS; do
- if [ ! -n "${TEST_FILES[$tst]}" ]; then
+ if [ ! -n "${TEST_MAP[$tst]}" ]; then
run_test $tst
+ if [ ! -z "$TEST_FILES" ]; then
+ for dev in $TEST_FILES; do
+ run_test $tst $dev
+ done
+ fi
else
- run_test $tst ${TEST_FILES[$tst]}
+ run_test $tst ${TEST_MAP[$tst]}
fi
done