]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
meta/{016,017}: add test cases to check repeated test case runs
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Sat, 4 May 2024 08:14:35 +0000 (17:14 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 9 May 2024 07:37:06 +0000 (16:37 +0900)
Add test cases to confirm the feature to repeat test case runs with
different conditions is working.

Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Acked-by: Nitesh Shetty <nj.shetty@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/meta/016 [new file with mode: 0755]
tests/meta/016.out [new file with mode: 0644]
tests/meta/017 [new file with mode: 0755]
tests/meta/017.out [new file with mode: 0644]

diff --git a/tests/meta/016 b/tests/meta/016
new file mode 100755 (executable)
index 0000000..caf876d
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Western Digital Corporation or its affiliates.
+#
+# Test repeated test() run with set_conditions()
+
+. tests/meta/rc
+
+DESCRIPTION="repeat test()"
+
+declare cond_set_index
+
+set_conditions() {
+       local index=$1
+
+       if [[ -z $index ]]; then
+               echo 2
+               return
+       fi
+
+       cond_set_index=$index
+       COND_DESC="condition set $index"
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+       echo "condition set $cond_set_index" >> "$FULL"
+       echo "Test complete"
+}
diff --git a/tests/meta/016.out b/tests/meta/016.out
new file mode 100644 (file)
index 0000000..cccfec4
--- /dev/null
@@ -0,0 +1,2 @@
+Running meta/016
+Test complete
diff --git a/tests/meta/017 b/tests/meta/017
new file mode 100755 (executable)
index 0000000..03f92d6
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Western Digital Corporation or its affiliates.
+#
+# Test repeated test_device() run with set_conditions()
+
+. tests/meta/rc
+
+DESCRIPTION="repeat test_device()"
+
+declare cond_set_index
+
+set_conditions() {
+       local index=$1
+
+       if [[ -z $index ]]; then
+               echo 2
+               return
+       fi
+
+       cond_set_index=$index
+       COND_DESC="condition set $index"
+}
+
+test_device() {
+       echo "Running ${TEST_NAME}"
+       echo "condition set $cond_set_index" >> "$FULL"
+       echo "Test complete"
+}
diff --git a/tests/meta/017.out b/tests/meta/017.out
new file mode 100644 (file)
index 0000000..7fc55ff
--- /dev/null
@@ -0,0 +1,2 @@
+Running meta/017
+Test complete