• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test_description="e2undo a failed command"
2if test -x $RESIZE2FS_EXE -a -x $E2UNDO_EXE; then
3
4TDB_FILE=${TMPDIR:-/tmp}/resize2fs-$(basename $TMPFILE).e2undo
5OUT=$test_name.log
6rm -f $TDB_FILE >/dev/null 2>&1
7
8echo check that we cant append a bad undo file > $OUT
9
10dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
11crc0=`$CRCSUM $TMPFILE`
12echo $CRCSUM before mke2fs $crc0 >> $OUT
13
14CONF=$TMPFILE.conf
15cat > $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	}
29ENDL
30
31echo 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
32MKE2FS_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
33crc1=`$CRCSUM $TMPFILE`
34echo $CRCSUM after mke2fs $crc1 >> $OUT
35
36echo roll back mke2fs >> $OUT
37$E2UNDO $TDB_FILE.0 $TMPFILE  >> $OUT 2>&1
38crc2=`$CRCSUM $TMPFILE`
39echo $CRCSUM after e2undo mke2fs $crc2 >> $OUT
40
41if [ $crc0 != $crc1 ] && [ $crc1 != $crc2 ] && [ $crc0 = $crc2 ]; then
42	echo "$test_name: $test_description: ok"
43	touch $test_name.ok
44else
45	ln -f $test_name.log $test_name.failed
46	echo "$test_name: $test_description: failed"
47fi
48rm -f $TDB_FILE.0 $TMPFILE $CONF
49fi
50