From 26860526670566d9b0ea42ff27fa73668b9a19da Mon Sep 17 00:00:00 2001
From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Mon, 28 Aug 2017 21:51:37 -0700
Subject: [PATCH] tests: don't fail tests when failing to write files
* tests/sample-test: Use framework_error_ rather than fail=1
* tests/chown/deref.sh: Likewise.
* tests/chown/preserve-root.sh: Likewise.
* tests/cp/src-base-dot.sh: Likewise.
* tests/dd/unblock-sync.sh: Likewise.
* tests/du/2g.sh: Likewise.
* tests/du/inacc-dest.sh: Likewise.
* tests/du/one-file-system.sh: Likewise.
* tests/fmt/goal-option.sh: Likewise.
* tests/ln/hard-backup.sh: Likewise.
* tests/ls/color-dtype-dir.sh: Likewise.
* tests/ls/m-option.sh: Likewise.
* tests/ls/stat-dtype.sh: Likewise.
* tests/ls/time-style-diag.sh: Likewise.
* tests/ls/x-option.sh: Likewise.
* tests/misc/chcon.sh: Likewise.
* tests/misc/nohup.sh: Likewise.
* tests/misc/od-N.sh: Likewise.
* tests/misc/sort-compress.sh: Likewise.
* tests/misc/tac-continue.sh: Likewise.
* tests/misc/time-style.sh: Likewise.
* tests/mv/backup-dir.sh: Likewise.
* tests/mv/dir2dir.sh: Likewise.
* tests/rm/dir-no-w.sh: Likewise.
* tests/rm/dir-nonrecur.sh: Likewise.
* tests/rm/inaccessible.sh: Likewise.
* tests/rm/interactive-always.sh: Likewise.
* tests/rm/interactive-once.sh: Likewise.
* tests/rm/rm3.sh: Likewise.
* tests/rm/v-slash.sh: Likewise.
* tests/touch/relative.sh: Likewise.
---
tests/chown/deref.sh | 2 +-
tests/chown/preserve-root.sh | 6 +++---
tests/cp/backup-1.sh | 2 +-
tests/cp/src-base-dot.sh | 6 +-----
tests/dd/skip-seek2.sh | 4 ++--
tests/dd/unblock-sync.sh | 2 +-
tests/du/2g.sh | 2 +-
tests/du/inacc-dest.sh | 2 +-
tests/du/long-sloop.sh | 6 +++---
tests/du/one-file-system.sh | 12 ++++++------
tests/fmt/goal-option.sh | 4 ++--
tests/install/strip-program.sh | 4 ++--
tests/ln/hard-backup.sh | 2 +-
tests/ls/color-clear-to-eol.sh | 2 +-
tests/ls/color-dtype-dir.sh | 10 +++++-----
tests/ls/m-option.sh | 2 +-
tests/ls/quote-align.sh | 2 +-
tests/ls/stat-dtype.sh | 5 ++---
tests/ls/time-style-diag.sh | 2 +-
tests/ls/x-option.sh | 2 +-
tests/misc/chcon.sh | 4 ++--
tests/misc/nohup.sh | 10 +++++-----
tests/misc/od-N.sh | 2 +-
tests/misc/readlink-fp-loop.sh | 4 ++--
tests/misc/shred-exact.sh | 6 +++---
tests/misc/sort-NaN-infloop.sh | 4 ++--
tests/misc/sort-compress.sh | 2 +-
tests/misc/sort-merge-fdlimit.sh | 4 ++--
tests/misc/tac-2-nonseekable.sh | 2 +-
tests/misc/tac-continue.sh | 2 +-
tests/misc/time-style.sh | 6 +++---
tests/mkdir/selinux.sh | 4 ++--
tests/mkdir/smack-no-root.sh | 4 ++--
tests/mv/backup-dir.sh | 2 +-
tests/mv/childproof.sh | 4 ++--
tests/mv/dir2dir.sh | 2 +-
tests/mv/part-symlink.sh | 4 ++--
tests/mv/update.sh | 4 ++--
tests/rm/dir-no-w.sh | 2 +-
tests/rm/dir-nonrecur.sh | 2 +-
tests/rm/inaccessible.sh | 2 +-
tests/rm/interactive-always.sh | 32 ++++++++++++++++----------------
tests/rm/interactive-once.sh | 26 ++++++++++++--------------
tests/rm/rm3.sh | 6 +++---
tests/rm/v-slash.sh | 2 +-
tests/sample-test | 2 +-
tests/touch/relative.sh | 2 +-
47 files changed, 109 insertions(+), 116 deletions(-)
diff --git a/tests/chown/deref.sh b/tests/chown/deref.sh
index 4c8628deaf..87c2027e03 100755
--- a/tests/chown/deref.sh
+++ b/tests/chown/deref.sh
@@ -29,7 +29,7 @@ set _ $(ls -ldo dangle); shift; user=$3
chown --dereference $user dangle 2> out1 && fail=1
sed 's/: [^:]*$//' out1 > out
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
chown: cannot dereference 'dangle'
EOF
diff --git a/tests/chown/preserve-root.sh b/tests/chown/preserve-root.sh
index 76d0a3fd01..d5c370ff2c 100755
--- a/tests/chown/preserve-root.sh
+++ b/tests/chown/preserve-root.sh
@@ -37,16 +37,16 @@ chmod -R --preserve-root u+r / >> out 2>&1 && fail=1
# With -RHh, --preserve-root should trigger nothing,
# since the symlink in question is not a command line argument.
# Contrary to the above commands, these two should succeed.
-echo '==== test -RHh' >> out
+echo '==== test -RHh' >> out || framework_failure_
chown -RHh --preserve-root $(id -u) d >> out 2>&1 || fail=1
chgrp -RHh --preserve-root $(id -g) d >> out 2>&1 || fail=1
# These must fail.
-echo '==== test -RLh' >> out
+echo '==== test -RLh' >> out || framework_failure_
chown -RLh --preserve-root $(id -u) d >> out 2>&1 && fail=1
chgrp -RLh --preserve-root $(id -g) d >> out 2>&1 && fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
chown: it is dangerous to operate recursively on '/'
chown: use --no-preserve-root to override this failsafe
chgrp: it is dangerous to operate recursively on '/'
diff --git a/tests/cp/backup-1.sh b/tests/cp/backup-1.sh
index 86d14e10f7..8f7a3d4146 100755
--- a/tests/cp/backup-1.sh
+++ b/tests/cp/backup-1.sh
@@ -23,7 +23,7 @@ suffix=.b
file=F
file_backup="$file$suffix"
-echo test > $file || fail=1
+echo test > $file || framework_failure_
# Specify both version control and suffix so the environment variables
# (possibly set by the user running these tests) aren't used.
diff --git a/tests/cp/src-base-dot.sh b/tests/cp/src-base-dot.sh
index dfa3acdf9f..7acd5de070 100755
--- a/tests/cp/src-base-dot.sh
+++ b/tests/cp/src-base-dot.sh
@@ -21,12 +21,8 @@ print_ver_ cp
mkdir x y || framework_failure_
-
cd y
cp --verbose -ab ../x/. . > out 2>&1 || fail=1
-cat <<\EOF > exp || fail=1
-EOF
-
-compare exp out || fail=1
+compare /dev/null out || fail=1
Exit $fail
diff --git a/tests/dd/skip-seek2.sh b/tests/dd/skip-seek2.sh
index 3250a3d358..ed242d87ac 100755
--- a/tests/dd/skip-seek2.sh
+++ b/tests/dd/skip-seek2.sh
@@ -21,14 +21,14 @@
print_ver_ dd
-echo LA:3456789abcdef > in || fail=1
+echo LA:3456789abcdef > in || framework_failure_
(dd bs=1 skip=3 count=0 && dd bs=5) < in > out 2> /dev/null || fail=1
case $(cat out) in
3456789abcdef) ;;
*) fail=1 ;;
esac
-echo LA:3456789abcdef > in || fail=1
+echo LA:3456789abcdef > in || framework_failure_
(dd bs=1 skip=3 count=0 && dd bs=5 count=2) < in > out 2> /dev/null || fail=1
case $(cat out) in
3456789abc) ;;
diff --git a/tests/dd/unblock-sync.sh b/tests/dd/unblock-sync.sh
index 0ae6442e2c..4c0786bfe5 100755
--- a/tests/dd/unblock-sync.sh
+++ b/tests/dd/unblock-sync.sh
@@ -23,7 +23,7 @@ printf 000100020003xx > in || framework_failure_
dd cbs=4 ibs=4 conv=unblock,sync < in > out 2> /dev/null || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
0001
0002
0003
diff --git a/tests/du/2g.sh b/tests/du/2g.sh
index e3045b3521..3a74d2f719 100755
--- a/tests/du/2g.sh
+++ b/tests/du/2g.sh
@@ -62,7 +62,7 @@ du -k $big > out1 || fail=1
rm -f $big
sed 's/^2[0-9][0-9][0-9][0-9][0-9][0-9] '$big'$/~2M/' out1 > out
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
~2M
EOF
diff --git a/tests/du/inacc-dest.sh b/tests/du/inacc-dest.sh
index 2d5439755a..f9144bad47 100755
--- a/tests/du/inacc-dest.sh
+++ b/tests/du/inacc-dest.sh
@@ -33,7 +33,7 @@ du > ../t 2>&1 && fail=1
# /proc support, nor native openat support.
sed 's/^[0-9][0-9]* //' ../t | sort -u > out
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
.
./a
./b
diff --git a/tests/du/long-sloop.sh b/tests/du/long-sloop.sh
index beb557dd6d..e761a65171 100755
--- a/tests/du/long-sloop.sh
+++ b/tests/du/long-sloop.sh
@@ -42,7 +42,7 @@ for i in $dir_list $(expr $n + 1); do
esac
i_minus_1=$i
done
-echo foo > $i
+echo foo > $i || framework_failure_
# If a system can handle this many symlinks in a file name,
# just skip this test.
@@ -63,9 +63,9 @@ too_many=$(sed 's/.*: //' err)
# With coreutils-5.94 we get the desired diagnostic:
# du: cannot access '1/s/s/s/.../s': Too many levels of symbolic links
du -L 1 > /dev/null 2> out1 && fail=1
-sed "s, .1/s/s/s/[/s]*',," out1 > out || fail=1
+sed "s, .1/s/s/s/[/s]*',," out1 > out || framework_failure_
-echo "du: cannot access: $too_many" > exp || fail=1
+echo "du: cannot access: $too_many" > exp || framework_failure_
compare exp out || fail=1
diff --git a/tests/du/one-file-system.sh b/tests/du/one-file-system.sh
index e21c90c3b6..7c6436a6df 100755
--- a/tests/du/one-file-system.sh
+++ b/tests/du/one-file-system.sh
@@ -28,8 +28,8 @@ ln -s "$other_partition_tmpdir/x" d || framework_failure_
# would not traverse into second and subsequent directories listed
# on the command line.
du -ax b y > t || fail=1
-sed 's/^[0-9][0-9]* //' t > out
-cat <<\EOF > exp || fail=1
+sed 's/^[0-9][0-9]* //' t > out || framework_failure_
+cat <<\EOF > exp || framework_failure_
b/c
b
y/z
@@ -41,16 +41,16 @@ compare exp out || fail=1
# "du -xL" reported a zero count for a file in a different file system,
# instead of ignoring it.
du -xL d > u || fail=1
-sed 's/^[0-9][0-9]* //' u > out1
-echo d > exp1 || fail=1
+sed 's/^[0-9][0-9]* //' u > out1 || framework_failure_
+echo d > exp1 || framework_failure_
compare exp1 out1 || fail=1
# With coreutils-8.15, "du -xs FILE" would print no output.
touch f
for opt in -x -xs; do
du $opt f > u || fail=1
- sed 's/^[0-9][0-9]* //' u > out2
- echo f > exp2 || fail=1
+ sed 's/^[0-9][0-9]* //' u > out2 || framework_failure_
+ echo f > exp2 || framework_failure_
compare exp2 out2 || fail=1
done
diff --git a/tests/fmt/goal-option.sh b/tests/fmt/goal-option.sh
index 1ebf714eaf..eda086b1fa 100755
--- a/tests/fmt/goal-option.sh
+++ b/tests/fmt/goal-option.sh
@@ -19,7 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ fmt
-cat <<\_EOF_ > base || fail=1
+cat <<\_EOF_ > base || framework_failure_
@command{fmt} prefers breaking lines at the end of a sentence, and tries to
avoid line breaks after the first word of a sentence or before the last word
@@ -36,7 +36,7 @@ _EOF_
fmt -g 60 -w 72 base > out || fail=1
-cat <<\_EOF_ > exp
+cat <<\_EOF_ > exp || framework_failure_
@command{fmt} prefers breaking lines at the end of a sentence,
and tries to avoid line breaks after the first word of a sentence
diff --git a/tests/install/strip-program.sh b/tests/install/strip-program.sh
index 028558edd0..516a48857c 100755
--- a/tests/install/strip-program.sh
+++ b/tests/install/strip-program.sh
@@ -28,8 +28,8 @@ EOF
chmod a+x b || framework_failure_
-echo abc > src || fail=1
-echo aBc > exp || fail=1
+echo abc > src || framework_failure_
+echo aBc > exp || framework_failure_
ginstall src dest -s --strip-program=./b || fail=1
compare exp dest || fail=1
diff --git a/tests/ln/hard-backup.sh b/tests/ln/hard-backup.sh
index a983292f44..53e5917608 100755
--- a/tests/ln/hard-backup.sh
+++ b/tests/ln/hard-backup.sh
@@ -23,7 +23,7 @@ touch f || framework_failure_
ln --backup f f 2> out && fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
ln: 'f' and 'f' are the same file
EOF
diff --git a/tests/ls/color-clear-to-eol.sh b/tests/ls/color-clear-to-eol.sh
index cf65455b3d..6c3dc6cda7 100755
--- a/tests/ls/color-clear-to-eol.sh
+++ b/tests/ls/color-clear-to-eol.sh
@@ -32,7 +32,7 @@ env TERM=xterm COLUMNS=80 LS_COLORS="*.foo=$color_code" TIME_STYLE=+T \
ls -og --color=always $long_name > out || fail=1
# Append a newline, to accommodate less-capable versions of sed.
-echo >> out || fail=1
+echo >> out || framework_failure_
sed 's/.*T //' out > k && mv k out
diff --git a/tests/ls/color-dtype-dir.sh b/tests/ls/color-dtype-dir.sh
index dc5f2db544..6a71bb9c7d 100755
--- a/tests/ls/color-dtype-dir.sh
+++ b/tests/ls/color-dtype-dir.sh
@@ -31,10 +31,10 @@ chmod o+t sticky || framework_failure_
TERM=xterm ls --color=always > out || fail=1
-cat -A out > o1 || fail=1
-mv o1 out || fail=1
+cat -A out > o1 || framework_failure_
+mv o1 out || framework_failure_
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
^[[0m^[[01;34md^[[0m$
^[[34;42mother-writable^[[0m$
out$
@@ -43,7 +43,7 @@ EOF
compare exp out || fail=1
-rm exp
+rm exp || framework_failure_
# Turn off colors for other-writable dirs and ensure
# we fall back to the color for standard directories.
@@ -52,7 +52,7 @@ LS_COLORS="ow=:" ls --color=always > out || fail=1
cat -A out > o1 || fail=1
mv o1 out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
^[[0m^[[01;34md^[[0m$
^[[01;34mother-writable^[[0m$
out$
diff --git a/tests/ls/m-option.sh b/tests/ls/m-option.sh
index b6e774393a..275ab43974 100755
--- a/tests/ls/m-option.sh
+++ b/tests/ls/m-option.sh
@@ -29,7 +29,7 @@ ls -w2 -m a b > out || fail=1
# Before coreutils-5.1.1, the following would produce leading white space.
# All of the sed business is because the sizes are not portable.
ls -sm a b | sed 's/^[0-9]/0/;s/, [0-9][0-9]* b/, 12 b/' >> out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
a,
b
0 a, 12 b
diff --git a/tests/ls/quote-align.sh b/tests/ls/quote-align.sh
index f9768fe305..03cc5660fd 100755
--- a/tests/ls/quote-align.sh
+++ b/tests/ls/quote-align.sh
@@ -52,7 +52,7 @@ for opt in '-w0 -x' '-x' '-og' '-1' '-m' '-C'; do
done
# Append a newline, to accommodate less-capable versions of sed.
-echo >> out || fail=1
+echo >> out || framework_failure_
# Strip possible varying portion of long format
sed -e 's/.*T //' -e '/^total/d' out > k && mv k out
diff --git a/tests/ls/stat-dtype.sh b/tests/ls/stat-dtype.sh
index dbd0e31ed9..550856cd42 100755
--- a/tests/ls/stat-dtype.sh
+++ b/tests/ls/stat-dtype.sh
@@ -42,19 +42,18 @@ chmod 600 e || framework_failure_
ls --file-type d > out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
s@
EOF
compare exp out || fail=1
-rm -f out exp
# Check for the ls -CF misaligned-columns bug:
ls -CF e > out || fail=1
# coreutils-6.0 would print two spaces after the first slash,
# rather than the appropriate TAB.
-printf 'a2345/\tb/\n' > exp || fail=1
+printf 'a2345/\tb/\n' > exp || framework_failure_
compare exp out || fail=1
diff --git a/tests/ls/time-style-diag.sh b/tests/ls/time-style-diag.sh
index 00c04ddb65..2c67021d36 100755
--- a/tests/ls/time-style-diag.sh
+++ b/tests/ls/time-style-diag.sh
@@ -21,7 +21,7 @@ print_ver_ ls
returns_ 2 ls -l --time-style=XX > out 2> err || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
ls: invalid argument 'XX' for 'time style'
Valid arguments are:
- [posix-]full-iso
diff --git a/tests/ls/x-option.sh b/tests/ls/x-option.sh
index e4ee8bb529..224d2b3784 100755
--- a/tests/ls/x-option.sh
+++ b/tests/ls/x-option.sh
@@ -27,7 +27,7 @@ touch subdir/a || framework_failure_
# Coreutils 6.8 and 6.9 would output this in the wrong order.
ls -x subdir > out || fail=1
ls -rx subdir >> out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
a b
b a
EOF
diff --git a/tests/misc/chcon.sh b/tests/misc/chcon.sh
index c9c42f0fdd..13a72a04e2 100755
--- a/tests/misc/chcon.sh
+++ b/tests/misc/chcon.sh
@@ -57,7 +57,7 @@ for i in -u$u1 -r$r1 -t$t1; do
stat --printf="f|$i|"'%C\n' f >> out || fail=1
done
-cat < exp || fail=1
+cat < exp || framework_failure_
f|$ctx
g|$ctx
f|--user=$u2|$u2:$r1:$t1:$range
@@ -72,7 +72,7 @@ EOF
compare exp out || fail=1
chcon --verbose -u$u1 f > out || fail=1
-echo "changing security context of 'f'" > exp
+echo "changing security context of 'f'" > exp || framework_failure_
compare exp out || fail=1
Exit $fail
diff --git a/tests/misc/nohup.sh b/tests/misc/nohup.sh
index eae1cd07c1..f02045bfd1 100755
--- a/tests/misc/nohup.sh
+++ b/tests/misc/nohup.sh
@@ -30,7 +30,7 @@ if test -t 1; then
echo 'nohup: ignoring input and appending output to 'nohup.out'\'
else
echo 'nohup: appending output to 'nohup.out'\'
- fi >exp || fail=1
+ fi >exp || framework_failure_
else
# Here it should not even exist.
test -f nohup.out && fail=1
@@ -38,9 +38,9 @@ else
echo 'nohup: ignoring input' >exp
else
rm -f exp
- fi || fail=1
+ fi || framework_failure_
fi
-echo 'stderr' >> exp || fail=1
+echo 'stderr' >> exp || framework_failure_
compare exp err || fail=1
rm -f nohup.out err exp
@@ -88,7 +88,7 @@ if test -t 1; then
compare /dev/null nohup.out || fail=1
fi
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
nohup: appending output to 'nohup.out'
nohup: cannot run command 'no-such-command': No such file or directory
EOF
@@ -108,7 +108,7 @@ if test -t 1; then
compare /dev/null nohup.out || fail=1
fi
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
nohup: appending output to 'nohup.out'
nohup: cannot run command './k': Permission denied
EOF
diff --git a/tests/misc/od-N.sh b/tests/misc/od-N.sh
index f05b1c7ca6..fcf073022b 100755
--- a/tests/misc/od-N.sh
+++ b/tests/misc/od-N.sh
@@ -23,7 +23,7 @@ echo abcdefg > in || framework_failure_
(od -An -N3 -c; od -An -N3 -c) < in > out
-cat < exp || fail=1
+cat < exp || framework_failure_
a b c
d e f
EOF
diff --git a/tests/misc/readlink-fp-loop.sh b/tests/misc/readlink-fp-loop.sh
index 1f259ea69d..86632c529a 100755
--- a/tests/misc/readlink-fp-loop.sh
+++ b/tests/misc/readlink-fp-loop.sh
@@ -34,7 +34,7 @@ ln -s ../s/2 d/1 || framework_failure_
# With coreutils-6.9, this would fail with ELOOP.
readlink -v -e p/1 > out || fail=1
# readlink -e d/2 > exp || fail=1
-echo "$cwd/d/2" > exp || fail=1
+echo "$cwd/d/2" > exp || framework_failure_
compare exp out || fail=1
# Construct a real loop and make sure readlink still detects it.
@@ -56,7 +56,7 @@ ln -nsf ../p/7 d/6 || framework_failure_
ln -nsf ../p/8 d/7 || framework_failure_
echo x > d/8 || framework_failure_
readlink -v -e p/1 > out || fail=1
-echo "$cwd/d/8" > exp || fail=1
+echo "$cwd/d/8" > exp || framework_failure_
compare exp out || fail=1
# A trivial loop
diff --git a/tests/misc/shred-exact.sh b/tests/misc/shred-exact.sh
index 14c1f6d804..23b7fdb0e0 100755
--- a/tests/misc/shred-exact.sh
+++ b/tests/misc/shred-exact.sh
@@ -22,9 +22,9 @@ print_ver_ shred
# make sure that neither --exact nor --zero gobbles a command line argument
for opt in --exact --zero; do
- echo a > a || fail=1
- echo bb > b || fail=1
- echo ccc > c || fail=1
+ echo a > a || framework_failure_
+ echo bb > b || framework_failure_
+ echo ccc > c || framework_failure_
shred --remove $opt a b || fail=1
test -f a && fail=1
diff --git a/tests/misc/sort-NaN-infloop.sh b/tests/misc/sort-NaN-infloop.sh
index 6e27112125..e2115ac132 100755
--- a/tests/misc/sort-NaN-infloop.sh
+++ b/tests/misc/sort-NaN-infloop.sh
@@ -19,8 +19,8 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ sort
-echo nan > F || fail=1
-printf 'nan\nnan\n' > exp || fail=1
+echo nan > F || framework_failure_
+printf 'nan\nnan\n' > exp || framework_failure_
timeout 10 sort -g -m F F > out || fail=1
compare exp out || fail=1
diff --git a/tests/misc/sort-compress.sh b/tests/misc/sort-compress.sh
index 82b585f7ee..91fad43293 100755
--- a/tests/misc/sort-compress.sh
+++ b/tests/misc/sort-compress.sh
@@ -28,7 +28,7 @@ sort -S 1k in > out || fail=1
compare exp out || fail=1
# Create our own gzip program that will be used as the default
-cat < gzip || fail=1
+cat < gzip || framework_failure_
#!$SHELL
tr 41 14
touch ok
diff --git a/tests/misc/sort-merge-fdlimit.sh b/tests/misc/sort-merge-fdlimit.sh
index 71eb5ec446..d5b43d3e56 100755
--- a/tests/misc/sort-merge-fdlimit.sh
+++ b/tests/misc/sort-merge-fdlimit.sh
@@ -61,8 +61,8 @@ done
# This test finds the bug only with shells that do not close FDs on
# exec, and will miss the bug (if present) on other shells, but it's
# not easy to fix this without running afoul of the OpenBSD-like sh bugs.
-(seq 6 && echo 6) >exp || fail=1
-echo 6 >out || fail=1
+(seq 6 && echo 6) >exp || framework_failure_
+echo 6 >out || framework_failure_
(exec 3<&- 4<&- 5<&- 6 out 2> err || fail=1
-echo x > exp || fail=1
+echo x > exp || framework_failure_
compare exp out || fail=1
compare /dev/null err || fail=1
diff --git a/tests/misc/tac-continue.sh b/tests/misc/tac-continue.sh
index 44cd98bd36..dca6b6c359 100755
--- a/tests/misc/tac-continue.sh
+++ b/tests/misc/tac-continue.sh
@@ -63,7 +63,7 @@ mkfifo_or_skip_ fifo
seq 1000 > fifo & pid=$!
TMPDIR=$FULL_PARTITION_TMPDIR tac fifo in >out 2>err && fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
5
4
3
diff --git a/tests/misc/time-style.sh b/tests/misc/time-style.sh
index ec1d4ab67d..1a88dc66d0 100755
--- a/tests/misc/time-style.sh
+++ b/tests/misc/time-style.sh
@@ -42,7 +42,7 @@ sed 's/[^ ]* //' duout >dued || framework_failure_
sed 's/[^ ]* *[^ ]* *[^ ]* *[^ ]* *//' lsout >lsed || framework_failure_
sed '/^$/d' prout >pred || framework_failure_
-cat <<\EOF > duexp || fail=1
+cat <<\EOF > duexp || framework_failure_
1970-07-08 09:10:11.000000000 +0000 a
1970-07-08 09:10 a
1970-07-08 a
@@ -65,7 +65,7 @@ cat <<\EOF > duexp || fail=1
%bJul%bJul a
EOF
-cat <<\EOF > lsexp || fail=1
+cat <<\EOF > lsexp || framework_failure_
1970-07-08 09:10:11.000000000 +0000 a
1970-07-08 09:10 a
1970-07-08 a
@@ -92,7 +92,7 @@ Jul 8 1970 a
%bJul%bJul a
EOF
-cat <<\EOF > prexp || fail=1
+cat <<\EOF > prexp || framework_failure_
+1970-07-08 09:10:11 +0000 (UTC) a Page 1
hello
+%bJul%bJul a Page 1
diff --git a/tests/mkdir/selinux.sh b/tests/mkdir/selinux.sh
index aeb119ed1d..37eb5aa2cf 100755
--- a/tests/mkdir/selinux.sh
+++ b/tests/mkdir/selinux.sh
@@ -34,7 +34,7 @@ for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
# Running via "env" ensures we run our program and not the built-in.
env -- $cmd_w_arg --context=$c 2> out && fail=1
set $cmd_w_arg; cmd=$1
- echo "$cmd: $msg" > exp || fail=1
+ echo "$cmd: $msg" > exp || framework_failure_
# Some systems fail with ENOTSUP, EINVAL, ENOENT, or even
# "Unknown system error", or "Function not implemented".
@@ -48,7 +48,7 @@ for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
-e 's/ Function not implemented$//' \
-e 's/ Unsupported attribute value$//' \
-e 's/ Unknown error .*$//' \
- -e 's/ No such file or directory$//' out > k || fail=1
+ -e 's/ No such file or directory$//' out > k || framework_failure_
mv k out || fail=1
compare exp out || fail=1
done
diff --git a/tests/mkdir/smack-no-root.sh b/tests/mkdir/smack-no-root.sh
index eebd59f062..2407bf21f3 100755
--- a/tests/mkdir/smack-no-root.sh
+++ b/tests/mkdir/smack-no-root.sh
@@ -29,9 +29,9 @@ msg="failed to set default file creation context to '$c':"
for cmd in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
$cmd --context="$c" 2> out && fail=1
set $cmd
- echo "$1: $msg" > exp || fail=1
+ echo "$1: $msg" > exp || framework_failure_
- sed -e 's/ Operation not permitted$//' out > k || fail=1
+ sed -e 's/ Operation not permitted$//' out > k || framework_failure_
mv k out || fail=1
compare exp out || fail=1
done
diff --git a/tests/mv/backup-dir.sh b/tests/mv/backup-dir.sh
index 497384e717..7263afe0f3 100755
--- a/tests/mv/backup-dir.sh
+++ b/tests/mv/backup-dir.sh
@@ -25,7 +25,7 @@ touch X Y || framework_failure_
# Before coreutils-6.2, the " (backup: 'B.~1~')" suffix was not printed.
mv --verbose --backup=numbered -T A B > out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
renamed 'A' -> 'B' (backup: 'B.~1~')
EOF
diff --git a/tests/mv/childproof.sh b/tests/mv/childproof.sh
index 9f9e198535..3de5ec6f9a 100755
--- a/tests/mv/childproof.sh
+++ b/tests/mv/childproof.sh
@@ -72,8 +72,8 @@ test -f c/g || fail=1
# Test ln -f.
rm -f a/f b/f c/f
-echo a > a/f || fail=1
-echo b > b/f || fail=1
+echo a > a/f || framework_failure_
+echo b > b/f || framework_failure_
returns_ 1 ln -f a/f b/f c 2> /dev/null || fail=1
# a/f and c/f must be linked
test $(stat --format %i a/f) = $(stat --format %i c/f) || fail=1
diff --git a/tests/mv/dir2dir.sh b/tests/mv/dir2dir.sh
index be106912fb..de97abb085 100755
--- a/tests/mv/dir2dir.sh
+++ b/tests/mv/dir2dir.sh
@@ -33,7 +33,7 @@ mv b/t a 2> out && fail=1
sed 's/: File exists/: Directory not empty/'o1;mv o1 out
sed 's/: Device or resource busy/: Directory not empty/'o1;mv o1 out
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
mv: cannot move 'b/t' to 'a/t': Directory not empty
EOF
diff --git a/tests/mv/part-symlink.sh b/tests/mv/part-symlink.sh
index efeadd0674..55c6cfa49e 100755
--- a/tests/mv/part-symlink.sh
+++ b/tests/mv/part-symlink.sh
@@ -73,7 +73,7 @@ for copy in cp mv; do
case "$args" in *loc_sl*) slink=$loc_sl ;; esac
case "$args" in *rem_sl*) slink=$rem_sl ;; esac
- echo $contents > "$reg_abs" || fail=1
+ echo $contents > "$reg_abs" || framework_failure_
ln -nsf "$reg_abs" $slink || fail=1
actual_args=$(echo $args|sed 's,^,$,;s/ / $/')
actual_args=$(eval echo $actual_args)
@@ -151,7 +151,7 @@ done
test $fail = 1 &&
{ (exit 1); exit; }
-cat <<\EOF > expected
+cat <<\EOF > expected || framework_failure_
1 cp loc_reg rem_sl
[cp: 'loc_reg' and 'rem_sl' are the same file]
(loc_reg) (rem_sl -> dir/loc_reg)
diff --git a/tests/mv/update.sh b/tests/mv/update.sh
index e1f4a7a9ef..219d76c8ed 100755
--- a/tests/mv/update.sh
+++ b/tests/mv/update.sh
@@ -42,9 +42,9 @@ test -f new && fail=1
case "$(cat old)" in new) ;; *) fail=1 ;; esac
# Restore initial conditions.
-echo old > old || fail=1
+echo old > old || framework_failure_
touch -d yesterday old || fail=1
-echo new > new || fail=1
+echo new > new || framework_failure_
# This will actually perform the copy.
cp --update new old || fail=1
diff --git a/tests/rm/dir-no-w.sh b/tests/rm/dir-no-w.sh
index 23124d0973..8afc99440d 100755
--- a/tests/rm/dir-no-w.sh
+++ b/tests/rm/dir-no-w.sh
@@ -25,7 +25,7 @@ mkdir --mode=0500 unwritable-dir || framework_failure_
# For rm from coreutils-5.0.1, this would prompt.
rm ---presume-input-tty unwritable-dir < /dev/null > out-t 2>&1 && fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
rm: cannot remove 'unwritable-dir': Is a directory
EOF
diff --git a/tests/rm/dir-nonrecur.sh b/tests/rm/dir-nonrecur.sh
index a99184eac8..e9bda6ef1a 100755
--- a/tests/rm/dir-nonrecur.sh
+++ b/tests/rm/dir-nonrecur.sh
@@ -24,7 +24,7 @@ mkdir d || framework_failure_
rm d 2> out && fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
rm: cannot remove 'd': Is a directory
EOF
diff --git a/tests/rm/inaccessible.sh b/tests/rm/inaccessible.sh
index dfb7c4db71..8d8469fe83 100755
--- a/tests/rm/inaccessible.sh
+++ b/tests/rm/inaccessible.sh
@@ -34,7 +34,7 @@ set +x
test -d "$p/abs1" && fail=1
test -d "$p/abs2" && fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
rm: cannot remove 'rel': Permission denied
EOF
diff --git a/tests/rm/interactive-always.sh b/tests/rm/interactive-always.sh
index 6ed07db81e..fee62dfb2e 100755
--- a/tests/rm/interactive-always.sh
+++ b/tests/rm/interactive-always.sh
@@ -30,43 +30,41 @@ rm -f out err || framework_failure_
# The prompt has a trailing space, and no newline, so an extra
# 'echo .' is inserted after each rm to make it obvious what was asked.
-echo 'no WHEN' > err || fail=1
+echo 'no WHEN' > err || framework_failure_
rm -R --interactive file1-* < in >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file1-1 || fail=1
test -f file1-2 && fail=1
-echo 'WHEN=never' >> err || fail=1
+echo 'WHEN=never' >> err || framework_failure_
rm -R --interactive=never file2-* < in >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file2-1 && fail=1
test -f file2-2 && fail=1
-echo 'WHEN=once' >> err || fail=1
+echo 'WHEN=once' >> err || framework_failure_
rm -R --interactive=once file3-* < in >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file3-1 || fail=1
test -f file3-2 || fail=1
-echo 'WHEN=always' >> err || fail=1
+echo 'WHEN=always' >> err || framework_failure_
rm -R --interactive=always file4-* < in >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file4-1 || fail=1
test -f file4-2 && fail=1
-echo '-f overrides --interactive' >> err || fail=1
+echo '-f overrides --interactive' >> err || framework_failure_
rm -R --interactive=once -f file1-* < in >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file1-1 && fail=1
-echo '--interactive overrides -f' >> err || fail=1
+echo '--interactive overrides -f' >> err || framework_failure_
rm -R -f --interactive=once file4-* < in >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file4-1 || fail=1
-cat <<\EOF > expout || fail=1
-EOF
-sed 's/@remove_empty/rm: remove regular empty file/g' <<\EOF > experr || fail=1
+cat <<\EOF > experr.t || framework_failure_
no WHEN
@remove_empty 'file1-1'? @remove_empty 'file1-2'? .
WHEN=never
@@ -80,8 +78,10 @@ WHEN=always
--interactive overrides -f
rm: remove 1 argument recursively? .
EOF
+sed 's/@remove_empty/rm: remove regular empty file/g' < experr.t > experr ||
+ framework_failure_
-compare expout out || fail=1
+compare /dev/null out || fail=1
compare experr err || fail=1
Exit $fail
diff --git a/tests/rm/interactive-once.sh b/tests/rm/interactive-once.sh
index 583121324e..36ef2cdc9f 100755
--- a/tests/rm/interactive-once.sh
+++ b/tests/rm/interactive-once.sh
@@ -32,7 +32,7 @@ rm -f out err || framework_failure_
echo 'one file, no recursion' > err || framework_failure_
rm -I file1-* < in-n >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file1-1 && fail=1
echo 'one file, read only, answer no' >> err || framework_failure_
@@ -44,7 +44,7 @@ if ls /dev/stdin >/dev/null 2>&1; then
write_prot_msg1="rm: remove write-protected regular empty file 'file1-1'? "
fi
rm ---presume-input-tty -I file1-* < in-n >> out 2>> err || fail=1
- echo . >> err || fail=1
+ echo . >> err || framework_failure_
if test "$write_prot_msg1"; then
test -f file1-1 || fail=1
fi
@@ -54,14 +54,14 @@ fi
echo 'three files, no recursion' >> err || framework_failure_
rm -I file2-* < in-n >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file2-1 && fail=1
test -f file2-2 && fail=1
test -f file2-3 && fail=1
echo 'four files, no recursion, answer no' >> err || framework_failure_
rm -I file3-* < in-n >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file3-1 || fail=1
test -f file3-2 || fail=1
test -f file3-3 || fail=1
@@ -69,7 +69,7 @@ test -f file3-4 || fail=1
echo 'four files, no recursion, answer yes' >> err || framework_failure_
rm -I file3-* < in-y >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -f file3-1 && fail=1
test -f file3-2 && fail=1
test -f file3-3 && fail=1
@@ -86,7 +86,7 @@ if ls /dev/stdin >/dev/null 2>&1; then
write_prot_msg2="rm: remove write-protected regular file 'file3-4'? "
fi
cat in-y in-n | rm ---presume-input-tty -I file3-* >> out 2>> err || fail=1
- echo . >> err || fail=1
+ echo . >> err || framework_failure_
test -f file3-1 && fail=1
test -f file3-2 && fail=1
test -f file3-3 && fail=1
@@ -99,29 +99,27 @@ fi
echo 'one file, recursion, answer no' >> err || framework_failure_
rm -I -R dir1-* < in-n >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -d dir1-1 || fail=1
echo 'one file, recursion, answer yes' >> err || framework_failure_
rm -I -R dir1-* < in-y >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -d dir1-1 && fail=1
echo 'multiple files, recursion, answer no' >> err || framework_failure_
rm -I -R dir2-* < in-n >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -d dir2-1 || fail=1
test -d dir2-2 || fail=1
echo 'multiple files, recursion, answer yes' >> err || framework_failure_
rm -I -R dir2-* < in-y >> out 2>> err || fail=1
-echo . >> err || fail=1
+echo . >> err || framework_failure_
test -d dir2-1 && fail=1
test -d dir2-2 && fail=1
-cat <<\EOF > expout || fail=1
-EOF
-cat < experr || fail=1
+cat < experr || framework_failure_
one file, no recursion
.
one file, read only, answer no
@@ -144,7 +142,7 @@ multiple files, recursion, answer yes
rm: remove 2 arguments recursively? .
EOF
-compare expout out || fail=1
+compare /dev/null out || fail=1
compare experr err || fail=1
Exit $fail
diff --git a/tests/rm/rm3.sh b/tests/rm/rm3.sh
index 5f29e44711..77490cef59 100755
--- a/tests/rm/rm3.sh
+++ b/tests/rm/rm3.sh
@@ -31,7 +31,7 @@ chmod u-w fu du empty-u || framework_failure_
cd ..
-cat < in
+cat < in || framework_failure_
y
y
y
@@ -52,9 +52,9 @@ rm -ir z < in > out 2>&1 || fail=1
# This avoids a bug whereby some vendor-provided (Tru64) versions of sed
# would mistakenly tack a newline onto the end of the output.
tr '?' '\n' < out | head --bytes=-1 | sed 's/^ //' |sort > o2
-mv o2 out
+mv o2 out || framework_failure_
-sort < exp || fail=1
+sort < exp || framework_failure_
rm: descend into directory 'z'
rm: remove regular empty file 'z/empty'
rm: remove write-protected regular file 'z/fu'
diff --git a/tests/rm/v-slash.sh b/tests/rm/v-slash.sh
index 531227898a..975f92e76e 100755
--- a/tests/rm/v-slash.sh
+++ b/tests/rm/v-slash.sh
@@ -24,7 +24,7 @@ touch a/x || framework_failure_
rm --verbose -r a/// > out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
removed 'a/x'
removed directory 'a/'
EOF
diff --git a/tests/sample-test b/tests/sample-test
index 27fdc3b665..80415492c9 100644
--- a/tests/sample-test
+++ b/tests/sample-test
@@ -27,7 +27,7 @@ print_ver_ FIXME
# FIXME: . "$abs_srcdir/tests/other-fs-tmpdir"
FIXME > out || fail=1
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
FIXME
EOF
diff --git a/tests/touch/relative.sh b/tests/touch/relative.sh
index a2925b2489..a83300c77f 100755
--- a/tests/touch/relative.sh
+++ b/tests/touch/relative.sh
@@ -29,7 +29,7 @@ touch --ref f --date='-5 days' f || fail=1
TZ=UTC0 ls -og --time-style=+%Y-%m-%d f > out.1 || fail
sed 's/ f$//;s/.* //' out.1 > out
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
2004-01-11
EOF
--
2.47.2