check: use generated group files
[xfstests-dev.git] / tests / ext4 / 004
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Fujitsu.  All Rights Reserved.
4 #
5 # FSQA Test No. 004
6 #
7 # Test "dump | restore"(as opposed to a tape)
8 #
9 . ./common/preamble
10 _begin_fstest auto dump
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15         cd /
16         rm -f $tmp.*
17         # remove the generated data, which is much and meaningless.
18         rm -rf $restore_dir
19 }
20
21 # Import common functions.
22 . ./common/filter
23
24 dump_dir=$SCRATCH_MNT/dump_restore_dir
25 restore_dir=$TEST_DIR/dump_restore_dir
26
27 workout()
28 {
29         echo "Run fsstress" >> $seqres.full
30         args=`_scale_fsstress_args -z -f creat=5 -f write=20 -f mkdir=5 -n 100 -p 15 -d $dump_dir`
31         echo "fsstress $args" >> $seqres.full
32
33         $FSSTRESS_PROG $args >> $seqres.full 2>&1
34
35         echo "start Dump/Restore" >> $seqres.full
36         cd $TEST_DIR
37
38         $DUMP_PROG -0 -f - $dump_dir 2>/dev/null | $RESTORE_PROG -urvf - >> $seqres.full 2>&1
39         if [ $? -ne 0 ];then
40                 _fail "Dump/Restore failed"
41         fi
42
43         rm -rf restoresymtable
44 }
45
46 # real QA test starts here
47 _supported_fs ext4
48
49 _require_test
50 _require_scratch
51
52 _require_command "$DUMP_PROG" dump
53 _require_command "$RESTORE_PROG" restore
54
55 echo "Silence is golden"
56
57 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
58 _scratch_mount
59 rm -rf $restore_dir $TEST_DIR/restoresymtable
60
61 workout
62 diff -r $dump_dir $restore_dir
63
64 status=0
65 exit