1*6a54128fSAndroid Build Coastguard Workerif ! test -x $DEBUGFS_EXE; then 2*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: skipped (no debugfs)" 3*6a54128fSAndroid Build Coastguard Worker return 0 4*6a54128fSAndroid Build Coastguard Workerfi 5*6a54128fSAndroid Build Coastguard Worker 6*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log 7*6a54128fSAndroid Build Coastguard WorkerEXP=$test_dir/expect 8*6a54128fSAndroid Build Coastguard WorkerVERIFY_FSCK_OPT=-yf 9*6a54128fSAndroid Build Coastguard Worker 10*6a54128fSAndroid Build Coastguard WorkerTEST_DATA=$test_name.tmp 11*6a54128fSAndroid Build Coastguard WorkerVERIFY_DATA=$test_name.ver.tmp 12*6a54128fSAndroid Build Coastguard Worker 13*6a54128fSAndroid Build Coastguard Workerecho "debugfs load/dump test" > $OUT.new 14*6a54128fSAndroid Build Coastguard Worker 15*6a54128fSAndroid Build Coastguard Workerdd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 16*6a54128fSAndroid Build Coastguard Worker 17*6a54128fSAndroid Build Coastguard Workerecho "mke2fs -Fq -b 1024 test.img 512" >> $OUT.new 18*6a54128fSAndroid Build Coastguard Worker 19*6a54128fSAndroid Build Coastguard Worker$MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1 20*6a54128fSAndroid Build Coastguard Workerstatus=$? 21*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 22*6a54128fSAndroid Build Coastguard Worker 23*6a54128fSAndroid Build Coastguard Workerdd if=$TEST_BITS of=$TEST_DATA bs=128k count=1 conv=sync > /dev/null 2>&1 24*6a54128fSAndroid Build Coastguard Workerecho "file fragment odd size" >> $TEST_DATA 25*6a54128fSAndroid Build Coastguard Worker 26*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''write $TEST_DATA test_data'' -w test.img" >> $OUT.new 27*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "write $TEST_DATA test_data" -w $TMPFILE >> $OUT.new 2>&1 28*6a54128fSAndroid Build Coastguard Workerstatus=$? 29*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 30*6a54128fSAndroid Build Coastguard Worker 31*6a54128fSAndroid Build Coastguard Workerecho e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new 32*6a54128fSAndroid Build Coastguard Worker$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 33*6a54128fSAndroid Build Coastguard Workerstatus=$? 34*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 35*6a54128fSAndroid Build Coastguard Worker 36*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''dump test_data $VERIFY_DATA'' test.img" >> $OUT.new 37*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1 38*6a54128fSAndroid Build Coastguard Workerstatus=$? 39*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 40*6a54128fSAndroid Build Coastguard Worker 41*6a54128fSAndroid Build Coastguard Workerecho "cmp $TEST_DATA $VERIFY_DATA" >> $OUT.new 42*6a54128fSAndroid Build Coastguard Workercmp $TEST_DATA $VERIFY_DATA >>$OUT.new 43*6a54128fSAndroid Build Coastguard Workerstatus=$? 44*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 45*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed $OUT.new > $OUT 46*6a54128fSAndroid Build Coastguard Worker 47*6a54128fSAndroid Build Coastguard Worker# 48*6a54128fSAndroid Build Coastguard Worker# Do the verification 49*6a54128fSAndroid Build Coastguard Worker# 50*6a54128fSAndroid Build Coastguard Worker 51*6a54128fSAndroid Build Coastguard Workerif [ "$SKIP_UNLINK" != "true" ]; then 52*6a54128fSAndroid Build Coastguard Worker rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new 53*6a54128fSAndroid Build Coastguard Workerelse 54*6a54128fSAndroid Build Coastguard Worker echo "TMPFILE=$TMPFILE" 55*6a54128fSAndroid Build Coastguard Workerfi 56*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP 57*6a54128fSAndroid Build Coastguard Workerstatus=$? 58*6a54128fSAndroid Build Coastguard Worker 59*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then 60*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 61*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 62*6a54128fSAndroid Build Coastguard Workerelse 63*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 64*6a54128fSAndroid Build Coastguard Worker diff $DIFF_OPTS $EXP $OUT > $test_name.failed 65*6a54128fSAndroid Build Coastguard Workerfi 66*6a54128fSAndroid Build Coastguard Worker 67*6a54128fSAndroid Build Coastguard Workerunset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA 68