overlay/075: add test coverage for clearing immutable/append-only flags
authorAmir Goldstein <amir73il@gmail.com>
Sun, 6 Jun 2021 15:18:11 +0000 (18:18 +0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 13 Jun 2021 15:00:19 +0000 (23:00 +0800)
overlay/075 is a variant of check -overlay generic/079.

check -overlay generic/079 does the following operations on overlay fs:
1. Create files
2. Set immutable/append-only flags
3. Verify files/dirs behaving as immutable/append-only
4. Clear immutable/append-only flags
5. Remove files

overlay/075 performs steps 1,2,4,5 on upper and lower layers
and only step 3 is performed on overlay fs (before and after copy up
and mount cycle).

Add also steps 4,5 to be performed on overlay fs to increase the
test coverage of the "merged" inode xflags feature.

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

index 02df15990b9edca44e43fae35402331b2399e151..f05858b396461d5ffa80d24f7f10bfe8ff0a7c6e 100755 (executable)
@@ -69,6 +69,8 @@ _scratch_mount
 # Test immutability of files in overlay before copy up
 echo "Before directories copy up"
 $timmutable $SCRATCH_MNT/testdir.before 2>&1
 # Test immutability of files in overlay before copy up
 echo "Before directories copy up"
 $timmutable $SCRATCH_MNT/testdir.before 2>&1
+# Remove the immutable/append-only flags before mount cycle
+$timmutable -R $SCRATCH_MNT/testdir.before &> /dev/null
 
 # Trigger copy-up of immutable/append-only dirs by touching their subdirs
 # inode flags are not copied-up, so immutable/append-only flags are lost
 
 # Trigger copy-up of immutable/append-only dirs by touching their subdirs
 # inode flags are not copied-up, so immutable/append-only flags are lost
@@ -88,9 +90,18 @@ done
 # After mount cycle, flags are forever lost
 _scratch_cycle_mount
 
 # After mount cycle, flags are forever lost
 _scratch_cycle_mount
 
+# Verify that files can be deleted from overlay fs after clearing
+# immutable/append-only flags and mount cycle
+rm -rf $SCRATCH_MNT/testdir.before
+
 # Test immutability of files in overlay after directories copy-up
 echo "After directories copy up"
 $timmutable $SCRATCH_MNT/testdir 2>&1
 
 # Test immutability of files in overlay after directories copy-up
 echo "After directories copy up"
 $timmutable $SCRATCH_MNT/testdir 2>&1
 
+# Verify that files can be deleted from overlay fs after clearing
+# immutable/append-only flags
+$timmutable -R $SCRATCH_MNT/testdir &> /dev/null
+rm -rf $SCRATCH_MNT/testdir
+
 status=$?
 exit
 status=$?
 exit