xref: /aosp_15_r20/external/e2fsprogs/tests/i_bad_csum/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Workertest_description="e2image corrupt fs"
2*6a54128fSAndroid Build Coastguard Worker
3*6a54128fSAndroid Build Coastguard WorkerIMAGE=$test_dir/image.gz
4*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log
5*6a54128fSAndroid Build Coastguard WorkerEXP=$test_dir/expect
6*6a54128fSAndroid Build Coastguard Worker
7*6a54128fSAndroid Build Coastguard Workergzip -d < $IMAGE > $TMPFILE
8*6a54128fSAndroid Build Coastguard Worker$E2IMAGE -r $TMPFILE $TMPFILE.bin > $OUT 2>&1
9*6a54128fSAndroid Build Coastguard Worker$FSCK -fn $TMPFILE.bin >> $OUT 2>&1
10*6a54128fSAndroid Build Coastguard Worker
11*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test_filesys;" $OUT > $OUT.new
12*6a54128fSAndroid Build Coastguard Workermv $OUT.new $OUT
13*6a54128fSAndroid Build Coastguard Worker
14*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP
15*6a54128fSAndroid Build Coastguard Workerstatus=$?
16*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then
17*6a54128fSAndroid Build Coastguard Worker        echo "$test_name: $test_description: ok"
18*6a54128fSAndroid Build Coastguard Worker        touch $test_name.ok
19*6a54128fSAndroid Build Coastguard Workerelse
20*6a54128fSAndroid Build Coastguard Worker        echo "$test_name: $test_description: failed"
21*6a54128fSAndroid Build Coastguard Worker        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
22*6a54128fSAndroid Build Coastguard Worker        rm -f $test_name.tmp
23*6a54128fSAndroid Build Coastguard Workerfi
24*6a54128fSAndroid Build Coastguard Worker
25*6a54128fSAndroid Build Coastguard Workerrm -f $OUT $TMPFILE $TMPFILE.bin $TMPFILE.test
26*6a54128fSAndroid Build Coastguard Workerunset IMAGE FSCK_OPT OUT EXP
27