script revision d2bfdc7ff15ce7b6b40c087021528ce190ef43c3
1if test -x $DEBUGFS_EXE; then 2 3printf "e2fsck with resize_inode: " 4FSCK_OPT=-yf 5OUT=$test_name.log 6if [ -f $test_dir/expect.gz ]; then 7 EXP=tmp_expect 8 gunzip < $test_dir/expect.gz > $EXP1 9else 10 EXP=$test_dir/expect 11fi 12 13cp /dev/null $OUT 14 15dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 16 17echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT 18$MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 \ 19 | sed -e '1d' | grep -v "automatically checked" | 20 grep -v 'Discarding device blocks' | 21 grep -v "whichever comes first" >> $OUT 22 23$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 24status=$? 25echo Exit status is $status >> $OUT.new 26sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 27rm -f $OUT.new 28 29echo ----------------------------------------------- >> $OUT 30 31echo " " >> $OUT 32echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img" > $OUT.new 33$DEBUGFS -R "set_inode_field <7> block[2] 42" -w $TMPFILE >> $OUT.new 2>&1 34status=$? 35echo Exit status is $status >> $OUT.new 36sed -e '2d' $OUT.new >> $OUT 37 38$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 39status=$? 40echo Exit status is $status >> $OUT.new 41sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 42rm -f $OUT.new 43 44$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 45status=$? 46echo Exit status is $status >> $OUT.new 47sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 48rm -f $OUT.new 49 50echo ----------------------------------------------- >> $OUT 51 52echo " " >> $OUT 53echo "debugfs -R ''clri <7>'' -w test.img" > $OUT.new 54$DEBUGFS -R "clri <7>" -w $TMPFILE >> $OUT.new 2>&1 55status=$? 56echo Exit status is $status >> $OUT.new 57sed -e '2d' $OUT.new >> $OUT 58 59$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 60status=$? 61echo Exit status is $status >> $OUT.new 62sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 63rm -f $OUT.new 64 65$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 66status=$? 67echo Exit status is $status >> $OUT.new 68sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 69rm -f $OUT.new 70 71echo ----------------------------------------------- >> $OUT 72 73echo " " >> $OUT 74echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img" > $OUT.new 75$DEBUGFS -R "set_inode_field <7> bmap[524] 57" -w $TMPFILE >> $OUT.new 2>&1 76status=$? 77echo Exit status is $status >> $OUT.new 78sed -e '2d' $OUT.new >> $OUT 79 80$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 81status=$? 82echo Exit status is $status >> $OUT.new 83sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 84rm -f $OUT.new 85 86$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 87status=$? 88echo Exit status is $status >> $OUT.new 89sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 90rm -f $OUT.new 91 92echo ----------------------------------------------- >> $OUT 93 94echo " " >> $OUT 95echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img" > $OUT.new 96$DEBUGFS -R "set_super_value reserved_gdt_blocks 15679" -w $TMPFILE >> $OUT.new 2>&1 97status=$? 98echo Exit status is $status >> $OUT.new 99sed -e '2d' $OUT.new >> $OUT 100 101$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 102status=$? 103echo Exit status is $status >> $OUT.new 104sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 105rm -f $OUT.new 106 107echo ----------------------------------------------- >> $OUT 108 109echo " " >> $OUT 110echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img" > $OUT.new 111$DEBUGFS -R "set_super_value reserved_gdt_blocks 32" -w $TMPFILE >> $OUT.new 2>&1 112status=$? 113echo Exit status is $status >> $OUT.new 114sed -e '2d' $OUT.new >> $OUT 115 116$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 117status=$? 118echo Exit status is $status >> $OUT.new 119sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 120rm -f $OUT.new 121 122$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 123status=$? 124echo Exit status is $status >> $OUT.new 125sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT 126rm -f $OUT.new 127 128 129rm -f $test_name.ok $test_name.failed 130cmp -s $OUT $EXP 131status=$? 132 133if [ "$status" = 0 ] ; then 134 echo "ok" 135 touch $test_name.ok 136else 137 echo "failed" 138 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 139 rm -f tmp_expect 140fi 141 142unset IMAGE FSCK_OPT OUT EXP 143 144else #if test -x $DEBUGFS_EXE; then 145 rm -f $test_name.ok $test_name.failed 146 echo "skipped" 147fi 148