summaryrefslogtreecommitdiff
path: root/tests/test-lib.sh
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 /tests/test-lib.sh
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.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r--tests/test-lib.sh17
1 files changed, 17 insertions, 0 deletions
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