coreutils
[Top][All Lists]
Advanced

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

[PATCH 6/6] tests: avoid spurious parallel failure due to temporary disk


From: Jim Meyering
Subject: [PATCH 6/6] tests: avoid spurious parallel failure due to temporary disk full
Date: Mon, 4 Apr 2011 07:13:41 +0200

From: Jim Meyering <address@hidden>

Running the new fiemap-empty test uses 600MB of disk space via
fallocate, and in so doing caused failure in unrelated tests that
were running in parallel on a small file system.  Rather than
simply running fallocate (which allocates the space, inducing
disk full when it fails), skip the test if there is less than
800MB of free space, as computed via stat and awk.
* tests/init.cfg (require_file_system_bytes_free_): New function.
* tests/cp/fiemap-empty: Use it.
---
 tests/cp/fiemap-empty |    7 +++++++
 tests/init.cfg        |    8 ++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tests/cp/fiemap-empty b/tests/cp/fiemap-empty
index 203619a..42d816b 100755
--- a/tests/cp/fiemap-empty
+++ b/tests/cp/fiemap-empty
@@ -31,6 +31,13 @@ fallocate -l 1 -n falloc.test ||
   skip_test_ 'this file system lacks FALLOCATE support'
 rm falloc.test

+# Require more space than we'll actually use, so that
+# tests run in parallel do not run out of space.
+# Otherwise, with inadequate space, simply running the following
+# fallocate command would induce a temporary disk-full condition,
+# which would cause failure of unrelated tests run in parallel.
+require_file_system_bytes_free_ 800000000
+
 fallocate -l 600000000 space.test ||
   skip_test_ 'this test needs at least 600MB free space'

diff --git a/tests/init.cfg b/tests/init.cfg
index 0711455..49cc4ee 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -151,6 +151,14 @@ require_built_()
   test $skip_ = yes && skip_test_ "required program(s) not built"
 }

+require_file_system_bytes_free_()
+{
+  local req=$1
+  local expr=$(stat -f --printf "($req + %S - 1) / %S <= %f" .)
+  awk "BEGIN{ exit !($expr) }" \
+    || skip_test_ "this test needs at least $req bytes of free space"
+}
+
 uid_is_privileged_()
 {
   # Make sure id -u succeeds.
-- 
1.7.4.2.662.gcbd0




reply via email to

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