generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 262
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. 262
6 #
7 # Copy xfs_scrub to the scratch device, then run xfs_scrub in forced
8 # repair mode (which will rebuild the data forks of the running scrub
9 # executable and libraries!) to see what happens.
10 #
11 . ./common/preamble
12 _begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair
13
14 _register_cleanup "_cleanup" BUS
15
16 # Import common functions.
17 . ./common/filter
18 . ./common/fuzzy
19 . ./common/inject
20
21 # real QA test starts here
22 _supported_fs xfs
23 _require_command "$LDD_PROG" ldd
24 _require_scrub
25 _require_scratch
26 # xfs_scrub will turn on error injection itself
27 _require_xfs_io_error_injection "force_repair"
28
29 echo "Format and populate"
30 _scratch_mkfs > "$seqres.full" 2>&1
31 _scratch_mount
32 cp $XFS_SCRUB_PROG $SCRATCH_MNT/xfs_scrub
33 $LDD_PROG $XFS_SCRUB_PROG | sed -e '/\//!d;/linux-gate/d;/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' | while read lib; do
34         cp $lib $SCRATCH_MNT/
35 done
36 LD_LIBRARY_PATH=$SCRATCH_MNT $LDD_PROG $SCRATCH_MNT/xfs_scrub >> $seqres.full
37
38 echo "Force online repairs"
39 XFS_SCRUB_FORCE_REPAIR=1 LD_LIBRARY_PATH=$SCRATCH_MNT $SCRATCH_MNT/xfs_scrub -dTv $SCRATCH_MNT >> $seqres.full
40
41 # success, all done
42 status=0
43 exit