Whamcloud - gitweb
libext2fs: file IO routines should handle uninit blocks
[tools/e2fsprogs.git] / tests / f_uninit_cat / script
1 #!/bin/bash
2
3 if test -x $DEBUGFS_EXE; then
4 FSCK_OPT=-fy
5 IMAGE=$test_dir/image.gz
6
7 gzip -d < $IMAGE > $TMPFILE
8 #e2label $TMPFILE test_filesys
9
10 # Run fsck to fix things?
11 EXP=$test_dir/expect
12 OUT=$test_name.log
13 rm -rf $test_name.failed $test_name.ok
14
15 $FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT
16 echo "Exit status is $?" >> $OUT
17
18 echo "debugfs cat uninit file" >> $OUT
19 echo "ex /a" > $TMPFILE.cmd
20 echo "cat /a" >> $TMPFILE.cmd
21 $DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
22 echo >> $OUT.new
23 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
24 rm -rf $OUT.new $TMPFILE
25
26 # Figure out what happened
27 if cmp -s $EXP $OUT; then
28         echo "$test_name: $test_description: ok"
29         touch $test_name.ok
30 else
31         echo "$test_name: $test_description: failed"
32         diff -u $EXP $OUT >> $test_name.failed
33 fi
34 unset EXP OUT FSCK_OPT IMAGE
35 else #if test -a -x $DEBUGFS_EXE; then
36         echo "$test_name: $test_description: skipped"
37 fi