selftests: ublk: one fix and two improvement
Subsystems (3)
cover selftests: ublk: one fix and two improvement
Hi Jens,
The 2nd patch avoids to show modprobe failure in case that ublk_drv is built-in or not enabled.
The other two patches improves test deployment.
Thanks,
Ming
Ming Lei (3):
selftests: ublk: add one dependency header
selftests: ublk: don't show modprobe failure
selftests: ublk: add variable for user to not show test result
tools/testing/selftests/ublk/kublk.h | 1 + tools/testing/selftests/ublk/test_common.sh | 20 ++++++++++++-------- tools/testing/selftests/ublk/ublk_dep.h | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 tools/testing/selftests/ublk/ublk_dep.h
Signature · 1 line
2.47.0
PATCH 1/3 selftests: ublk: add one dependency header
Add one dependency helper which can include new uapi definition which isn't synced from kernel.
This way also helps a lot for downstream test deployment.
--- tools/testing/selftests/ublk/kublk.h | 1 + tools/testing/selftests/ublk/ublk_dep.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tools/testing/selftests/ublk/ublk_dep.h
tools/testing/selftests/ublk/kublk.h +1 -0
@@ -21,6 +21,7 @@#include <sys/eventfd.h> #include <liburing.h> #include <linux/ublk_cmd.h> +#include "ublk_dep.h" #define __maybe_unused __attribute__((unused))#define MAX_BACK_FILES 4
tools/testing/selftests/ublk/ublk_dep.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef UBLK_DEP_H +#define UBLK_DEP_H + +#ifndef UBLK_U_IO_REGISTER_IO_BUF +#define UBLK_U_IO_REGISTER_IO_BUF \ + _IOWR('u', 0x23, struct ublksrv_io_cmd) +#define UBLK_U_IO_UNREGISTER_IO_BUF \ + _IOWR('u', 0x24, struct ublksrv_io_cmd) +#endif + +#ifndef UBLK_F_USER_RECOVERY_FAIL_IO +#define UBLK_F_USER_RECOVERY_FAIL_IO (1ULL << 9) +#endif + +#ifndef UBLK_F_ZONED +#define UBLK_F_ZONED (1ULL << 8) +#endif +#endif
Signature · 1 line
2.47.0
PATCH 2/3 selftests: ublk: don't show `modprobe` failure
In reply to Ming Leiublk_drv may be built-in, so don't show modprobe failure, and we do check /dev/ublk-control for skipping test if ublk_drv isn't enabled.
--- tools/testing/selftests/ublk/test_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ublk/test_common.sh +2 -2
@@ -64,7 +64,7 @@ _check_root() { _remove_ublk_devices() { ${UBLK_PROG} del -a - modprobe -r ublk_drv + modprobe -r ublk_drv > /dev/null 2>&1 } _get_ublk_dev_state() {
@@ -79,7 +79,7 @@ _prep_test() { _check_root local type=$1 shift 1 - modprobe ublk_drv + modprobe ublk_drv > /dev/null 2>&1 [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "ublk $type: $*" }
Signature · 1 line
2.47.0
PATCH 3/3 selftests: ublk: add variable for user to not show test result
In reply to Ming LeiSome user decides test result by exit code only, and wouldn't like to be bothered by the test result.
--- tools/testing/selftests/ublk/test_common.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
tools/testing/selftests/ublk/test_common.sh +10 -6
@@ -94,12 +94,14 @@ _remove_test_files() _show_result() { - if [ "$2" -eq 0 ]; then - echo "$1 : [PASS]" - elif [ "$2" -eq 4 ]; then - echo "$1 : [SKIP]" - else - echo "$1 : [FAIL]" + if [ "$UBLK_TEST_SHOW_RESULT" -ne 0 ]; then + if [ "$2" -eq 0 ]; then + echo "$1 : [PASS]" + elif [ "$2" -eq 4 ]; then + echo "$1 : [SKIP]" + else + echo "$1 : [FAIL]" + fi fi [ "$2" -ne 0 ] && exit "$2" return 0
@@ -216,5 +218,7 @@ _ublk_test_top_dir() UBLK_PROG=$(_ublk_test_top_dir)/kublk UBLK_TEST_QUIET=1 +UBLK_TEST_SHOW_RESULT=1 export UBLK_PROG export UBLK_TEST_QUIET +export UBLK_TEST_SHOW_RESULT
Signature · 1 line
2.47.0
Quoted 9 lines · Ming Lei
The 2nd patch avoids to show modprobe failure in case that
ublk_drvis built-in or not enabled.The other two patches improves test deployment.
Thanks,
Ming[...]
Applied, thanks!
[1/3] selftests: ublk: add one dependency header
commit: bed99afa346e220bd3b2c767ded44ade21685d35
[2/3] selftests: ublk: don't show `modprobe` failure
commit: 51847a3ed0ff088b83135d535dc9db26c10c706b
[3/3] selftests: ublk: add variable for user to not show test result
commit: f8b2ce9ab8f8e0db224378fb1860e5188c89b2beBest regards,
Signature · 1 line
Jens Axboe