coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

minor test improvements, clean-up


From: Jim Meyering
Subject: minor test improvements, clean-up
Date: Mon, 31 Jan 2011 18:30:42 +0100

FYI,

>From 040b00ef19fb1bbc0f7d3e5bec6ff82e19a92d26 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 31 Jan 2011 13:35:55 +0100
Subject: [PATCH 1/8] tests: remove duplicate fiemap-perf test

* tests/cp/fiemap-perf: Copy block-comparing code from sparse-fiemap.
* tests/cp/sparse-fiemap: The same test was here, alongside a much
more involved test.  Remove it, now that it is in its own file.
---
 tests/cp/fiemap-perf   |    4 ++++
 tests/cp/sparse-fiemap |   13 +------------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/tests/cp/fiemap-perf b/tests/cp/fiemap-perf
index 6c588cb..bd8fab8 100755
--- a/tests/cp/fiemap-perf
+++ b/tests/cp/fiemap-perf
@@ -29,4 +29,8 @@ timeout 10 truncate -s1T f || framework_failure_
 # Nothing can read (much less write) that many bytes in so little time.
 timeout 10 cp f f2 || fail=1

+# Ensure that the sparse file copied through fiemap has the same size
+# in bytes as the original.
+test $(stat --printf %s sparse) = $(stat --printf %s fiemap) || fail=1
+
 Exit $fail
diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index b6b1103..aecf9d2 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Test cp --sparse=always through fiemap copy

-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -47,17 +47,6 @@ else
     skip_test_ "insufficient mount/ext4 support"
 fi

-# Create a 1TiB sparse file
-dd if=/dev/zero of=sparse bs=1k count=1 seek=1G || framework_failure
-
-# It takes many minutes to copy this sparse file using the old method.
-# By contrast, it takes far less than 1 second using FIEMAP-copy.
-timeout 10 cp --sparse=always sparse fiemap || fail=1
-
-# Ensure that the sparse file copied through fiemap has the same size
-# in bytes as the original.
-test $(stat --printf %s sparse) = $(stat --printf %s fiemap) || fail=1
-
 # =================================================
 # Ensure that we exercise the FIEMAP-copying code enough
 # to provoke at least two iterations of the do...while loop
--
1.7.3.5.44.g960a


>From 08b7bce540f12595f9995851338bb765783d264c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 31 Jan 2011 13:40:26 +0100
Subject: [PATCH 2/8] tests: modernize sparse-fiemap test

* tests/cp/sparse-fiemap: Use print_ver_, not open-coded VERBOSE test.
---
 tests/cp/sparse-fiemap |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index aecf9d2..c873645 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -16,12 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

-if test "$VERBOSE" = yes; then
-  set -x
-  cp --version
-fi
-
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
+print_ver_ cp

 if df -T -t btrfs -t xfs -t ext4 -t ocfs2 . ; then
   : # Current dir is on a partition with working extents.  Good!
--
1.7.3.5.44.g960a


>From 31dc21f693b5dc9c267be89934ea4cb306806e39 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 31 Jan 2011 13:42:49 +0100
Subject: [PATCH 3/8] maint: update copyright year lists in new files

* src/extent-scan.h: Update copyright year list.
* src/extent-scan.c: Likewise.
* tests/cp/sparse-fiemap: Likewise.
---
 src/extent-scan.c      |    2 +-
 src/extent-scan.h      |    2 +-
 tests/cp/sparse-fiemap |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/extent-scan.c b/src/extent-scan.c
index 3bb0d53..9f38877 100644
--- a/src/extent-scan.c
+++ b/src/extent-scan.c
@@ -1,5 +1,5 @@
 /* extent-scan.c -- core functions for scanning extents
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010-2011 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/src/extent-scan.h b/src/extent-scan.h
index ac9e500..4724b25 100644
--- a/src/extent-scan.h
+++ b/src/extent-scan.h
@@ -1,5 +1,5 @@
 /* core functions for efficient reading sparse files
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010-2011 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index c873645..7e1932b 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Test cp --sparse=always through fiemap copy

-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2011 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
--
1.7.3.5.44.g960a


>From 3aae01fa9b3759da90854e7423bfc75b8c634afd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 31 Jan 2011 14:44:15 +0100
Subject: [PATCH 4/8] 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(-)

diff --git a/tests/cp/fiemap-2 b/tests/cp/fiemap-2
index e27f355..a17076c 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 bd8fab8..6227243 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 7e1932b..f224b5b 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 a7860e7..fa15aa4 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_()
 {
--
1.7.3.5.44.g960a


>From aeed6c1d8981e89d414f6ba0f4dd078a1ab755f0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 31 Jan 2011 15:17:12 +0100
Subject: [PATCH 5/8] maint: remove unused inclusion of "fiemap.h"

* src/copy.c: Don't include "fiemap.h".
---
 src/copy.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 4e73e1b..d32a11c 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -63,10 +63,6 @@
 # include "verror.h"
 #endif

-#ifndef HAVE_FIEMAP
-# include "fiemap.h"
-#endif
-
 #ifndef HAVE_FCHOWN
 # define HAVE_FCHOWN false
 # define fchown(fd, uid, gid) (-1)
--
1.7.3.5.44.g960a


>From 96a93f9480e0a420c21db7b58662a6e3ddf16124 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 31 Jan 2011 15:20:29 +0100
Subject: [PATCH 6/8] tests: gfs2 also supports FIEMAP

* tests/init.cfg (fiemap_capable_): Add gfs2.
Clarify comment.
---
 tests/init.cfg |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/init.cfg b/tests/init.cfg
index fa15aa4..b2d1bab 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -295,11 +295,13 @@ require_proc_pid_status_()
     kill $pid
 }

-# Return nonzero if the specified directory is on a file system
-# for which FIEMAP support exists.
+# Return nonzero if the specified directory is on a file system for
+# which FIEMAP support exists, and the file system type is new enough
+# (unlike ext2 and ext3) that it is hard to find an instance *without*
+# FIEMAP support.
 fiemap_capable_()
 {
-  df -T -t btrfs -t xfs -t ext4 -t ocfs2 "$@"
+  df -T -t btrfs -t xfs -t ext4 -t ocfs2 -t gfs2 "$@"
 }

 # Does the current (working-dir) file system support sparse files?
--
1.7.3.5.44.g960a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]