generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 266
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 SGI.  All Rights Reserved.
4 #
5 # FS QA Test No. 266
6 #
7 # Test incremental dumps with -D (skip unchanged dirs)
8 #
9 . ./common/preamble
10 _begin_fstest dump ioctl auto quick
11
12 status=0        # success is the default!
13
14 # Override the default cleanup function.
15 _cleanup()
16 {
17         _cleanup_dump
18         cd /
19         rm -f $tmp.*
20 }
21
22 #
23 # Add a new file and append a subset of the fill'ed files
24 # So we can see if just these get dumped on an incremental
25 #
26 _add_and_append_dumpdir_fill()
27 {
28     cd $dump_dir
29     echo 'New file' >> newfile
30     _append_dumpdir_fill
31 }
32
33 # Quota files are stored as special files in the dumpdir of the incremental
34 # backup.  This throws off the directory/file count reported because xfsrestore
35 # includes the dumpdir in the restore summary counts.
36 filter_cumulative_quota_updates() {
37     $here/src/feature -U $SCRATCH_DEV && quota=1
38     $here/src/feature -G $SCRATCH_DEV && quota=1
39     $here/src/feature -P $SCRATCH_DEV && quota=1
40
41     $AWK_PROG -v quota=$quota '
42         /entries processed/ {
43                 if (quota) {$2--; $5--;}
44         }
45         {print}'
46 }
47
48 # Import common functions.
49 . ./common/dump
50
51 # real QA test starts here
52 _supported_fs xfs
53
54 $XFSDUMP_PROG -h 2>&1 | grep -q -e -D
55 if [ $? -ne 0 ]; then
56     _notrun "requires xfsdump -D"
57 fi
58
59 _create_dumpdir_fill
60 # ensure file/dir timestamps precede dump timestamp
61 sleep 2
62 _do_dump_file -f $tmp.df.0
63 _add_and_append_dumpdir_fill
64 _do_dump_file -f $tmp.df.1 -l 1 -D
65 _prepare_restore_dir
66 _do_restore_file_cum -f $tmp.df.0
67 _do_restore_file_cum -f $tmp.df.1 | filter_cumulative_quota_updates
68 _ls_compare_sub
69 _diff_compare
70
71 # success, all done
72 exit