1*6a54128fSAndroid Build Coastguard Worker#!/bin/bash 2*6a54128fSAndroid Build Coastguard Worker 3*6a54128fSAndroid Build Coastguard Workerif ! test -x $DEBUGFS_EXE; then 4*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: skipped (no debugfs)" 5*6a54128fSAndroid Build Coastguard Worker return 0 6*6a54128fSAndroid Build Coastguard Workerfi 7*6a54128fSAndroid Build Coastguard WorkerFSCK_OPT=-fy 8*6a54128fSAndroid Build Coastguard WorkerIMAGE=$test_dir/image.gz 9*6a54128fSAndroid Build Coastguard Worker 10*6a54128fSAndroid Build Coastguard Workergzip -d < $IMAGE > $TMPFILE 11*6a54128fSAndroid Build Coastguard Worker#e2label $TMPFILE test_filesys 12*6a54128fSAndroid Build Coastguard Worker 13*6a54128fSAndroid Build Coastguard Worker# Run fsck to fix things? 14*6a54128fSAndroid Build Coastguard WorkerEXP=$test_dir/expect 15*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log 16*6a54128fSAndroid Build Coastguard Worker 17*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 18*6a54128fSAndroid Build Coastguard Workerecho "Exit status is $?" >> $OUT.new 19*6a54128fSAndroid Build Coastguard Worker 20*6a54128fSAndroid Build Coastguard Workerecho "debugfs cat uninit file" >> $OUT.new 21*6a54128fSAndroid Build Coastguard Workerecho "ex /a" > $TMPFILE.cmd 22*6a54128fSAndroid Build Coastguard Workerecho "cat /a" >> $TMPFILE.cmd 23*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1 24*6a54128fSAndroid Build Coastguard Workerecho >> $OUT.new 25*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed < $OUT.new > $OUT 26*6a54128fSAndroid Build Coastguard Workerrm -f $OUT.new $TMPFILE $TMPFILE.cmd 27*6a54128fSAndroid Build Coastguard Worker 28*6a54128fSAndroid Build Coastguard Worker# Figure out what happened 29*6a54128fSAndroid Build Coastguard Workerif cmp -s $EXP $OUT; then 30*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 31*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 32*6a54128fSAndroid Build Coastguard Workerelse 33*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 34*6a54128fSAndroid Build Coastguard Worker diff -u $EXP $OUT >> $test_name.failed 35*6a54128fSAndroid Build Coastguard Workerfi 36*6a54128fSAndroid Build Coastguard Workerunset EXP OUT FSCK_OPT IMAGE 37