1*6a54128fSAndroid Build Coastguard Worker#!/bin/bash 2*6a54128fSAndroid Build Coastguard Worker 3*6a54128fSAndroid Build Coastguard WorkerFSCK_OPT=-fy 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#e2label $TMPFILE test_filesys 8*6a54128fSAndroid Build Coastguard Worker 9*6a54128fSAndroid Build Coastguard Worker# Run fsck to fix things? 10*6a54128fSAndroid Build Coastguard WorkerEXP1=$test_dir/expect.1 11*6a54128fSAndroid Build Coastguard WorkerOUT1=$test_name.1.log 12*6a54128fSAndroid Build Coastguard Worker 13*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT1 14*6a54128fSAndroid Build Coastguard Workerecho "Exit status is $?" >> $OUT1 15*6a54128fSAndroid Build Coastguard Worker 16*6a54128fSAndroid Build Coastguard Worker# Run a second time 17*6a54128fSAndroid Build Coastguard WorkerEXP2=$test_dir/expect.2 18*6a54128fSAndroid Build Coastguard WorkerOUT2=$test_name.2.log 19*6a54128fSAndroid Build Coastguard Worker 20*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT2 21*6a54128fSAndroid Build Coastguard Workerecho "Exit status is $?" >> $OUT2 22*6a54128fSAndroid Build Coastguard Worker 23*6a54128fSAndroid Build Coastguard Worker# Figure out what happened 24*6a54128fSAndroid Build Coastguard Workerif cmp -s $EXP1 $OUT1 && cmp -s $EXP2 $OUT2; then 25*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 26*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 27*6a54128fSAndroid Build Coastguard Workerelse 28*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 29*6a54128fSAndroid Build Coastguard Worker diff -u $EXP1 $OUT1 >> $test_name.failed 30*6a54128fSAndroid Build Coastguard Worker diff -u $EXP2 $OUT2 >> $test_name.failed 31*6a54128fSAndroid Build Coastguard Workerfi 32