From 68d3b93bf67fdb80bb833b82fc080646723800c0 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 25 Feb 2015 15:36:52 +1100 Subject: [PATCH] create _require_metadata_journaling, and add to tests that need it Many tests use dm_flakey to trigger log replay, but for filesystems that don't support metadata journaling, this causes failures when it shouldn't. (i.e. we can hardly test log replay if there is no log, and the subsequent filesystem check will turn up errors). For some tests they actually sync everything we care about, and find inconsistencies elsewhere, but I erred on the side of simply not running the test in most cases. Tested-by: Filipe Manana Signed-off-by: Eric Sandeen Reviewed-by: Filipe Manana Reviewed-by: Lukas Czerner Signed-off-by: Dave Chinner --- common/rc | 32 ++++++++++++++++++++++++++++++++ tests/generic/034 | 1 + tests/generic/040 | 1 + tests/generic/041 | 1 + tests/generic/056 | 1 + tests/generic/057 | 1 + tests/generic/311 | 1 + tests/generic/321 | 1 + tests/generic/322 | 1 + 9 files changed, 40 insertions(+) diff --git a/common/rc b/common/rc index f173eab2..1ed9df53 100644 --- a/common/rc +++ b/common/rc @@ -2340,6 +2340,38 @@ _require_norecovery() _scratch_unmount } +# Does this filesystem support metadata journaling? +# We exclude ones here that don't; otherwise we assume that it does, so the +# test will run, fail, and motivate someone to update this test for a new +# filesystem. +# +# It's possible that TEST_DEV and SCRATCH_DEV have different features (it'd be +# odd, but possible) so check $TEST_DEV by default, but we can optionall pass +# any dev we want. +_require_metadata_journaling() +{ + if [ -z $1 ]; then + DEV=$TEST_DEV + else + DEV=$1 + fi + + case "$FSTYP" in + ext2|vfat|msdos) + _notrun "$FSTYP does not support metadata journaling" + ;; + ext4) + # ext4 could be mkfs'd without a journal... + _require_dumpe2fs + $DUMPE2FS_PROG -h $DEV 2>&1 | grep -q has_journal || \ + _notrun "$FSTYP on $DEV not configured with metadata journaling" + ;; + *) + # by default we pass; if you need to, add your fs above! + ;; + esac +} + # Does fiemap support? _require_fiemap() { diff --git a/tests/generic/034 b/tests/generic/034 index 4ec1db87..966b3d2f 100755 --- a/tests/generic/034 +++ b/tests/generic/034 @@ -53,6 +53,7 @@ _supported_os Linux _need_to_be_root _require_scratch _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full diff --git a/tests/generic/040 b/tests/generic/040 index 5f10f489..c841fbc2 100755 --- a/tests/generic/040 +++ b/tests/generic/040 @@ -62,6 +62,7 @@ _supported_os Linux _need_to_be_root _require_scratch _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full diff --git a/tests/generic/041 b/tests/generic/041 index 36a6f423..f38b6627 100755 --- a/tests/generic/041 +++ b/tests/generic/041 @@ -66,6 +66,7 @@ _supported_os Linux _need_to_be_root _require_scratch _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full diff --git a/tests/generic/056 b/tests/generic/056 index 9ec00e36..8bb1522b 100755 --- a/tests/generic/056 +++ b/tests/generic/056 @@ -55,6 +55,7 @@ _supported_os Linux _need_to_be_root _require_scratch _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full diff --git a/tests/generic/057 b/tests/generic/057 index 4c0ffd1b..3b9f89e2 100755 --- a/tests/generic/057 +++ b/tests/generic/057 @@ -55,6 +55,7 @@ _supported_os Linux _need_to_be_root _require_scratch _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full diff --git a/tests/generic/311 b/tests/generic/311 index 85e52e8e..d21b6eb3 100755 --- a/tests/generic/311 +++ b/tests/generic/311 @@ -56,6 +56,7 @@ _supported_os Linux _need_to_be_root _require_scratch_nocheck _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV # xfs_io is not required for this test, but it's the best way to verify # the test system supports fallocate() for allocation diff --git a/tests/generic/321 b/tests/generic/321 index 3bd6b121..c821a23a 100755 --- a/tests/generic/321 +++ b/tests/generic/321 @@ -45,6 +45,7 @@ _supported_os Linux _need_to_be_root _require_scratch_nocheck _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full diff --git a/tests/generic/322 b/tests/generic/322 index 3ec23876..4c0edf6a 100755 --- a/tests/generic/322 +++ b/tests/generic/322 @@ -45,6 +45,7 @@ _supported_os Linux _need_to_be_root _require_scratch_nocheck _require_dm_flakey +_require_metadata_journaling $SCRATCH_DEV rm -f $seqres.full -- 2.39.5