xref: /aosp_15_r20/external/e2fsprogs/tests/t_mmp_fail/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1FSCK_OPT=-yf
2
3$MKE2FS -q -F -o Linux -I 128 -b 1024 -O mmp $TMPFILE 100 > $test_name.log 2>&1
4status=$?
5if [ "$status" != 0 ] ; then
6	echo "mke2fs -O mmp failed" > $test_name.failed
7	echo "$test_name: $test_description: failed"
8	return $status
9fi
10
11$TUNE2FS -O project $TMPFILE >> $test_name.log 2>&1
12status=$?
13if [ "$status" == 0 ] ; then
14	echo "'tune2fs -O project' succeeded on small inode" > $test_name.failed
15	echo "$test_name: $test_description: failed"
16	return 1
17fi
18$TUNE2FS -o bad_option $TMPFILE >> $test_name.log 2>&1
19status=$?
20if [ "$status" == 0 ] ; then
21	echo "'tune2fs -o bad_option' succeeded" > $test_name.failed
22	echo "$test_name: $test_description: failed"
23	return 1
24fi
25$E2MMPSTATUS -i $TMPFILE >> $test_name.log 2>&1
26$E2MMPSTATUS $TMPFILE >> $test_name.log 2>&1
27status=$?
28if [ "$status" != 0 ] ; then
29	echo "$TUNE2FS left MMP block in bad state" > $test_name.failed
30	echo "$test_name: $test_description: failed"
31	return $status
32fi
33
34$FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
35status=$?
36if [ "$status" = 0 ] ; then
37	echo "$test_name: $test_description: ok"
38	touch $test_name.ok
39else
40	echo "e2fsck after MMP disable failed" > $test_name.failed
41	echo "$test_name: $test_description: failed"
42	return $status
43fi
44rm -f $TMPFILE
45