1*6a54128fSAndroid Build Coastguard Worker#!/bin/bash 2*6a54128fSAndroid Build Coastguard Worker 3*6a54128fSAndroid Build Coastguard WorkerFSCK_OPT=-fn 4*6a54128fSAndroid Build Coastguard WorkerIMAGE=$test_dir/image.bz2 5*6a54128fSAndroid Build Coastguard Worker 6*6a54128fSAndroid Build Coastguard Workerbzip2 -d < $IMAGE > $TMPFILE 7*6a54128fSAndroid Build Coastguard Worker 8*6a54128fSAndroid Build Coastguard Worker# Run fsck to fix things? 9*6a54128fSAndroid Build Coastguard Workerif [ -x $DEBUGFS_EXE ]; then 10*6a54128fSAndroid Build Coastguard Worker EXP=$test_dir/expect 11*6a54128fSAndroid Build Coastguard Workerelse 12*6a54128fSAndroid Build Coastguard Worker EXP=$test_dir/expect.nodebugfs 13*6a54128fSAndroid Build Coastguard Workerfi 14*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log 15*6a54128fSAndroid Build Coastguard Workerrm -f $test_name.failed $test_name.ok 16*6a54128fSAndroid Build Coastguard Worker 17*6a54128fSAndroid Build Coastguard Workerecho "*** e2fsck" > $OUT 18*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1 19*6a54128fSAndroid Build Coastguard Workerecho "*** debugfs" >> $OUT 20*6a54128fSAndroid Build Coastguard Workertest -x $DEBUGFS_EXE && $DEBUGFS -R 'quit' $TMPFILE >> $OUT 2>&1 21*6a54128fSAndroid Build Coastguard Workerecho "*** tune2fs" >> $OUT 22*6a54128fSAndroid Build Coastguard Worker$TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1 23*6a54128fSAndroid Build Coastguard Workerecho "*** mke2fs" >> $OUT 24*6a54128fSAndroid Build Coastguard Worker$MKE2FS -n -b 1024 $TMPFILE >> $OUT 2>&1 25*6a54128fSAndroid Build Coastguard Worker 26*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed < $OUT > $OUT.new 27*6a54128fSAndroid Build Coastguard Workermv $OUT.new $OUT 28*6a54128fSAndroid Build Coastguard Worker 29*6a54128fSAndroid Build Coastguard Worker# Figure out what happened 30*6a54128fSAndroid Build Coastguard Workerif cmp -s $EXP $OUT; then 31*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 32*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 33*6a54128fSAndroid Build Coastguard Workerelse 34*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 35*6a54128fSAndroid Build Coastguard Worker diff -u $EXP $OUT >> $test_name.failed 36*6a54128fSAndroid Build Coastguard Workerfi 37*6a54128fSAndroid Build Coastguard Workerunset EXP OUT FSCK_OPT IMAGE 38