| 1 |
if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then |
| 2 |
echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" |
| 3 |
return 0 |
| 4 |
fi |
| 5 |
|
| 6 |
OUT=$test_name.log |
| 7 |
if [ -f $test_dir/expect.gz ]; then |
| 8 |
EXP=$test_name.tmp |
| 9 |
gunzip < $test_dir/expect.gz > $EXP1 |
| 10 |
else |
| 11 |
EXP=$test_dir/expect |
| 12 |
fi |
| 13 |
|
| 14 |
echo mke2fs -q -F -t ext4 -o Linux -b 1024 test.img 32M > $OUT.new |
| 15 |
$MKE2FS -q -F -t ext4 -o Linux -b 1024 $TMPFILE 32M >> $OUT.new 2>&1 |
| 16 |
|
| 17 |
echo debugfs -w -R \"set_bg 1 free_blocks_count 65536\" /tmp/foo.img >> $OUT.new |
| 18 |
$DEBUGFS -w -R "set_bg 1 free_blocks_count 65536" $TMPFILE > /dev/null 2>&1 |
| 19 |
|
| 20 |
if timeout -v 1s true > /dev/null 2>&1 ; then |
| 21 |
TIMEOUT="timeout -v 30s" |
| 22 |
else |
| 23 |
TIMEOUT= |
| 24 |
fi |
| 25 |
|
| 26 |
echo resize2fs -P /tmp/foo.img >> $OUT.new |
| 27 |
$TIMEOUT $RESIZE2FS -P $TMPFILE >> $OUT.new 2>&1 |
| 28 |
|
| 29 |
sed -f $cmd_dir/filter.sed < $OUT.new > $OUT |
| 30 |
|
| 31 |
rm -f $TMPFILE $OUT.new |
| 32 |
|
| 33 |
cmp -s $OUT $EXP |
| 34 |
status=$? |
| 35 |
|
| 36 |
if [ "$status" = 0 ] ; then |
| 37 |
echo "$test_name: $test_description: ok" |
| 38 |
touch $test_name.ok |
| 39 |
else |
| 40 |
echo "$test_name: $test_description: failed" |
| 41 |
diff $DIFF_OPTS $EXP $OUT > $test_name.failed |
| 42 |
rm -f $test_name.tmp |
| 43 |
fi |
| 44 |
|
| 45 |
unset IMAGE OUT EXP TIMEOUT |