2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
7 # To test log replay with version 2 logs
8 # Initially keep this simple with just creates.
9 # In another qa test we can do more e.g. use fsstress.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 # get standard environment, filters and checks
25 # real QA test starts here
28 rm -f $seqres.full $tmp.*
30 _require_scratch_shutdown
34 _scratch_unmount >/dev/null 2>&1
36 _scratch_mkfs >/dev/null 2>&1
37 _require_metadata_journaling $SCRATCH_DEV
39 _get_log_configs > $tmp.seq.params
41 # Do the work for various log params which
42 # should not effect the data content of the log
43 # Try with and without sync'ing - sync'ing will mean that
44 # the log will be written out unfilled and thus the log
45 # stripe can have an effect.
47 for s in sync nosync ; do
49 | while read mkfs mnt restofline
51 if [ "$mkfs" = "#" ]; then
55 echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---" >>$seqres.full
56 export MKFS_OPTIONS="-l $mkfs"
57 export MOUNT_OPTIONS="-o $mnt"
61 _scratch_mkfs >>$seqres.full 2>&1
62 if [ $? -ne 0 ] ; then
63 _echofull "mkfs failed: $MKFS_OPTIONS"
69 if ! _try_scratch_mount >>$seqres.full 2>&1; then
70 _echofull "mount failed: $MOUNT_OPTIONS"
75 if [ $s = "sync" ]; then
76 # generate some log traffic - but not too much
77 # add some syncs to get the log flushed to disk
78 for file in $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
83 # generate some log traffic - but not too much - life gets a little
84 # more complicated if the log wraps around. This traffic is
85 # pretty much arbitary, but could probably be made better than this.
86 touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
89 # check before on what FS should look like
90 _echofull "ls SCRATCH_MNT"
91 ls $SCRATCH_MNT | _filter_lostfound
94 _scratch_shutdown -v -f >> $seqres.full
97 _scratch_unmount >>$seqres.full 2>&1 \
98 || _fail "umount failed"
100 _echofull "logprint after going down..."
103 _echofull "mount with replay"
104 _try_scratch_mount >>$seqres.full 2>&1 \
105 || _fail "mount failed: $MOUNT_OPTIONS"
107 # check on what FS looks like after log recovery
108 _echofull "ls SCRATCH_MNT"
109 ls $SCRATCH_MNT | _filter_lostfound
114 _echofull "logprint after mount and replay..."
117 if _check_scratch_fs; then
118 _echofull "filesystem is checked ok"
120 _echofull "filesystem is NOT ok"