public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] xfstests: introduce _require_xfs_crc_sb pre-checkup routine
@ 2013-11-29  7:03 Jeff Liu
  2013-12-03  0:37 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Liu @ 2013-11-29  7:03 UTC (permalink / raw)
  To: xfs@oss.sgi.com

From: Jie Liu <jeff.liu@oracle.com>

Introduce _require_xfs_crc_sb to rc.  We can use it in pre-checkup
procedures to verify if the XFS test environment is configured with
CRC enabled or not for some particular test cases.

Introduce a new helper _xfs_sb_version to get XFS super block version
to make the test case more flexiable if possible. e.g, if that is
v5 super block, the tests behavior might be different to old v4 sb.

Refactor xfs/299 to use it.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 common/rc     | 19 +++++++++++++++++++
 tests/xfs/299 |  9 +--------
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/common/rc b/common/rc
index f73414b..9f45279 100644
--- a/common/rc
+++ b/common/rc
@@ -1579,6 +1579,25 @@ _check_xfs_filesystem()
     return 0
 }
 
+# Get XFS super block version
+_xfs_sb_version()
+{
+	sb_version=`$XFS_DB_PROG -r -c version $SCRATCH_DEV | \
+		    awk -F= '{print $2}' | awk -F, '{print $1}' | \
+		    cut -c3-`
+	echo $sb_version
+}
+
+# This test requires XFS crc-enabled (v5) super block support
+_require_xfs_crc_sb()
+{
+	version=`_xfs_sb_version`
+	if [ $version -lt 5 ]
+	then
+		_notrun "Can't run with older versions of superblock"
+	fi
+}
+
 # Filter the knowen errors the UDF Verifier reports.
 _udf_test_known_error_filter()
 {
diff --git a/tests/xfs/299 b/tests/xfs/299
index d5e8c5e..3c42908 100755
--- a/tests/xfs/299
+++ b/tests/xfs/299
@@ -54,6 +54,7 @@ chmod a+rwx $seqres.full	# arbitrary users will write here
 
 _require_scratch
 _require_xfs_quota
+_require_xfs_crc_sb
 
 bsoft=100
 bhard=500
@@ -198,14 +199,6 @@ cat $tmp.mkfs >>$seqres.full
 # keep the blocksize and data size for dd later
 . $tmp.mkfs
 
-sb_ver=`$XFS_DB_PROG -r -c version $SCRATCH_DEV | awk -F= '{print $2}' | awk -F, '{print $1}' |cut -c3-`
-echo $sb_ver
-
-if [ $sb_ver -lt 5 ]
-then
-	_notrun "Can't run with older versions of superblock"
-fi
-
 cat >$tmp.projects <<EOF
 1:$SCRATCH_MNT
 EOF
-- 
1.8.3.2

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-03  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29  7:03 [PATCH 1/3] xfstests: introduce _require_xfs_crc_sb pre-checkup routine Jeff Liu
2013-12-03  0:37 ` Dave Chinner
2013-12-03  0:56   ` Dave Chinner
2013-12-03  7:48     ` Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox