]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
fstests: don't use directory stacks
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 23:02:01 +0000 (10:02 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 14:15:27 +0000 (22:15 +0800)
Using bash directory stacking (pushd, popd, etc) seems to be
somewhat unreliable. I've been seeing occasional random failures
from both pushd and popd commands that cause the test to fail, and
there does not appear to be any reason for the failures occurring.

Rather than wasting time chasing ghosts, just get rid of the
directory stacking altogether.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/099
tests/generic/109
tests/generic/135
tests/generic/707

index c7d5932b6905c4d79e33e5a0f67fe032f278c9e8..980fd38f3aa87d7edf9138b84ba058f3a8ec236b 100755 (executable)
@@ -253,15 +253,13 @@ echo ""
 echo "=== Recursive change ACL ==="
 rm -fr root
 mkdir root
-pushd root >/dev/null
 # create an arbitrary little tree
-for i in 1 2 3 4 5 6 7 8 9 0
-do
+( cd root ; for i in 1 2 3 4 5 6 7 8 9 0; do
        mkdir -p a/$i
        mkdir -p b/c$i/$i
        touch a/$i/mumble
-done
-popd >/dev/null
+done )
+
 chown -R 12345:54321 root
 echo "Change #1..."
 _runas -u 12345 -g 54321 -- chacl -r u::rwx,g::-w-,o::--x root
index 2b0b438cf835f3d895d028465aa2ad12b69bfd10..894e07167d7e41debda158ab751240ce9afcd37d 100755 (executable)
@@ -54,10 +54,7 @@ _scratch_mount >> $seqres.full 2>&1
 # Test different directory sizes to test various directory formats
 for f in 1 2 3 4 5 8 12 18 27 40 60 90 135 202 303 454 681 1020 1530 2295; do
        mkdir $SCRATCH_MNT/dir$f
-       pushd $SCRATCH_MNT/dir$f >/dev/null
-       filldir $f
-       renamedir
-       popd >/dev/null
+       ( cd $SCRATCH_MNT/dir$f ; filldir $f ; renamedir )
 done
 
 status=0
index 30c52af7270587ebc7df8680348a979e180d7c43..392fee6fc60d6f5284695ed4b2d81dc1d4449782 100755 (executable)
@@ -18,33 +18,29 @@ _require_scratch
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
-cd $SCRATCH_MNT
-
 # create file with async I/O
-$XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x12 0 4k' async_file > /dev/null
+$XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x12 0 4k' $SCRATCH_MNT/async_file > /dev/null
 
 # create file with sync I/O
-$XFS_IO_PROG -f -s -c 'pwrite -b 4k -S 0x34 0 4k' sync_file > /dev/null
+$XFS_IO_PROG -f -s -c 'pwrite -b 4k -S 0x34 0 4k' $SCRATCH_MNT/sync_file > /dev/null
 
 # create file with direct I/O
-$XFS_IO_PROG -f -d -c 'pwrite -b 4k -S 0x56 0 4k' direct_file > /dev/null
+$XFS_IO_PROG -f -d -c 'pwrite -b 4k -S 0x56 0 4k' $SCRATCH_MNT/direct_file > /dev/null
 
 # create file, truncate and then dirty again
-$XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x78 0 4k' trunc_file > /dev/null
-$XFS_IO_PROG -f -c 'truncate 2k' trunc_file > /dev/null
-$XFS_IO_PROG -c 'pwrite 1k 0 1k' trunc_file > /dev/null
+$XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x78 0 4k' $SCRATCH_MNT/trunc_file > /dev/null
+$XFS_IO_PROG -f -c 'truncate 2k' $SCRATCH_MNT/trunc_file > /dev/null
+$XFS_IO_PROG -c 'pwrite 1k 0 1k' $SCRATCH_MNT/trunc_file > /dev/null
 
-pushd / > /dev/null
 _scratch_cycle_mount
-popd > /dev/null
 
 # check file size and contents
-od -Ad -x async_file
-od -Ad -x sync_file
-od -Ad -x direct_file
-od -Ad -x trunc_file
+od -Ad -x $SCRATCH_MNT/async_file
+od -Ad -x $SCRATCH_MNT/sync_file
+od -Ad -x $SCRATCH_MNT/direct_file
+od -Ad -x $SCRATCH_MNT/trunc_file
 
-rm -f async_file sync_file direct_file trunc_file
+rm -f $SCRATCH_MNT/*
 
 status=0
 exit 
index fd02eacf9f335e9973644e48a033aada2d914745..3d8fac4bd6a586f61ebc19cf3302e29b0e6432b6 100755 (executable)
@@ -42,7 +42,7 @@ create_files()
        # We use slightly longer file name to make directory grow faster and
        # hopefully convert between various types
        for (( i = 0; i < $files; i++ )); do
-               touch somewhatlongerfilename$i
+               echo -n > somewhatlongerfilename$i
        done
 }
 
@@ -50,12 +50,13 @@ for (( i = 0; i <= $moves; i++ )); do
        mkdir $SCRATCH_MNT/dir$i
 done
 
+start_dir=$PWD
 for (( l = 0; l < $loops; l++ )); do
        mkdir $SCRATCH_MNT/dir0/dir
-       pushd $SCRATCH_MNT/dir0/dir &>/dev/null
+       cd $SCRATCH_MNT/dir0/dir
        create_files &
        BGPID=$!
-       popd &>/dev/null
+       cd $start_dir
        for (( i = 0; i < $moves; i++ )); do
                mv $SCRATCH_MNT/dir$i/dir $SCRATCH_MNT/dir$((i+1))/dir
        done