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 WorkerFSCK_OPT=-fy 7*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log 8*6a54128fSAndroid Build Coastguard Workerif [ -f $test_dir/expect.gz ]; then 9*6a54128fSAndroid Build Coastguard Worker EXP=$test_name.tmp 10*6a54128fSAndroid Build Coastguard Worker gunzip < $test_dir/expect.gz > $EXP1 11*6a54128fSAndroid Build Coastguard Workerelse 12*6a54128fSAndroid Build Coastguard Worker EXP=$test_dir/expect 13*6a54128fSAndroid Build Coastguard Workerfi 14*6a54128fSAndroid Build Coastguard Worker 15*6a54128fSAndroid Build Coastguard Workercat > $TMPFILE.conf << ENDL 16*6a54128fSAndroid Build Coastguard Worker[fs_types] 17*6a54128fSAndroid Build Coastguard Workerext4 = { 18*6a54128fSAndroid Build Coastguard Worker base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr,^has_journal,^extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^64bit 19*6a54128fSAndroid Build Coastguard Worker blocksize = 1024 20*6a54128fSAndroid Build Coastguard Worker inode_size = 256 21*6a54128fSAndroid Build Coastguard Worker inode_ratio = 16384 22*6a54128fSAndroid Build Coastguard Worker} 23*6a54128fSAndroid Build Coastguard WorkerENDL 24*6a54128fSAndroid Build Coastguard WorkerMKE2FS_CONFIG=$TMPFILE.conf $MKE2FS -F -o Linux -b 1024 -O ^bigalloc -T ext4 $TMPFILE 65536 > $OUT.new 2>&1 25*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE.conf 26*6a54128fSAndroid Build Coastguard Worker 27*6a54128fSAndroid Build Coastguard Worker$FSCK -fy -N test_filesys $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 "debugfs write files" >> $OUT.new 32*6a54128fSAndroid Build Coastguard Worker#Files we create: 33*6a54128fSAndroid Build Coastguard Worker# a: fallocate a 40k file 34*6a54128fSAndroid Build Coastguard Worker# k: one big file 35*6a54128fSAndroid Build Coastguard Workerbase=5000 36*6a54128fSAndroid Build Coastguard Workercat > $TMPFILE.cmd << ENDL 37*6a54128fSAndroid Build Coastguard Workerwrite /dev/null a 38*6a54128fSAndroid Build Coastguard Workersif /a bmap[2] 8000 39*6a54128fSAndroid Build Coastguard Workersif /a size 40960 40*6a54128fSAndroid Build Coastguard Workersif /a i_blocks 2 41*6a54128fSAndroid Build Coastguard Workersetb 8000 42*6a54128fSAndroid Build Coastguard Workerfallocate /a 0 39 43*6a54128fSAndroid Build Coastguard Worker 44*6a54128fSAndroid Build Coastguard Workerwrite /dev/null b 45*6a54128fSAndroid Build Coastguard Workersif /b size 10240000 46*6a54128fSAndroid Build Coastguard Workersif /b bmap[0] 10000 47*6a54128fSAndroid Build Coastguard Workersif /b i_blocks 2 48*6a54128fSAndroid Build Coastguard Workersetb 10000 49*6a54128fSAndroid Build Coastguard Workerfallocate /b 0 9999 50*6a54128fSAndroid Build Coastguard WorkerENDL 51*6a54128fSAndroid Build Coastguard Workerecho "stat /a" >> $TMPFILE.cmd2 52*6a54128fSAndroid Build Coastguard Workerecho "stat /b" >> $TMPFILE.cmd2 53*6a54128fSAndroid Build Coastguard Worker 54*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 55*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 56*6a54128fSAndroid Build Coastguard Worker 57*6a54128fSAndroid Build Coastguard Worker$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1 58*6a54128fSAndroid Build Coastguard Workerstatus=$? 59*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new 60*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed -e '/^.*time:.*$/d' $OUT.new > $OUT 61*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE $TMPFILE.cmd $TMPFILE.cmd2 $OUT.new 62*6a54128fSAndroid Build Coastguard Worker 63*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP 64*6a54128fSAndroid Build Coastguard Workerstatus=$? 65*6a54128fSAndroid Build Coastguard Worker 66*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then 67*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 68*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 69*6a54128fSAndroid Build Coastguard Workerelse 70*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 71*6a54128fSAndroid Build Coastguard Worker diff $DIFF_OPTS $EXP $OUT > $test_name.failed 72*6a54128fSAndroid Build Coastguard Worker rm -f $test_name.tmp 73*6a54128fSAndroid Build Coastguard Workerfi 74*6a54128fSAndroid Build Coastguard Worker 75*6a54128fSAndroid Build Coastguard Workerunset IMAGE FSCK_OPT OUT EXP 76