1*6a54128fSAndroid Build Coastguard Workertest_description="e2undo a failed command" 2*6a54128fSAndroid Build Coastguard Workerif test -x $RESIZE2FS_EXE -a -x $E2UNDO_EXE; then 3*6a54128fSAndroid Build Coastguard Worker 4*6a54128fSAndroid Build Coastguard WorkerTDB_FILE=${TMPDIR:-/tmp}/resize2fs-$(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 Workerecho check that we cant append a bad undo file > $OUT 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 Workercrc0=`$CRCSUM $TMPFILE` 12*6a54128fSAndroid Build Coastguard Workerecho $CRCSUM before mke2fs $crc0 >> $OUT 13*6a54128fSAndroid Build Coastguard Worker 14*6a54128fSAndroid Build Coastguard WorkerCONF=$TMPFILE.conf 15*6a54128fSAndroid Build Coastguard Workercat > $CONF << ENDL 16*6a54128fSAndroid Build Coastguard Worker[fs_types] 17*6a54128fSAndroid Build Coastguard Worker ext4h = { 18*6a54128fSAndroid Build Coastguard Worker features = ^has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode 19*6a54128fSAndroid Build Coastguard Worker blocksize = 4096 20*6a54128fSAndroid Build Coastguard Worker inode_size = 256 21*6a54128fSAndroid Build Coastguard Worker make_hugefiles = true 22*6a54128fSAndroid Build Coastguard Worker hugefiles_dir = / 23*6a54128fSAndroid Build Coastguard Worker hugefiles_slack = 0 24*6a54128fSAndroid Build Coastguard Worker hugefiles_name = aaaaa 25*6a54128fSAndroid Build Coastguard Worker hugefiles_digits = 4 26*6a54128fSAndroid Build Coastguard Worker hugefiles_size = 1K 27*6a54128fSAndroid Build Coastguard Worker zero_hugefiles = false 28*6a54128fSAndroid Build Coastguard Worker } 29*6a54128fSAndroid Build Coastguard WorkerENDL 30*6a54128fSAndroid Build Coastguard Worker 31*6a54128fSAndroid Build Coastguard Workerecho mke2fs -q -F -o Linux -T ext4h -O ^metadata_csum,^64bit -E lazy_itable_init=1 -b 1024 -z $TDB_FILE.0 $TMPFILE 524288 >> $OUT 32*6a54128fSAndroid Build Coastguard WorkerMKE2FS_CONFIG=$CONF $MKE2FS -q -F -o Linux -T ext4h -O ^metadata_csum,^64bit -E lazy_itable_init=1 -b 1024 -z $TDB_FILE.0 -d /etc/ $TMPFILE >> $OUT 2>&1 33*6a54128fSAndroid Build Coastguard Workercrc1=`$CRCSUM $TMPFILE` 34*6a54128fSAndroid Build Coastguard Workerecho $CRCSUM after mke2fs $crc1 >> $OUT 35*6a54128fSAndroid Build Coastguard Worker 36*6a54128fSAndroid Build Coastguard Workerecho roll back mke2fs >> $OUT 37*6a54128fSAndroid Build Coastguard Worker$E2UNDO $TDB_FILE.0 $TMPFILE >> $OUT 2>&1 38*6a54128fSAndroid Build Coastguard Workercrc2=`$CRCSUM $TMPFILE` 39*6a54128fSAndroid Build Coastguard Workerecho $CRCSUM after e2undo mke2fs $crc2 >> $OUT 40*6a54128fSAndroid Build Coastguard Worker 41*6a54128fSAndroid Build Coastguard Workerif [ $crc0 != $crc1 ] && [ $crc1 != $crc2 ] && [ $crc0 = $crc2 ]; then 42*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: ok" 43*6a54128fSAndroid Build Coastguard Worker touch $test_name.ok 44*6a54128fSAndroid Build Coastguard Workerelse 45*6a54128fSAndroid Build Coastguard Worker ln -f $test_name.log $test_name.failed 46*6a54128fSAndroid Build Coastguard Worker echo "$test_name: $test_description: failed" 47*6a54128fSAndroid Build Coastguard Workerfi 48*6a54128fSAndroid Build Coastguard Workerrm -f $TDB_FILE.0 $TMPFILE $CONF 49*6a54128fSAndroid Build Coastguard Workerfi 50