]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: don't rely on sed -i being available
authorPádraig Brady <P@draigBrady.com>
Thu, 22 Nov 2012 10:07:25 +0000 (10:07 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 24 Nov 2012 15:27:21 +0000 (15:27 +0000)
* 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.

tests/df/df-output.sh

index 960d30e3cbf87d02f84aa61f33ac4027bd728b91..fd3edfa83fc2b266d8dab22d518719f89eca3f3e 100644 (file)
@@ -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