Home | History | Annotate | Download | only in d_special_files
      1 if test -x $DEBUGFS_EXE; then
      2 
      3 OUT=$test_name.log
      4 EXP=$test_dir/expect
      5 VERIFY_FSCK_OPT=-yf
      6 
      7 TEST_DATA=$test_name.tmp
      8 VERIFY_DATA=$test_name.ver.tmp
      9 
     10 echo "debugfs create special files" > $OUT
     11 
     12 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
     13 
     14 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT
     15 
     16 $MKE2FS -Fq $TMPFILE 512 > /dev/null 2>&1
     17 status=$?
     18 echo Exit status is $status >> $OUT
     19 
     20 $DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
     21 set_current_time 201301151400
     22 set_super_value lastcheck 0
     23 set_super_value hash_seed null
     24 set_super_value mkfs_time 0
     25 symlink foo bar
     26 symlink foo2 12345678901234567890123456789012345678901234567890123456789012345678901234567890
     27 mknod pipe p
     28 mknod sda b 8 0
     29 mknod null c 1 3
     30 EOF
     31 
     32 echo "debugfs -R ''stat foo'' -w test.img" > $OUT.new
     33 $DEBUGFS -R "stat foo" -w $TMPFILE >> $OUT.new 2>&1
     34 status=$?
     35 echo Exit status is $status >> $OUT.new
     36 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     37 
     38 echo "debugfs -R ''stat foo2'' -w test.img" > $OUT.new
     39 $DEBUGFS -R "stat foo2" -w $TMPFILE >> $OUT.new 2>&1
     40 status=$?
     41 echo Exit status is $status >> $OUT.new
     42 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     43 
     44 echo "debugfs -R ''block_dump 28'' -w test.img" > $OUT.new
     45 $DEBUGFS -R "block_dump 28" -w $TMPFILE >> $OUT.new 2>&1
     46 status=$?
     47 echo Exit status is $status >> $OUT.new
     48 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     49 
     50 echo "debugfs -R ''stat pipe'' -w test.img" > $OUT.new
     51 $DEBUGFS -R "stat pipe" -w $TMPFILE >> $OUT.new 2>&1
     52 status=$?
     53 echo Exit status is $status >> $OUT.new
     54 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     55 
     56 echo "debugfs -R ''stat sda'' -w test.img" > $OUT.new
     57 $DEBUGFS -R "stat sda" -w $TMPFILE >> $OUT.new 2>&1
     58 status=$?
     59 echo Exit status is $status >> $OUT.new
     60 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     61 
     62 echo "debugfs -R ''stat null'' -w test.img" > $OUT.new
     63 $DEBUGFS -R "stat null" -w $TMPFILE >> $OUT.new 2>&1
     64 status=$?
     65 echo Exit status is $status >> $OUT.new
     66 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     67 
     68 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
     69 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
     70 status=$?
     71 echo Exit status is $status >> $OUT.new
     72 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     73 
     74 #
     75 # Do the verification
     76 #
     77 
     78 rm -f $TMPFILE $OUT.new
     79 cmp -s $OUT $EXP
     80 status=$?
     81 
     82 if [ "$status" = 0 ] ; then
     83 	echo "$test_name: $test_description: ok"
     84 	touch $test_name.ok
     85 else
     86 	echo "$test_name: $test_description: failed"
     87 	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
     88 fi
     89 
     90 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
     91 
     92 else #if test -x $DEBUGFS_EXE; then
     93 	echo "$test_name: $test_description: skipped"
     94 fi 
     95