overlay/075: fix wrong invocation of t_immutable

t_immutable cannot be run twice on the same test directoty, because
append-only directory tests create files in append-only.d and those
file already exist from the first run.

Use separate test directories for the first and second t_immutable runs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Amir Goldstein
2021-06-05 12:43:26 +03:00
committed by Eryu Guan
parent ffc8893a66
commit 91104670c9
+8 -4
View File
@@ -30,6 +30,7 @@ _cleanup()
# we just need to remove the flags so use -R
$timmutable -R $upperdir/testdir &> /dev/null
$timmutable -R $lowerdir/testdir &> /dev/null
$timmutable -R $lowerdir/testdir.before &> /dev/null
rm -f $tmp.*
}
@@ -45,13 +46,16 @@ _require_scratch
_scratch_mkfs
# Preparing test area files in lower dir and check chattr support of base fs
# Check chattr support of base fs
mkdir -p $lowerdir
mkdir -p $upperdir
$timmutable -C $lowerdir/testdir >$tmp.out 2>&1
$timmutable -C $lowerdir/testdir.before >$tmp.out 2>&1
if grep -q -e 'Operation not supported' -e "Inappropriate ioctl" $tmp.out; then
_notrun "Setting immutable/append flag not supported"
fi
# Prepare test area files in lower dir
$timmutable -C $lowerdir/testdir >$tmp.out 2>&1
# Remove the immutable/append-only flags and create subdirs
$timmutable -R $lowerdir/testdir >$tmp.out 2>&1
for dir in $lowerdir/testdir/*.d; do
@@ -62,9 +66,9 @@ $timmutable -C $lowerdir/testdir >$tmp.out 2>&1
_scratch_mount
# Test immutability of files in overlay
# Test immutability of files in overlay before copy up
echo "Before directories copy up"
$timmutable $SCRATCH_MNT/testdir 2>&1
$timmutable $SCRATCH_MNT/testdir.before 2>&1
# 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