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 create special files" > $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 -o linux $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 Worker$DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1 24*6a54128fSAndroid Build Coastguard Workerset_current_time 20130115140000 25*6a54128fSAndroid Build Coastguard Workerset_super_value lastcheck 0 26*6a54128fSAndroid Build Coastguard Workerset_super_value hash_seed null 27*6a54128fSAndroid Build Coastguard Workerset_super_value mkfs_time 0 28*6a54128fSAndroid Build Coastguard Workersymlink foo bar 29*6a54128fSAndroid Build Coastguard Workersymlink foo2 12345678901234567890123456789012345678901234567890123456789012345678901234567890 30*6a54128fSAndroid Build Coastguard Workermknod pipe p 31*6a54128fSAndroid Build Coastguard Workermknod sda b 8 0 32*6a54128fSAndroid Build Coastguard Workermknod null c 1 3 33*6a54128fSAndroid Build Coastguard WorkerEOF 34*6a54128fSAndroid Build Coastguard Worker 35*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''stat foo'' -w test.img" >> $OUT.new 36*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "stat foo" -w $TMPFILE >> $OUT.new 2>&1 37*6a54128fSAndroid Build Coastguard Workerstatus=$? 38*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 39*6a54128fSAndroid Build Coastguard Worker 40*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''stat foo2'' -w test.img" >> $OUT.new 41*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "stat foo2" -w $TMPFILE >> $OUT.new 2>&1 42*6a54128fSAndroid Build Coastguard Workerstatus=$? 43*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 44*6a54128fSAndroid Build Coastguard Worker 45*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''block_dump 28'' -w test.img" >> $OUT.new 46*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "block_dump 28" -w $TMPFILE >> $OUT.new 2>&1 47*6a54128fSAndroid Build Coastguard Workerstatus=$? 48*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 49*6a54128fSAndroid Build Coastguard Worker 50*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''stat pipe'' -w test.img" >> $OUT.new 51*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "stat pipe" -w $TMPFILE >> $OUT.new 2>&1 52*6a54128fSAndroid Build Coastguard Workerstatus=$? 53*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 54*6a54128fSAndroid Build Coastguard Worker 55*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''stat sda'' -w test.img" >> $OUT.new 56*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "stat sda" -w $TMPFILE >> $OUT.new 2>&1 57*6a54128fSAndroid Build Coastguard Workerstatus=$? 58*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 59*6a54128fSAndroid Build Coastguard Worker 60*6a54128fSAndroid Build Coastguard Workerecho "debugfs -R ''stat null'' -w test.img" >> $OUT.new 61*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R "stat null" -w $TMPFILE >> $OUT.new 2>&1 62*6a54128fSAndroid Build Coastguard Workerstatus=$? 63*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 64*6a54128fSAndroid Build Coastguard Worker 65*6a54128fSAndroid Build Coastguard Workerecho e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new 66*6a54128fSAndroid Build Coastguard Worker$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 67*6a54128fSAndroid Build Coastguard Workerstatus=$? 68*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 69*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed $OUT.new > $OUT 70*6a54128fSAndroid Build Coastguard Worker 71*6a54128fSAndroid Build Coastguard Worker# 72*6a54128fSAndroid Build Coastguard Worker# Do the verification 73*6a54128fSAndroid Build Coastguard Worker# 74*6a54128fSAndroid Build Coastguard Worker 75*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE $OUT.new 76*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP 77*6a54128fSAndroid Build Coastguard Workerstatus=$? 78*6a54128fSAndroid Build Coastguard Worker 79*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then 80*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 81*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 82*6a54128fSAndroid Build Coastguard Workerelse 83*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 84*6a54128fSAndroid Build Coastguard Worker diff $DIFF_OPTS $EXP $OUT > $test_name.failed 85*6a54128fSAndroid Build Coastguard Workerfi 86*6a54128fSAndroid Build Coastguard Worker 87*6a54128fSAndroid Build Coastguard Workerunset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA 88