common: kill _supported_os
[xfstests-dev.git] / tests / xfs / 419
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 419
6 #
7 # Check that we can't swapon a realtime file.
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 7 15
17
18 _cleanup()
19 {
20         cd /
21         rm -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs xfs
30 _require_realtime
31 _require_scratch_swapfile
32
33 echo "Format and mount"
34 _scratch_mkfs > $seqres.full 2>&1
35 _scratch_mount >> $seqres.full 2>&1
36
37 testdir=$SCRATCH_MNT/test-$seq
38 mkdir $testdir
39
40 blocks=160
41 blksz=65536
42
43 echo "Initialize file"
44 echo >> $seqres.full
45 $XFS_IO_PROG -c "open -f -R $testdir/dummy" $testdir >> $seqres.full
46 echo moo >> $testdir/dummy
47 $XFS_IO_PROG -c "open -f -R $testdir/file1" $testdir >> $seqres.full
48 _pwrite_byte 0x61 0 $((blocks * blksz)) $testdir/file1 >> $seqres.full
49 $MKSWAP_PROG -U 27376b42-ff65-42ca-919f-6c9b62292a5c $testdir/file1 >> $seqres.full
50
51 echo "Try to swapon"
52 swapon $testdir/file1 2>&1 | _filter_scratch
53
54 swapoff $testdir/file1 >> $seqres.full 2>&1
55
56 # success, all done
57 status=0
58 exit