Skip to content

Commit b6b104b

Browse files
committed
scsi/011: allow "set -e" in run_test
The test case has the function run_test() which enables bash errexit feature in it, so that command failures can be caught easily. However, this errexit feature is not working because the call to run_test() is followed by '||' operator. (ref: "set -e" description in man bash) To enable the bash errexit feature in the call to run_test(), do not use the '||' operator. Instead, check the exit value of the run_test() using the special parameter '$?'. This triggers the shellcheck warning SC2181 then suppress it. Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 2341aa0 commit b6b104b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/scsi/011

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ test() {
5353

5454
(
5555
run_test
56-
) || fail=true
56+
)
57+
# shellcheck disable=SC2181
58+
(($? != 0)) && fail=true
5759

5860
umount "${mount_dir}" >>"${FULL}" 2>&1
5961
head -n 999 /sys/bus/pseudo/drivers/scsi_debug/group_number_stats >> "${FULL}"

0 commit comments

Comments
 (0)