summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-11-22 10:07:25 +0000
committerPádraig Brady <P@draigBrady.com>2012-11-24 15:27:21 +0000
commitdd68ddc6549f4ef33c35552044e4202274b6aec1 (patch)
tree96f75a71d330dcd9e1e4352de459fb4f40ecb429
parent64d4a2807d46a85cfe5ab7eb99b3e91b9a75d5ab (diff)
downloadcoreutils-dd68ddc6549f4ef33c35552044e4202274b6aec1.tar.xz
tests: don't rely on sed -i being available
* tests/df/df-output.sh: sed --in-place is not generally available. Also add a couple of simplifications from Bernhard Voelker. Removing all spaces, rather than just leading spaces, suffices. Searching for ' --output' in unadjusted df --help, suffices.
-rw-r--r--tests/df/df-output.sh34
1 files changed, 14 insertions, 20 deletions
diff --git a/tests/df/df-output.sh b/tests/df/df-output.sh
index 960d30e3c..fd3edfa83 100644
--- a/tests/df/df-output.sh
+++ b/tests/df/df-output.sh
@@ -27,28 +27,28 @@ Try 'df --help' for more information.
EOF
df -i --output '.' 2>out && fail=1
-sed -i 's/ -i / OPT /' out
-compare exp out || fail=1
+sed 's/ -i / OPT /' out > out2
+compare exp out2 || fail=1
df --output -i '.' 2>out && fail=1
-sed -i 's/ -i / OPT /' out
-compare exp out || fail=1
+sed 's/ -i / OPT /' out > out2
+compare exp out2 || fail=1
df -P --output '.' 2>out && fail=1
-sed -i 's/ -P / OPT /' out
-compare exp out || fail=1
+sed 's/ -P / OPT /' out > out2
+compare exp out2 || fail=1
df --output -P '.' 2>out && fail=1
-sed -i 's/ -P / OPT /' out
-compare exp out || fail=1
+sed 's/ -P / OPT /' out > out2
+compare exp out2 || fail=1
df -T --output '.' 2>out && fail=1
-sed -i 's/ -T / OPT /' out
-compare exp out || fail=1
+sed 's/ -T / OPT /' out > out2
+compare exp out2 || fail=1
df --output -T '.' 2>out && fail=1
-sed -i 's/ -T / OPT /' out
-compare exp out || fail=1
+sed 's/ -T / OPT /' out > out2
+compare exp out2 || fail=1
# Ensure that each field is only used once for the --output argument.
cat <<\EOF > exp || framework_failure_
@@ -93,8 +93,7 @@ EOF
df -B1K --output=size '.' >out || fail=1
sed -e '1 {
- s/ [ ]*/ /g
- s/^ //
+ s/ //
q
}' out > out2
compare exp out2 || fail=1
@@ -125,12 +124,7 @@ sed -n -e '3 {
compare exp out2 || fail=1
# Ensure that --output is mentioned in the usage.
-cat <<\EOF > exp || framework_failure_
---output
-EOF
-
df --help > out || fail=1
-grep ' --output' out | sed 's/^.*\(--output\).*$/\1/;q' > out2
-compare exp out2 || fail=1
+grep ' --output' out >/dev/null || { fail=1; cat out; }
Exit $fail