Home | History | Annotate | Download | only in u_errorout
      1 test_description="e2undo a failed command"
      2 if test -x $RESIZE2FS_EXE -a -x $E2UNDO_EXE; then
      3 
      4 TDB_FILE=${TMPDIR:-/tmp}/resize2fs-$(basename $TMPFILE).e2undo
      5 OUT=$test_name.log
      6 rm -f $TDB_FILE >/dev/null 2>&1
      7 
      8 echo check that we cant append a bad undo file > $OUT
      9 
     10 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
     11 crc0=`$CRCSUM $TMPFILE`
     12 echo $CRCSUM before mke2fs $crc0 >> $OUT
     13 
     14 CONF=$TMPFILE.conf
     15 cat > $CONF << ENDL
     16 [fs_types]
     17 	ext4h = {
     18 		features = ^has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode
     19 		blocksize = 4096
     20 		inode_size = 256
     21 		make_hugefiles = true
     22 		hugefiles_dir = /
     23 		hugefiles_slack = 0
     24 		hugefiles_name = aaaaa
     25 		hugefiles_digits = 4
     26 		hugefiles_size = 1K
     27 		zero_hugefiles = false
     28 	}
     29 ENDL
     30 
     31 echo 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 MKE2FS_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 crc1=`$CRCSUM $TMPFILE`
     34 echo $CRCSUM after mke2fs $crc1 >> $OUT
     35 
     36 echo roll back mke2fs >> $OUT
     37 $E2UNDO $TDB_FILE.0 $TMPFILE  >> $OUT 2>&1
     38 crc2=`$CRCSUM $TMPFILE`
     39 echo $CRCSUM after e2undo mke2fs $crc2 >> $OUT
     40 
     41 if [ $crc0 != $crc1 ] && [ $crc1 != $crc2 ] && [ $crc0 = $crc2 ]; then
     42 	echo "$test_name: $test_description: ok"
     43 	touch $test_name.ok
     44 else
     45 	ln -f $test_name.log $test_name.failed
     46 	echo "$test_name: $test_description: failed"
     47 fi
     48 rm -f $TDB_FILE.0 $TMPFILE $CONF
     49 fi
     50