generic/507: support more filesystems
authorAmir Goldstein <amir73il@gmail.com>
Fri, 11 Jun 2021 13:10:29 +0000 (16:10 +0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 13 Jun 2021 14:54:48 +0000 (22:54 +0800)
The commit message introducing the test says:
"We only check below attribute modification which most filesystem
 supports:
    - no atime updates (A)
    - secure deletion (s)
    - synchronous updates (S)
    - undeletable (u)
"
But in fact, very few filesystems support the (s) and (u) flags.
xfs and btrfs do not support them for example.

The test doesn't need to check those specific flags, so replace those
flags with immutable (i) and append-only (a), which most filesystems
really do support.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/507

index b654883a1e52d8960a52294bf6261f6671f2f895..cf9758452f8ee84c109faaf9e688c1b0709e8378 100755 (executable)
@@ -9,13 +9,13 @@
 # i_flags can be recovered after sudden power-cuts.
 # 1. touch testfile;
 # 1.1 sync (optional)
 # i_flags can be recovered after sudden power-cuts.
 # 1. touch testfile;
 # 1.1 sync (optional)
-# 2. chattr +[AsSu] testfile
+# 2. chattr +[ASai] testfile
 # 3. xfs_io -f testfile -c "fsync";
 # 4. godown;
 # 5. umount;
 # 6. mount;
 # 7. check i_flags
 # 3. xfs_io -f testfile -c "fsync";
 # 4. godown;
 # 5. umount;
 # 6. mount;
 # 7. check i_flags
-# 8. chattr -[AsSu] testfile
+# 8. chattr -[ASai] testfile
 # 9. xfs_io -f testfile -c "fsync";
 # 10. godown;
 # 11. umount;
 # 9. xfs_io -f testfile -c "fsync";
 # 10. godown;
 # 11. umount;
@@ -34,6 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
        cd /
 _cleanup()
 {
        cd /
+       $CHATTR_PROG -ai $testfile &> /dev/null
        rm -f $tmp.*
 }
 
        rm -f $tmp.*
 }
 
@@ -49,7 +50,7 @@ _supported_fs generic
 
 _require_command "$LSATTR_PROG" lasttr
 _require_command "$CHATTR_PROG" chattr
 
 _require_command "$LSATTR_PROG" lasttr
 _require_command "$CHATTR_PROG" chattr
-_require_chattr AsSu
+_require_chattr ASai
 
 _require_scratch
 _require_scratch_shutdown
 
 _require_scratch
 _require_scratch_shutdown
@@ -79,7 +80,7 @@ do_check()
 
        before=`$LSATTR_PROG $testfile`
 
 
        before=`$LSATTR_PROG $testfile`
 
-       $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
+       $XFS_IO_PROG -r -f $testfile -c "fsync" | _filter_xfs_io
 
        _scratch_shutdown | tee -a $seqres.full
        _scratch_cycle_mount
 
        _scratch_shutdown | tee -a $seqres.full
        _scratch_cycle_mount
@@ -101,7 +102,7 @@ do_check()
 
        before=`$LSATTR_PROG $testfile`
 
 
        before=`$LSATTR_PROG $testfile`
 
-       $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
+       $XFS_IO_PROG -r -f $testfile -c "fsync" | _filter_xfs_io
 
        _scratch_shutdown | tee -a $seqres.full
        _scratch_cycle_mount
 
        _scratch_shutdown | tee -a $seqres.full
        _scratch_cycle_mount
@@ -122,7 +123,7 @@ do_check()
 
 echo "Silence is golden"
 
 
 echo "Silence is golden"
 
-opts="A s S u"
+opts="A S a i"
 for i in $opts; do
        do_check $i
        do_check $i sync
 for i in $opts; do
        do_check $i
        do_check $i sync