lib/: spdx license conversion
[xfstests-dev.git] / tests / generic / 052
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 052
6 #
7 # To test log replay by shutdown of file system
8 # This is the first simple initial test to ensure that
9 # the goingdown ioctl is working and recovery of
10 # create transactions is working.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20
21 # get standard environment, filters and checks
22 . ./common/rc
23 . ./common/filter
24 . ./common/log
25
26 # real QA test starts here
27 _supported_fs generic
28 _supported_os Linux
29
30 rm -f $seqres.full
31 rm -f $tmp.log
32
33 _require_scratch
34 _require_scratch_shutdown
35 _require_logstate
36
37 echo "mkfs"
38 _scratch_mkfs >>$seqres.full 2>&1 \
39     || _fail "mkfs scratch failed"
40 _require_metadata_journaling $SCRATCH_DEV
41
42 echo "mount"
43 _scratch_mount
44
45 echo "touch files"
46 touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
47
48 echo "godown"
49 _scratch_shutdown -v -f >> $seqres.full
50
51 echo "unmount"
52 _scratch_unmount
53
54 echo "logprint after going down..."
55 _print_logstate
56
57 # curious if FS consistent at start
58 if false; then
59     if _check_scratch_fs; then
60        echo "*** checked ok ***"
61     fi
62 fi
63
64 echo "mount with replay"
65 _try_scratch_mount $mnt >>$seqres.full 2>&1 \
66     || _fail "mount failed: $mnt $MOUNT_OPTIONS"
67
68 echo "ls SCRATCH_MNT"
69 ls $SCRATCH_MNT | _filter_lostfound
70
71 echo "unmount"
72 _scratch_unmount
73
74 echo "logprint after mount and replay..."
75 _print_logstate
76
77 # success, all done
78 status=0
79 exit