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