From 3aae01fa9b3759da90854e7423bfc75b8c634afd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 31 Jan 2011 14:44:15 +0100 Subject: tests: factor fiemap-related predicate into init.cfg * tests/init.cfg (fiemap_capable_): New function. * tests/cp/fiemap-perf: Use it. * tests/cp/sparse-fiemap: Likewise. * tests/cp/fiemap-2: Likewise. --- tests/cp/fiemap-2 | 2 +- tests/cp/fiemap-perf | 2 +- tests/cp/sparse-fiemap | 2 +- tests/init.cfg | 7 +++++++ 4 files changed, 10 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/cp/fiemap-2 b/tests/cp/fiemap-2 index e27f35521..a17076cc2 100755 --- a/tests/cp/fiemap-2 +++ b/tests/cp/fiemap-2 @@ -20,7 +20,7 @@ print_ver_ cp # Require a fiemap-enabled FS. -df -T -t btrfs -t xfs -t ext4 -t ocfs2 . \ +fiemap_capable_ . \ || skip_ "this file system lacks FIEMAP support" # Exercise the code that handles a file ending in a hole. diff --git a/tests/cp/fiemap-perf b/tests/cp/fiemap-perf index bd8fab8d4..62272439b 100755 --- a/tests/cp/fiemap-perf +++ b/tests/cp/fiemap-perf @@ -20,7 +20,7 @@ print_ver_ cp # Require a fiemap-enabled FS. -df -T -t btrfs -t xfs -t ext4 -t ocfs2 . \ +fiemap_capable_ . \ || skip_ "this file system lacks FIEMAP support" # Create a large-but-sparse file. diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap index 7e1932b08..f224b5be0 100755 --- a/tests/cp/sparse-fiemap +++ b/tests/cp/sparse-fiemap @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ cp -if df -T -t btrfs -t xfs -t ext4 -t ocfs2 . ; then +if fiemap_capable_ . ; then : # Current dir is on a partition with working extents. Good! else # It's not; we need to create one, hence we need root access. diff --git a/tests/init.cfg b/tests/init.cfg index a7860e740..fa15aa4b1 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -295,6 +295,13 @@ require_proc_pid_status_() kill $pid } +# Return nonzero if the specified directory is on a file system +# for which FIEMAP support exists. +fiemap_capable_() +{ + df -T -t btrfs -t xfs -t ext4 -t ocfs2 "$@" +} + # Does the current (working-dir) file system support sparse files? require_sparse_support_() { -- cgit v1.2.3-54-g00ecf