summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-05-03 15:46:41 +0200
committerJim Meyering <meyering@redhat.com>2008-05-06 08:21:30 +0200
commit2656da4705eb26a30da6b51be18d9ba474bc4d00 (patch)
tree2806611b67476c76d7931eecd327cac84e6dc831
parent3269104d172bdc0c9ed0a01e6706f1f6e1a2bdda (diff)
downloadcoreutils-2656da4705eb26a30da6b51be18d9ba474bc4d00.tar.xz
tests: move "sparse-file" into test-lib.sh
* tests/sparse-file: Remove file Move contents into ... * tests/test-lib.sh (require_sparse_support_): ...here. New function. * tests/cp/sparse: Use the function, not the file. * tests/du/8gb: Likewise. * tests/Makefile.am (EXTRA_DIST): Remove sparse-file.
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/cp/sparse2
-rwxr-xr-xtests/du/8gb2
-rw-r--r--tests/sparse-file29
-rw-r--r--tests/test-lib.sh17
5 files changed, 19 insertions, 32 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 62defa25a..3674d3f32 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,7 +19,6 @@ EXTRA_DIST = \
require-perl \
sample-test \
setgid-check \
- sparse-file \
test-lib.sh
## N O T E :: Do not add more names to this list.
diff --git a/tests/cp/sparse b/tests/cp/sparse
index dfb348db3..0d915df57 100755
--- a/tests/cp/sparse
+++ b/tests/cp/sparse
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
cp --version
fi
-. $top_srcdir/tests/sparse-file
. $top_srcdir/tests/test-lib.sh
+require_sparse_support_
# Create a sparse file.
# It has to be at least 128K in order to be sparse on some systems.
diff --git a/tests/du/8gb b/tests/du/8gb
index b0a42c4ad..66f02e78b 100755
--- a/tests/du/8gb
+++ b/tests/du/8gb
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
du --version
fi
-. $top_srcdir/tests/sparse-file
. $top_srcdir/tests/test-lib.sh
+require_sparse_support_
dd bs=1 seek=8G of=big < /dev/null 2> /dev/null
if test $? != 0; then
diff --git a/tests/sparse-file b/tests/sparse-file
deleted file mode 100644
index 4f98bfb87..000000000
--- a/tests/sparse-file
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- sh -*-
-# Does the current (working-dir.) file system support sparse files?
-
-# Copyright (C) 2006, 2007 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test whether we can create a sparse file.
-# For example, on Darwin6.5 with a file system of type hfs, it's not possible.
-# NTFS requires 128K before a hole appears in a sparse file.
-t=sparse.$$
-dd bs=1 seek=128K of=$t < /dev/null 2> /dev/null
-set x `du -sk $t`
-kb_size=$2
-rm -f $t
-if test $kb_size -ge 128; then
- skip_test_ 'this file system does not support sparse files'
-fi
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index bd6be422b..5ff301c6f 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -197,6 +197,23 @@ of group names or numbers. E.g.,
esac
}
+# Does the current (working-dir) file system support sparse files?
+require_sparse_support_()
+{
+ test $# = 0 || framework_failure
+ # Test whether we can create a sparse file.
+ # For example, on Darwin6.5 with a file system of type hfs, it's not possible.
+ # NTFS requires 128K before a hole appears in a sparse file.
+ t=sparse.$$
+ dd bs=1 seek=128K of=$t < /dev/null 2> /dev/null
+ set x `du -sk $t`
+ kb_size=$2
+ rm -f $t
+ if test $kb_size -ge 128; then
+ skip_test_ 'this file system does not support sparse files'
+ fi
+}
+
mkfifo_or_skip_()
{
test $# = 1 || framework_failure