mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/filesystems: Fix run_fat_tests hang
@ 2026-10-21 21:50 Shuah Khan
  0 siblings, 0 replies; only message in thread
From: Shuah Khan @ 2026-10-21 21:50 UTC (permalink / raw)
  To: hirofumi, shuah; +Cc: Shuah Khan, linux-kselftest, linux-kernel

run_fat_tests script hangs waiting at sudo prompt preventing the
kselftest default test to complete when a non-privileged user
runs the test. This is incorrect test behavior. Fix it to test
for root and skip the test.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 .../selftests/filesystems/fat/run_fat_tests.sh     | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/testing/selftests/filesystems/fat/run_fat_tests.sh b/tools/testing/selftests/filesystems/fat/run_fat_tests.sh
index d61264d4795d..0712c8d23fd7 100755
--- a/tools/testing/selftests/filesystems/fat/run_fat_tests.sh
+++ b/tools/testing/selftests/filesystems/fat/run_fat_tests.sh
@@ -15,6 +15,8 @@ BASE_DIR="$(dirname $0)"
 TMP_DIR="$(mktemp -d /tmp/fat_tests_tmp.XXXXXX)"
 IMG_PATH="${TMP_DIR}/fat.img"
 MNT_PATH="${TMP_DIR}/mnt"
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
 
 cleanup()
 {
@@ -23,6 +25,17 @@ cleanup()
 }
 trap cleanup SIGINT SIGTERM EXIT
 
+check_prereqs()
+{
+        local msg="skip all tests:"
+        local uid=$(id -u)
+
+        if [ $uid -ne 0 ]; then
+                echo $msg must be run as root >&2
+                exit $ksft_skip
+        fi
+}
+
 create_loopback()
 {
     touch "${IMG_PATH}"
@@ -73,6 +86,7 @@ unmount_image()
     sudo umount "${MNT_PATH}" &> /dev/null
 }
 
+check_prereqs
 create_loopback
 mount_image
 rename_exchange_test
-- 
2.48.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-21 21:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 21:50 [PATCH] selftests/filesystems: Fix run_fat_tests hang Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®