xref: /aosp_15_r20/external/e2fsprogs/tests/u_mke2fs_opt/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Workertest_description="e2undo with mke2fs -z"
2*6a54128fSAndroid Build Coastguard Workerif test -x $E2UNDO_EXE; then
3*6a54128fSAndroid Build Coastguard Worker
4*6a54128fSAndroid Build Coastguard WorkerTDB_FILE=${TMPDIR:-/tmp}/mke2fs-$(basename $TMPFILE).e2undo
5*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log
6*6a54128fSAndroid Build Coastguard Workerrm -f $TDB_FILE >/dev/null 2>&1
7*6a54128fSAndroid Build Coastguard Worker
8*6a54128fSAndroid Build Coastguard Workerdd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
9*6a54128fSAndroid Build Coastguard Worker
10*6a54128fSAndroid Build Coastguard Workerecho mke2fs -F -o Linux -I 128 -b 1024 test.img  > $OUT
11*6a54128fSAndroid Build Coastguard Worker$MKE2FS -F -o Linux -I 128 -b 1024 $TMPFILE  >> $OUT 2>&1
12*6a54128fSAndroid Build Coastguard Workercrc0=`$CRCSUM $TMPFILE`
13*6a54128fSAndroid Build Coastguard Workerecho $CRCSUM before mke2fs $crc0 >> $OUT
14*6a54128fSAndroid Build Coastguard Worker
15*6a54128fSAndroid Build Coastguard Workerecho using mke2fs to test e2undo >> $OUT
16*6a54128fSAndroid Build Coastguard Worker$MKE2FS -q -F -o Linux -T ext4 -E lazy_itable_init=1 -b 1024 -z $TDB_FILE $TMPFILE  >> $OUT 2>&1
17*6a54128fSAndroid Build Coastguard Workercrc1=`$CRCSUM $TMPFILE`
18*6a54128fSAndroid Build Coastguard Workerecho $CRCSUM after mke2fs $crc1 >> $OUT
19*6a54128fSAndroid Build Coastguard Worker
20*6a54128fSAndroid Build Coastguard Worker$E2UNDO  $TDB_FILE $TMPFILE  >> $OUT 2>&1
21*6a54128fSAndroid Build Coastguard Workercrc2=`$CRCSUM $TMPFILE`
22*6a54128fSAndroid Build Coastguard Workerecho $CRCSUM after e2undo $crc2 >> $OUT
23*6a54128fSAndroid Build Coastguard Worker
24*6a54128fSAndroid Build Coastguard Workerif [ $crc0 = $crc2 ] && [ $crc1 != $crc2 ]; then
25*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
26*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
27*6a54128fSAndroid Build Coastguard Workerelse
28*6a54128fSAndroid Build Coastguard Worker	ln -f $test_name.log $test_name.failed
29*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
30*6a54128fSAndroid Build Coastguard Workerfi
31*6a54128fSAndroid Build Coastguard Workerrm -f $TDB_FILE $TMPFILE
32*6a54128fSAndroid Build Coastguard Workerfi
33