]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/126: run it inside its own subdirectory
authorJeff Layton <jlayton@kernel.org>
Thu, 20 Feb 2025 11:26:38 +0000 (06:26 -0500)
committerZorro Lang <zlang@kernel.org>
Fri, 21 Feb 2025 15:51:20 +0000 (23:51 +0800)
I had been seeing some failures in generic/126 when running on NFS under
kdevops. The problem turned out to be that kdevops makes the root of the
NFS export mode 01777 by default (i.e. with the sticky bit set). This
causes some of these permission tests to fail because the open() is
called with the O_CREAT bit set.

Make the outcome of this test not depend on the permissions on
$TEST_DIR. Create a new directory to do these tests in, and clean it up
when done.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/126

index 142d2bb97db706bafd2152856ef0993c5c273441..17819a4dfd922b2c8be67731b74730f8878ed0b4 100755 (executable)
@@ -13,6 +13,8 @@ _begin_fstest perms auto quick
 _cleanup()
 {
     cd /
+    rm -r -f $tmp.*
+    test -n "$testdir" && rm -rf "$testdir"
 }
 
 # Import common functions.
@@ -20,10 +22,21 @@ _cleanup()
 
 _require_test
 _require_chown
+_require_chmod
 
 QA_FS_PERMS=$here/src/fs_perms
 
-cd $TEST_DIR
+
+# This test is testing filesystem permissions. If the sticky bit is set on
+# the directory, that can affect the outcome. Create a new directory with
+# known permissions in which to run this test.
+testdir="$TEST_DIR/generic-${seq}.$$"
+rm -rf $testdir
+mkdir $testdir
+chown 0:0 $testdir
+chmod 0755 $testdir
+cd $testdir
+
 cp $here/src/testx ./testx.file
 
 # file_perm owner_uid owner_gid tester_uid tester_gid perm_to_test expected_result pass=1
@@ -46,7 +59,5 @@ $QA_FS_PERMS 200 99 99 200 99 w 1
 $QA_FS_PERMS 040 99 99 99 500 r 1
 $QA_FS_PERMS 400 99 99 200 99 r 1
 
-rm -f ./testx.file
-
 status=0
 exit