summaryrefslogtreecommitdiff
path: root/tests/df/skip-duplicates.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-04-25 23:12:14 +0100
committerPádraig Brady <P@draigBrady.com>2016-04-26 11:35:59 +0100
commitdc9146c4a2b947998b11c0995d017ca64a5583a1 (patch)
tree0f8b0d6db066b3810cda30f98f4cce411f62f25a /tests/df/skip-duplicates.sh
parentc92585b10b29ce2c31c69cea52e69ef053c9679f (diff)
downloadcoreutils-dc9146c4a2b947998b11c0995d017ca64a5583a1.tar.xz
tests: avoid false failure when df lists no root file system
* tests/df/skip-duplicates.sh: Skip the test when there is no '/' entry listed by df, which was seen in certain chroot setups.
Diffstat (limited to 'tests/df/skip-duplicates.sh')
-rwxr-xr-xtests/df/skip-duplicates.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
index 1b980b653..f3492637b 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'
+df --local --output=target >LOCAL_FS || skip_ 'df fails'
+grep '^/$' LOCAL_FS || 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=$(grep /. LOCAL_FS | head -n1)
+export CU_REMOTE_FS=$(grep /. LOCAL_FS | tail -n+2 | head -n1)
unique_entries=1
test -z "$CU_NONROOT_FS" || unique_entries=$(expr $unique_entries + 1)