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