summaryrefslogtreecommitdiff
path: root/tests/t_mmp_1on
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@whamcloud.com>2011-09-24 14:13:27 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-09-25 01:55:28 -0400
commitd9c60e04b3b18b13d7707f1876ac7bce89df10e9 (patch)
tree0cfb6d3e9506d5ef45b41976ffcbfe0bb792e453 /tests/t_mmp_1on
parent0f5eba7501f467f757792ee449d16c9259b994fd (diff)
downloade2fsprogs-d9c60e04b3b18b13d7707f1876ac7bce89df10e9.tar.gz
e2fsck: regression tests for INCOMPAT_MMP feature
Add tests for the MMP feature - creating a filesystem with mke2fs and MMP enabled, enable/disable MMP with tune2fs, disabling the e2fsck MMP flag with tune2fs after a failed e2fsck, and e2fsck checking and fixing a corrupt MMP block. The MMP tests need to be run from a real disk, not tmpfs, because tmpfs doesn't support O_DIRECT reads, which MMP uses to ensure that reads from the MMP block are not filled from the page cache. Using a local disk does not slow down the tests noticably, since they wait to detect if the MMP block is being modified. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'tests/t_mmp_1on')
-rw-r--r--tests/t_mmp_1on/name1
-rw-r--r--tests/t_mmp_1on/script40
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/t_mmp_1on/name b/tests/t_mmp_1on/name
new file mode 100644
index 00000000..62e16b20
--- /dev/null
+++ b/tests/t_mmp_1on/name
@@ -0,0 +1 @@
+enable MMP using tune2fs
diff --git a/tests/t_mmp_1on/script b/tests/t_mmp_1on/script
new file mode 100644
index 00000000..ee9884ff
--- /dev/null
+++ b/tests/t_mmp_1on/script
@@ -0,0 +1,40 @@
+FSCK_OPT=-yf
+
+TMPFILE=test.img
+rm -f $test_name.failed $test_name.ok
+> $TMPFILE
+
+stat -f $TMPFILE | grep -q "Type: tmpfs"
+if [ $? == 0 ] ; then
+ rm -f $TMPFILE
+ echo "skipped for tmpfs (no O_DIRECT support)"
+ return 0
+fi
+
+$MKE2FS -q -F -o Linux -b 1024 $TMPFILE 100 > $test_name.log 2>&1
+status=$?
+if [ "$status" != 0 ] ; then
+ echo "mke2fs failed" > $test_name.failed
+ echo "failed"
+ return $status
+fi
+
+$TUNE2FS -O mmp -E mmp_update_interval=1 $TMPFILE >> $test_name.log 2>&1
+status=$?
+if [ "$status" != 0 ] ; then
+ echo "tune2fs -O mmp failed with $status" > $test_name.failed
+ echo "failed"
+ return $status
+fi
+
+$FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
+status=$?
+if [ "$status" = 0 ] ; then
+ echo "ok"
+ touch $test_name.ok
+else
+ echo "e2fsck with MMP enabled failed with $status" > $test_name.failed
+ echo "failed"
+ return $status
+fi
+rm -f $TMPFILE