Files
apfstests/tests/btrfs/075
T
Dave Chinner 1ff4192932 btrfs: convert tests to SPDX license tags
Fully scripted conversion, see script in initial SPDX license commit
message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:50 +10:00

55 lines
1.2 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2014 Red Hat Inc. All rights reserved.
#
# FSQA Test No. btrfs/075
#
# If one subvolume was mounted with selinux context, other subvolumes
# should be able to be mounted with the same selinux context too.
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
$UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# real QA test starts here
_supported_fs btrfs
_supported_os Linux
_require_scratch
# SELINUX_MOUNT_OPTIONS will be set in common/config if selinux is enabled
if [ "$SELINUX_MOUNT_OPTIONS" == "" ]; then
_notrun "Require selinux to be enabled"
fi
rm -f $seqres.full
echo "Silence is golden"
# first mount default subvolume with selinux context set
_scratch_mkfs >$seqres.full 2>&1
_scratch_mount
# create a new subvolume and mount it with the same selinux context
subvol_mnt=$TEST_DIR/$seq.mnt
mkdir -p $subvol_mnt
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol >>$seqres.full 2>&1
$MOUNT_PROG -o subvol=subvol $SELINUX_MOUNT_OPTIONS $SCRATCH_DEV $subvol_mnt
status=$?
exit