mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: hirofumi@mail.parknet.co.jp, shuah@kernel.org
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/filesystems: Fix run_fat_tests hang
Date: Wed, 21 Oct 2026 15:50:15 -0600	[thread overview]
Message-ID: <20261021215045.26522-1-skhan@linuxfoundation.org> (raw)

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


                 reply	other threads:[~2026-10-21 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261021215045.26522-1-skhan@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®