generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 017
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. 017
6 #
7 # test remount ro - pv 795642
8 #
9 . ./common/preamble
10 _begin_fstest mount auto quick stress
11
12 _register_cleanup "_cleanup; rm -f $tmp.*"
13
14 # Override the default cleanup function.
15 _cleanup()
16 {
17     echo "*** unmount"
18     _scratch_unmount 2>/dev/null
19 }
20
21 # Import common functions.
22 . ./common/filter
23
24 # real QA test starts here
25 _supported_fs xfs
26
27 _require_scratch
28
29 # xfs_db will OOM kill the machine if you don't have huge amounts of RAM, so
30 # don't run this on large filesystems.
31 _require_no_large_scratch_dev
32
33 echo "*** init FS"
34
35 _scratch_unmount >/dev/null 2>&1
36 echo "*** MKFS ***"                         >>$seqres.full
37 echo ""                                     >>$seqres.full
38 _scratch_mkfs_xfs                           >>$seqres.full 2>&1 \
39     || _fail "mkfs failed"
40 _scratch_mount
41
42 echo "*** test"
43
44 for l in 0 1 2 3 4
45 do
46         echo "    *** test $l"
47         FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -n 1000 $FSSTRESS_AVOID`
48         $FSSTRESS_PROG  $FSSTRESS_ARGS >>$seqres.full
49
50         _try_scratch_mount -o remount,ro \
51             || _fail "remount ro failed"
52
53         echo ""                                 >>$seqres.full
54         echo "*** xfs_logprint ***"             >>$seqres.full
55         echo ""                                 >>$seqres.full
56         _scratch_xfs_logprint -tb               | tee -a $seqres.full \
57             | head | grep -q "<CLEAN>" || _fail "DIRTY LOG"
58
59         echo ""                             >>$seqres.full
60         echo "*** XFS_CHECK ***"            >>$seqres.full
61         echo ""                             >>$seqres.full
62         _scratch_xfs_check                  >>$seqres.full 2>&1 \
63             || _fail "xfs_check failed"
64         _try_scratch_mount -o remount,rw \
65             || _fail "remount rw failed"
66 done
67
68 echo "*** done"
69 # happy exit
70 status=0
71 exit 0