[parted-devel] [PATCH 13/14] Ignore xfs based test when mkfs.xfs is not present

Joel Granados Moreno jgranado at redhat.com
Fri Jun 5 12:14:20 UTC 2009


When the mkfs.xfs command was not present the test failed because it
could not create an xfs file system.  This resulted in a false negative.

* lvm-utils.sh (fs_xfs_exists_) : New function.
* t4100-msdos-partition-limits.sh : Ignore the whole test when mkfs.xfs
  is not present.
* t4100-dvh-partition-limits.sh : Likewise.
---
 tests/lvm-utils.sh                    |    6 ++++++
 tests/t4100-dvh-partition-limits.sh   |    7 +++++++
 tests/t4100-msdos-partition-limits.sh |    7 +++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/tests/lvm-utils.sh b/tests/lvm-utils.sh
index 53842cb..b60a725 100755
--- a/tests/lvm-utils.sh
+++ b/tests/lvm-utils.sh
@@ -131,6 +131,12 @@ mdadm_create_linear_device_()
   return 0
 }
 
+# Checks for the existence of mkfs.xfs
+fs_xfs_exists_()
+{
+  mkfs.xfs -V > /dev/null 2>&1
+  return $(test "x$?" = "x0")
+}
 
 # set up private /dev and /etc
 init_root_dir_()
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
index 95ec02b..a8a25dd 100755
--- a/tests/t4100-dvh-partition-limits.sh
+++ b/tests/t4100-dvh-partition-limits.sh
@@ -23,6 +23,13 @@ privileges_required_=1
 : ${srcdir=.}
 . $srcdir/test-lib.sh
 
+fs_xfs_exists_ ||
+  {
+    say "skipping $0: could not find mkfs.xfs executable"
+    test_done
+    exit
+  }
+
 ####################################################
 # Create and mount a file system capable of dealing with >=2TB files.
 # We must be able to create a file with an apparent length of 2TB or larger.
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
index 47000a8..4e0b6bd 100755
--- a/tests/t4100-msdos-partition-limits.sh
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -23,6 +23,13 @@ privileges_required_=1
 : ${srcdir=.}
 . $srcdir/test-lib.sh
 
+fs_xfs_exists_ ||
+  {
+    say "skipping $0: could not find mkfs.xfs executable"
+    test_done
+    exit
+  }
+
 ####################################################
 # Create and mount a file system capable of dealing with >=2TB files.
 # We must be able to create a file with an apparent length of 2TB or larger.
-- 
1.6.0.6




More information about the parted-devel mailing list