selftests/filesystems: Fix run_fat_tests hang
Subsystems (2)
Shuah Khan
maintainerPATCH 1/1 selftests/filesystems: Fix run_fat_tests hang
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 <[email protected]>
--- .../selftests/filesystems/fat/run_fat_tests.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/testing/selftests/filesystems/fat/run_fat_tests.sh +14 -0
@@ -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
Signature · 1 line
2.48.1