xref: /aosp_15_r20/external/e2fsprogs/tests/t_uninit_bg_rm/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1test_description="remove uninit_bg"
2OUT=$test_name.log
3FSCK_OPT=-yf
4EXP=$test_dir/expect
5
6os=$(uname -s)
7if [ "$os" = "Darwin" -o "$os" = "GNU" -o "FreeBSD" ]; then
8	# creates a 10GB filesystem
9	echo "$test_name: $test_description: skipped for $os"
10	return 0
11fi
12
13cp /dev/null $TMPFILE
14
15echo mke2fs -q -t ext4 -F -o Linux -b 1024 test.img 1G > $OUT.new
16$MKE2FS -q -t ext4 -F -o Linux -b 1024 $TMPFILE 1G >> $OUT.new 2>&1
17
18echo "tune2fs -f -O ^uninit_bg test.img" >> $OUT.new
19$TUNE2FS -f -O ^uninit_bg $TMPFILE >> $OUT.new 2>&1
20
21echo " " >> $OUT.new
22echo fsck $FSCK_OPT -N test_filesys test.img >> $OUT.new
23$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
24
25echo " " >> $OUT.new
26cp /dev/null $TMPFILE
27echo mke2fs -q -t ext4 -O bigalloc -F -o Linux -b 1024 -C 8192 test.img 10G >> $OUT.new
28$MKE2FS -q -t ext4 -O bigalloc -F -o Linux -b 1024 -C 8192 $TMPFILE 10G >> $OUT.new 2>&1
29
30echo "tune2fs -f -O ^uninit_bg test.img" >> $OUT.new
31$TUNE2FS -f -O ^uninit_bg $TMPFILE >> $OUT.new 2>&1
32
33echo " " >> $OUT.new
34echo fsck $FSCK_OPT -N test_filesys test.img >> $OUT.new
35$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
36sed -f $cmd_dir/filter.sed < $OUT.new > $OUT
37
38rm -f $TMPFILE $OUT.new
39
40#
41# Do the verification
42#
43
44cmp -s $OUT $EXP
45status=$?
46
47if [ "$status" = 0 ] ; then
48	echo "$test_name: $test_description: ok"
49	touch $test_name.ok
50else
51	echo "$test_name: $test_description: failed"
52	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
53fi
54
55unset IMAGE FSCK_OPT OUT EXP
56