coreutils
[Top][All Lists]
Advanced

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

[PATCH] tests: avoid false failure when df lists no root file system


From: Pádraig Brady
Subject: [PATCH] tests: avoid false failure when df lists no root file system
Date: Mon, 25 Apr 2016 23:20:46 +0100

* tests/df/skip-duplicates.sh: Skip the test when there is no
'/' entry listed by df, which was seen in certain chroot setups.
---
 tests/df/skip-duplicates.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
index 1b980b6..b308234 100755
--- a/tests/df/skip-duplicates.sh
+++ b/tests/df/skip-duplicates.sh
@@ -23,11 +23,12 @@ require_gcc_shared_
 
 # We use --local here so as to not activate
 # potentially very many remote mounts.
-df --local || skip_ 'df fails'
+LOCAL_FS=$(df --local --output=target 2>&1) || skip_ 'df fails'
+echo "$LOCAL_FS" | grep '^/$' || skip_ 'no root file system found'
 
-export CU_NONROOT_FS=$(df --local --output=target 2>&1 | grep /. | head -n1)
-export CU_REMOTE_FS=$(df --local --output=target 2>&1 | grep /. |
-                      tail -n+2 | head -n1)
+# Get real targets to substitute for /NONROOT and /REMOTE below.
+export CU_NONROOT_FS=$(echo "$LOCAL_FS" | grep /. | head -n1)
+export CU_REMOTE_FS=$(echo "$LOCAL_FS" | grep /. | tail -n+2 | head -n1)
 
 unique_entries=1
 test -z "$CU_NONROOT_FS" || unique_entries=$(expr $unique_entries + 1)
-- 
2.5.5




reply via email to

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