xfs/419: remove irrelevant swapfile test
[xfstests-dev.git] / tests / xfs / 049
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 049
6 #
7 # XFS on loop test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 _cleanup()
14 {
15     cd /
16     umount $SCRATCH_MNT/test2 > /dev/null 2>&1
17     umount $SCRATCH_MNT/test > /dev/null 2>&1
18     rm -f $tmp.*
19
20     if [ -w $seqres.full ]
21     then
22         echo "--- mounts at end (after cleanup)" >> $seqres.full
23         mount >> $seqres.full
24     fi
25 }
26
27 here=`pwd`
28 tmp=/tmp/$$
29 status=1        # failure is the default!
30 trap "_cleanup ; exit \$status" 0 1 2 3 15
31
32 # get standard environment, filters and checks
33 . ./common/rc
34 . ./common/filter
35
36 # real QA test starts here
37 _supported_fs xfs
38
39 _log()
40 {
41     echo "--- $*"
42     echo "--- $*" >> $seqres.full
43 }
44
45 _require_nonexternal
46 _require_scratch_nocheck
47 _require_no_large_scratch_dev
48 _require_loop
49 _require_extra_fs ext2
50
51 rm -f $seqres.full
52
53 echo "(dev=$SCRATCH_DEV, mount=$SCRATCH_MNT)" >> $seqres.full
54 echo "" >> $seqres.full
55
56 echo "--- mounts" >> $seqres.full
57 mount >> $seqres.full
58
59 _log "Create ext2 fs on scratch"
60 mkfs -t ext2 -F $SCRATCH_DEV >> $seqres.full 2>&1 \
61     || _fail "!!! failed to mkfs ext2"
62
63 _log "Mount ext2 fs on scratch"
64 mount -t ext2 $SCRATCH_DEV $SCRATCH_MNT >> $seqres.full 2>&1 \
65     || _fail "!!! failed to mount"
66
67 _log "Create xfs fs in file on scratch"
68 ${MKFS_XFS_PROG} -f -dfile,name=$SCRATCH_MNT/test.xfs,size=40m \
69     >> $seqres.full 2>&1 \
70     || _fail "!!! failed to mkfs xfs"
71
72 _log "Make mount points"
73 mkdir $SCRATCH_MNT/test $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
74     || _fail "!!! failed to make mount points"
75
76 _log "Mount xfs via loop"
77 mount -t xfs -o loop $SCRATCH_MNT/test.xfs $SCRATCH_MNT/test >> $seqres.full 2>&1 \
78     || _fail "!!! failed to loop mount xfs"
79
80 _log "stress"
81 $FSSTRESS_PROG -d $SCRATCH_MNT/test -n 1000 $FSSTRESS_AVOID >> $seqres.full 2>&1 \
82     || _fail "!!! stress failed"
83
84 _log "clean"
85 rm -rf $SCRATCH_MNT/test/* >> $seqres.full 2>&1 \
86     || _fail "!!! clean failed"
87
88 _log "create file for ext2 fs"
89 dd if=/dev/zero of=$SCRATCH_MNT/test/test.ext2 bs=1024 count=10240 >> $seqres.full 2>&1 \
90     || _fail "!!! create file failed"
91
92 _log "Create ext2 fs in file on looped xfs"
93 echo y | mkfs -t ext2 $SCRATCH_MNT/test/test.ext2 >> $seqres.full 2>&1 \
94     || _fail "!!! failed to mkfs ext2 on xfs"
95
96 _log "Mount ext2 on xfs via loop"
97 mount -t ext2 -o loop $SCRATCH_MNT/test/test.ext2 $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
98     || _fail "!!! failed to loop mount xfs"
99
100 _log "stress ext2 on xfs via loop"
101 $FSSTRESS_PROG -d $SCRATCH_MNT/test2 -n 1000 $FSSTRESS_AVOID >> $seqres.full 2>&1 \
102     || _fail "!!! stress ext2 failed"
103
104 _log "clean"
105 rm -rf $SCRATCH_MNT/test/* >> $seqres.full 2>&1 \
106     || _fail "!!! clean failed"
107
108 _log "umount ext2 on xfs"
109 umount $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
110     || _fail "!!! umount ext2 failed"
111
112 _log "umount xfs"
113 umount $SCRATCH_MNT/test >> $seqres.full 2>&1 \
114     || _fail "!!! umount xfs failed"
115
116 echo "--- mounts at end (before cleanup)" >> $seqres.full
117 mount >> $seqres.full
118
119 # success, all done
120 status=0
121 exit