Skip to content

Commit 3bf5406

Browse files
Ming Leiaxboe
authored andcommitted
selftests: ublk: move creating UBLK_TMP into _prep_test()
test may exit early because of missing program or not having required feature before calling _prep_test(), then $UBLK_TMP isn't cleaned. Fix it by moving creating $UBLK_TMP into _prep_test(), any resources created since _prep_test() will be cleaned by _cleanup_test(). Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250412023035.2649275-14-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2f9a30b commit 3bf5406

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/ublk/test_common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ _prep_test() {
114114
local type=$1
115115
shift 1
116116
modprobe ublk_drv > /dev/null 2>&1
117+
UBLK_TMP=$(mktemp ublk_test_XXXXX)
117118
[ "$UBLK_TEST_QUIET" -eq 0 ] && echo "ublk $type: $*"
118119
}
119120

@@ -338,7 +339,6 @@ _ublk_test_top_dir()
338339
cd "$(dirname "$0")" && pwd
339340
}
340341

341-
UBLK_TMP=$(mktemp ublk_test_XXXXX)
342342
UBLK_PROG=$(_ublk_test_top_dir)/kublk
343343
UBLK_TEST_QUIET=1
344344
UBLK_TEST_SHOW_RESULT=1

0 commit comments

Comments
 (0)