diff mbox series

[blktests,4/6] common/rc: introduce _require_test_dev_sysfs

Message ID 20230719071510.530623-5-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series fix failures with bio based device-mapper | expand

Commit Message

Shinichiro Kawasaki July 19, 2023, 7:15 a.m. UTC
The test case block/005 requires TEST_DEV to have the queue/scheduler
sysfs attribute. However, kernel no longer provides the attribute since
version 6.5. Add the helper function _require_test_dev_sysfs to check
the requirement.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/rc | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 52d1602..caaa49c 100644
--- a/common/rc
+++ b/common/rc
@@ -256,6 +256,14 @@  _test_dev_is_rotational() {
 	[[ $(cat "${TEST_DEV_SYSFS}/queue/rotational") -ne 0 ]]
 }
 
+_require_test_dev_sysfs() {
+	if [[ ! -e "${TEST_DEV_SYSFS}/$1" ]]; then
+		SKIP_REASONS+=("${TEST_DEV} does not have sysfs attribute $1")
+		return 1
+	fi
+	return 0
+}
+
 _require_test_dev_is_rotational() {
 	if ! _test_dev_is_rotational; then
 		SKIP_REASONS+=("$TEST_DEV is not rotational")