generic: add test for boundary in xfs_attr_shortform_verify
[xfstests-dev.git] / tests / generic / 570
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-newer
3 # Copyright (c) 2019, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 570
6 #
7 # Check that we can't modify a block device that's an active swap device.
8
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         swapoff $SCRATCH_DEV
22         rm -rf $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30 _supported_os Linux
31 _supported_fs generic
32 _require_test_program swapon
33 _require_scratch_nocheck
34 _require_block_device $SCRATCH_DEV
35 test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
36
37 rm -f $seqres.full
38
39 $MKSWAP_PROG "$SCRATCH_DEV" >> $seqres.full
40
41 # Can you modify the swap dev via previously open file descriptors?
42 for verb in 1 2 3 4; do
43         echo "verb $verb"
44         "$here/src/swapon" -v $verb $SCRATCH_DEV
45         swapoff $SCRATCH_DEV
46 done
47
48 swapon $SCRATCH_DEV 2>&1 | _filter_scratch
49
50 # Can we write to it?
51 $XFS_IO_PROG -c 'pwrite -S 0x59 64k 64k' $SCRATCH_DEV 2>&1 | _filter_xfs_io_error
52 $XFS_IO_PROG -d -c 'pwrite -S 0x60 64k 64k' $SCRATCH_DEV 2>&1 | _filter_xfs_io_error
53 $XFS_IO_PROG -c 'mmap -rw 64k 64k' -c 'mwrite -S 0x61 64k 64k' $SCRATCH_DEV
54
55 # success, all done
56 status=0
57 exit