]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - tests/j_short_trans/script
tests: clean up $DEBUGFS_EXE usage in scripts
[thirdparty/e2fsprogs.git] / tests / j_short_trans / script
CommitLineData
3819bff4
AD
1if ! test -x $DEBUGFS_EXE; then
2 echo "$test_name: $test_description: skipped (no debugfs)"
3 return 0
4fi
9ce517d4
DW
5
6FSCK_OPT=-fy
7OUT=$test_name.log
8if [ -f $test_dir/expect.gz ]; then
9 EXP=$test_name.tmp
10 gunzip < $test_dir/expect.gz > $EXP1
11else
12 EXP=$test_dir/expect
13fi
14
15cp /dev/null $OUT
16
17$MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
18
19$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
20status=$?
21echo Exit status is $status >> $OUT.new
22sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
23rm -f $OUT.new
24
6aa8cff3 25bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')"
9ce517d4
DW
26
27echo "debugfs write journal" >> $OUT
28echo "jo" > $TMPFILE.cmd
29echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd
30echo "jc" >> $TMPFILE.cmd
3819bff4 31$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
9ce517d4
DW
32sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
33rm -rf $OUT.new
34
35test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
36echo "logdump -c" > $TMPFILE.cmd
3819bff4 37$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
9ce517d4
DW
38rm -rf $TMPFILE.cmd
39
40$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
41status=$?
42echo Exit status is $status >> $OUT.new
43sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
44rm -f $OUT.new
45
46rm -f $TMPFILE
47
48cmp -s $OUT $EXP
49status=$?
50
51if [ "$status" = 0 ] ; then
52 echo "$test_name: $test_description: ok"
53 touch $test_name.ok
54else
55 echo "$test_name: $test_description: failed"
56 diff $DIFF_OPTS $EXP $OUT > $test_name.failed
57 rm -f $test_name.tmp
58fi
59
60unset IMAGE FSCK_OPT OUT EXP