ext4/004: limit the amount of data written so test runs faster
[xfstests-dev.git] / tests / ext4 / 004
1 #! /bin/bash
2 # FSQA Test No. 004
3 #
4 # Test "dump | restore"(as opposed to a tape)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2014 Fujitsu.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
33
34 _cleanup()
35 {
36         cd /
37         rm -f $tmp.*
38         # remove the generated data, which is much and meaningless.
39         rm -rf $restore_dir
40 }
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 dump_dir=$SCRATCH_MNT/dump_restore_dir
47 restore_dir=$TEST_DIR/dump_restore_dir
48
49 workout()
50 {
51         echo "Run fsstress" >> $seqres.full
52         args=`_scale_fsstress_args -z -f creat=5 -f write=20 -f mkdir=5 -n 100 -p 15 -d $dump_dir`
53         echo "fsstress $args" >> $seqres.full
54
55         $FSSTRESS_PROG $args >> $seqres.full 2>&1
56
57         echo "start Dump/Restore" >> $seqres.full
58         cd $TEST_DIR
59
60         $DUMP_PROG -0 -f - $dump_dir 2>/dev/null | $RESTORE_PROG -urvf - >> $seqres.full 2>&1
61         if [ $? -ne 0 ];then
62                 _fail "Dump/Restore failed"
63         fi
64
65         rm -rf restoresymtable
66 }
67
68 # real QA test starts here
69 _supported_fs ext4
70 _supported_os Linux
71
72 _require_test
73 _require_scratch
74
75 _require_command $DUMP_PROG
76 _require_command $RESTORE_PROG
77
78 rm -f $seqres.full
79 echo "Silence is golden"
80
81 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
82 _scratch_mount
83 rm -rf $restore_dir $TEST_DIR/restoresymtable
84
85 workout
86 diff -r $dump_dir $restore_dir
87
88 status=0
89 exit