summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ioblksize.h2
-rwxr-xr-xtests/dd/skip-seek-past-dev.sh2
-rwxr-xr-xtests/du/2g.sh5
-rwxr-xr-xtests/misc/stat-mount.sh6
4 files changed, 7 insertions, 8 deletions
diff --git a/src/ioblksize.h b/src/ioblksize.h
index 276d38fe6..55aaeae11 100644
--- a/src/ioblksize.h
+++ b/src/ioblksize.h
@@ -63,7 +63,7 @@
the readahead setting is 128KiB which was read using:
file="."
- device=$(df -P --local "$file" | tail -n1 | cut -d' ' -f1)
+ device=$(df --output=source --local "$file" | tail -n1)
echo $(( $(blockdev --getra $device) * 512 ))
However there isn't a portable way to get the above.
diff --git a/tests/dd/skip-seek-past-dev.sh b/tests/dd/skip-seek-past-dev.sh
index caa2314df..5eb7ab5ac 100755
--- a/tests/dd/skip-seek-past-dev.sh
+++ b/tests/dd/skip-seek-past-dev.sh
@@ -33,7 +33,7 @@ get_device_size() {
# Get path to device the current dir is on.
# Note df can only get fs size, not device size.
-device=$(df -P . | tail -n1 | cut -d' ' -f1) || framework_failure_
+device=$(df --output=source . | tail -n1) || framework_failure_
dev_size=$(get_device_size "$device") ||
skip_ "failed to determine size of $device"
diff --git a/tests/du/2g.sh b/tests/du/2g.sh
index cfd1fc464..f766d4d9d 100755
--- a/tests/du/2g.sh
+++ b/tests/du/2g.sh
@@ -27,10 +27,7 @@ very_expensive_
# Get number of free kilobytes on current partition, so we can
# skip this test if there is insufficient free space.
-
-# This technique relies on the fact that the 'Available' kilobyte
-# count is the number just before the one with a trailing '%'.
-free_kb=$(df -kP .|tail -1|sed 's/ [0-9][0-9]*%.*//;s/ *$//;s/.* //')
+free_kb=$(df -k --output=avail . | tail -n1)
case "$free_kb" in
[0-9]*) ;;
*) skip_ "invalid size from df: $free_kb";;
diff --git a/tests/misc/stat-mount.sh b/tests/misc/stat-mount.sh
index 814d23ce5..ab1ff479b 100755
--- a/tests/misc/stat-mount.sh
+++ b/tests/misc/stat-mount.sh
@@ -19,8 +19,10 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ stat
-df_mnt=$(df -P . | sed -n '2s/.* \([^ ]*$\)/\1/p')
stat_mnt=$(stat -c%m .) || fail=1
-test "$stat_mnt" || fail=1
+case "$stat_mnt" in
+ /*) ;;
+ *) fail=1;;
+esac
Exit $fail