1 if ! test -x $DEBUGFS_EXE; then
2 echo "$test_name: $test_description: skipped (no debugfs)"
8 if [ -f $test_dir/expect.gz ]; then
10 gunzip < $test_dir/expect.gz > $EXP
17 cat > $TMPFILE.conf << ENDL
21 base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr,^has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,64bit
27 MKE2FS_CONFIG=$TMPFILE.conf $MKE2FS -F -o Linux -b 1024 -O bigalloc -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
30 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
32 echo Exit status is $status >> $OUT.new
33 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
36 echo "debugfs write files" >> $OUT
46 set_bmap $flag 10 $((start + 10))
47 set_bmap $flag 13 $((start + 13))
48 set_bmap $flag 26 $((start + 26))
49 set_bmap $flag 29 $((start + 29))
60 # a: fallocate a 40k file
61 # b*: falloc sparse file starting at b*
62 # c*: falloc spare file ending at c*
63 # d: midcluster to midcluster, surrounding sparse
64 # e: partial middle cluster alloc
66 # g*: falloc sparse init file starting at g*
67 # h*: falloc sparse init file ending at h*
68 # i: midcluster to midcluster, surrounding sparse init
69 # j: partial middle cluster alloc
70 # k: one big init file
72 cat > $TMPFILE.cmd << ENDL
77 echo "ex /a" >> $TMPFILE.cmd2
79 make_file sample $base --uninit >> $TMPFILE.cmd
80 echo "ex /sample" >> $TMPFILE.cmd2
83 for i in 8 9 10 11 12 13 14 15; do
84 make_file b$i $(($base + (40 * ($i - 8)))) --uninit >> $TMPFILE.cmd
85 echo "fallocate /b$i $i 39" >> $TMPFILE.cmd
86 echo "ex /b$i" >> $TMPFILE.cmd2
89 for i in 24 25 26 27 28 29 30 31; do
90 make_file c$i $(($base + 320 + (40 * ($i - 24)))) --uninit >> $TMPFILE.cmd
91 echo "fallocate /c$i 0 $i" >> $TMPFILE.cmd
92 echo "ex /c$i" >> $TMPFILE.cmd2
95 make_file d $(($base + 640)) --uninit >> $TMPFILE.cmd
96 echo "fallocate /d 4 35" >> $TMPFILE.cmd
97 echo "ex /d" >> $TMPFILE.cmd2
99 make_file e $(($base + 680)) --uninit >> $TMPFILE.cmd
100 echo "fallocate /e 19 20" >> $TMPFILE.cmd
101 echo "ex /e" >> $TMPFILE.cmd2
103 cat >> $TMPFILE.cmd << ENDL
107 set_bmap --uninit 0 9000
113 echo "ex /f" >> $TMPFILE.cmd2
115 # Now do it again, but with initialized blocks
117 for i in 8 9 10 11 12 13 14 15; do
118 make_file g$i $(($base + (40 * ($i - 8)))) >> $TMPFILE.cmd
119 echo "fallocate /g$i $i 39" >> $TMPFILE.cmd
120 echo "ex /g$i" >> $TMPFILE.cmd2
123 for i in 24 25 26 27 28 29 30 31; do
124 make_file h$i $(($base + 320 + (40 * ($i - 24)))) >> $TMPFILE.cmd
125 echo "fallocate /h$i 0 $i" >> $TMPFILE.cmd
126 echo "ex /h$i" >> $TMPFILE.cmd2
129 make_file i $(($base + 640)) >> $TMPFILE.cmd
130 echo "fallocate /i 4 35" >> $TMPFILE.cmd
131 echo "ex /i" >> $TMPFILE.cmd2
133 make_file j $(($base + 680)) >> $TMPFILE.cmd
134 echo "fallocate /j 19 20" >> $TMPFILE.cmd
135 echo "ex /j" >> $TMPFILE.cmd2
137 cat >> $TMPFILE.cmd << ENDL
148 echo "ex /k" >> $TMPFILE.cmd2
150 $DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1
151 $DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1
152 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
153 rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2
155 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
157 echo Exit status is $status >> $OUT.new
158 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
166 if [ "$status" = 0 ] ; then
167 echo "$test_name: $test_description: ok"
170 echo "$test_name: $test_description: failed"
171 diff $DIFF_OPTS $EXP $OUT > $test_name.failed
175 unset IMAGE FSCK_OPT OUT EXP