xref: /aosp_15_r20/external/e2fsprogs/tests/f_badcluster/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
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 WorkerIMAGE=$test_dir/../f_badcluster/image.gz
7*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log
8*6a54128fSAndroid Build Coastguard WorkerEXP=$test_dir/expect
9*6a54128fSAndroid Build Coastguard Workergzip -d < $IMAGE > $TMPFILE
10*6a54128fSAndroid Build Coastguard Worker$FSCK -fy $TMPFILE > $OUT.new 2>&1
11*6a54128fSAndroid Build Coastguard Worker$FSCK -fy $TMPFILE >> $OUT.new 2>&1
12*6a54128fSAndroid Build Coastguard Worker$FSCK -fy $TMPFILE >> $OUT.new 2>&1
13*6a54128fSAndroid Build Coastguard Workerfor i in a b c d e f g; do echo "stat /$i"; done > $TMPFILE.cmd
14*6a54128fSAndroid Build Coastguard Workerecho "quit" >> $TMPFILE.cmd
15*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
16*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed $OUT.new > $OUT
17*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE $TMPFILE.cmd $OUT.new
18*6a54128fSAndroid Build Coastguard Worker
19*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP
20*6a54128fSAndroid Build Coastguard Workerstatus=$?
21*6a54128fSAndroid Build Coastguard Worker
22*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ]; then
23*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
24*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
25*6a54128fSAndroid Build Coastguard Workerelse
26*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
27*6a54128fSAndroid Build Coastguard Worker	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
28*6a54128fSAndroid Build Coastguard Worker	rm -f $test_name.tmp
29*6a54128fSAndroid Build Coastguard Workerfi
30