[LTP] [PATCH v4 2/9] shell API/tests: Require root for TST_{FORMAT, MOUNT}_DEVICE

Petr Vorel pvorel@suse.cz
Fri Sep 2 15:37:03 CEST 2022


Although the warning is quite obvious:
tst_device.c:101: TINFO: Not allowed to open /dev/loop-control. Are you root?: EACCES (13)
tst_device.c:140: TINFO: No free devices found
TBROK: Failed to acquire device

it's safer to expect root to get valid result.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/newlib_tests/shell/tst_format_device.sh      | 1 +
 lib/newlib_tests/shell/tst_mount_device.sh       | 1 +
 lib/newlib_tests/shell/tst_mount_device_tmpfs.sh | 1 +
 3 files changed, 3 insertions(+)

diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh
index 73a919086..dbe4ea9e7 100755
--- a/lib/newlib_tests/shell/tst_format_device.sh
+++ b/lib/newlib_tests/shell/tst_format_device.sh
@@ -3,6 +3,7 @@
 # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
 
 TST_FORMAT_DEVICE=1
+TST_NEEDS_ROOT=1
 TST_TESTFUNC=test
 TST_CNT=2
 TST_DEV_FS_OPTS="-b 1024"
diff --git a/lib/newlib_tests/shell/tst_mount_device.sh b/lib/newlib_tests/shell/tst_mount_device.sh
index 561f878d2..70f80f84a 100755
--- a/lib/newlib_tests/shell/tst_mount_device.sh
+++ b/lib/newlib_tests/shell/tst_mount_device.sh
@@ -3,6 +3,7 @@
 # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
 
 TST_MOUNT_DEVICE=1
+TST_NEEDS_ROOT=1
 TST_FS_TYPE=ext4
 TST_TESTFUNC=test
 TST_CNT=3
diff --git a/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh b/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh
index 36a78bc85..ed2ba8c50 100755
--- a/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh
+++ b/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh
@@ -3,6 +3,7 @@
 # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
 
 TST_MOUNT_DEVICE=1
+TST_NEEDS_ROOT=1
 TST_FS_TYPE=tmpfs
 TST_TESTFUNC=test
 
-- 
2.37.2



More information about the ltp mailing list