Files
apfstests/tests/overlay/030
T
Darrick J. Wong a860a167d8 common: kill _supported_os
fstests only supports Linux, so get rid of this unnecessary predicate.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2020-09-21 01:16:50 +08:00

56 lines
1.3 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017 CTERA Networks. All Rights Reserved.
#
# FS QA Test No. 030
#
# Run the t_immutable test program for immutable/append-only files
# and directories in an overlayfs upper directory.
#
# This test is similar and was derived from generic/079, but
# the original test is _notrun on overlay mount because FS_IOC_GETFLAGS
# FS_IOC_SETFLAGS ioctls fail on overlay directory inodes.
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
timmutable=$here/src/t_immutable
upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
$timmutable -r $upperdir/t_immutable &> /dev/null
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
_supported_fs overlay
_require_chattr ia
_require_test_program "t_immutable"
_require_scratch
_scratch_mkfs
# Preparing immutable files in uppper dir
mkdir -p $upperdir
$timmutable -C $upperdir/t_immutable >$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
_scratch_mount
# Test immutability of files in overlay
$timmutable $SCRATCH_MNT/t_immutable 2>&1
status=$?
exit