>From b0da9315af0b7430eea88429f0e54f43c345e1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Sun, 13 Feb 2011 18:56:10 +0000 Subject: [PATCH] test: support more file systems in the cp fiemap tests * tests/cp/fiemap-perf: Check for fiemap support against a file rather than a directory to enable tests on BTRFS for example. Explicity disable the test on ext3 or file systems where we can't determine the type. * tests/cp/sparse-fiemap: Likewise. * tests/init.cfg: Comment that BTRFS only supports fiemap for regular files. --- tests/cp/fiemap-perf | 12 ++++++++---- tests/cp/sparse-fiemap | 9 +++++---- tests/init.cfg | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/cp/fiemap-perf b/tests/cp/fiemap-perf index dbb2a81..bbe3f0d 100755 --- a/tests/cp/fiemap-perf +++ b/tests/cp/fiemap-perf @@ -20,10 +20,14 @@ print_ver_ cp # Require a fiemap-enabled FS. -# Note we don't check a file here as that could enable -# the test on ext3 where emulated extent scanning can be slow. -fiemap_capable_ . \ - || skip_ "this file system lacks FIEMAP support" +touch fiemap_chk +fiemap_capable_ fiemap_chk || + skip_ "this file system lacks FIEMAP support" + +# Exclude ext3 (or unknown fs types) +# as the emulated extent scanning is slow +df -t ext3 . >/dev/null && + skip_ "ext3 has known slow FIEMAP scanning" # Create a large-but-sparse file. timeout 10 truncate -s1T f || framework_failure_ diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap index fc27869..4eced1d 100755 --- a/tests/cp/sparse-fiemap +++ b/tests/cp/sparse-fiemap @@ -19,10 +19,11 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ cp -# Note we don't check a file here as that could enable -# the test on ext3 where this test is seen to fail. -if fiemap_capable_ . ; then - : # Current dir is on a partition with working extents. Good! +# The test was seen to fail on ext3 so exclude that type +# (or any file system where the type can't be determined) +touch fiemap_chk +if fiemap_capable_ fiemap_chk && ! df -t ext3 . >/dev/null; then + : # Current partition has working extents. Good! else # It's not; we need to create one, hence we need root access. require_root_ diff --git a/tests/init.cfg b/tests/init.cfg index eb3feaa..5e0f71b 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -296,7 +296,7 @@ require_proc_pid_status_() } # Return nonzero if the specified path is on a file system for -# which FIEMAP support exists. Note some file systems (like ext3) +# which FIEMAP support exists. Note some file systems (like ext3,btrfs) # only support FIEMAP for files, not directories. fiemap_capable_() { -- 1.7.4