mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
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.
This commit is contained in:
1 parent
a19ff5d817
commit
2686052667
47 files changed
+109
-116
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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 '/'
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
@@ -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) ;;
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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$
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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 <<EOF > exp || fail=1
|
||||
cat <<EOF > 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
|
||||
+5
-5
@@ -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
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ echo abcdefg > in || framework_failure_
|
||||
|
||||
|
||||
(od -An -N3 -c; od -An -N3 -c) < in > out
|
||||
cat <<EOF > exp || fail=1
|
||||
cat <<EOF > exp || framework_failure_
|
||||
a b c
|
||||
d e f
|
||||
EOF
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <<EOF > gzip || fail=1
|
||||
cat <<EOF > gzip || framework_failure_
|
||||
#!$SHELL
|
||||
tr 41 14
|
||||
touch ok
|
||||
|
||||
@@ -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</dev/null 7<&6 8<&6 9<&6 &&
|
||||
ulimit -n 10 &&
|
||||
sort -n -m --batch-size=7 -o out out in/1 in/2 in/3 in/4 in/5 out
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
print_ver_ tac
|
||||
|
||||
echo x | tac - - > 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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ mv b/t a 2> out && fail=1
|
||||
sed 's/: File exists/: Directory not empty/'<out>o1;mv o1 out
|
||||
sed 's/: Device or resource busy/: Directory not empty/'<out>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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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 <<EOF > experr || fail=1
|
||||
cat <<EOF > 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
|
||||
+3
-3
@@ -31,7 +31,7 @@ chmod u-w fu du empty-u || framework_failure_
|
||||
cd ..
|
||||
|
||||
|
||||
cat <<EOF > in
|
||||
cat <<EOF > 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 <<EOF > exp || fail=1
|
||||
sort <<EOF > exp || framework_failure_
|
||||
rm: descend into directory 'z'
|
||||
rm: remove regular empty file 'z/empty'
|
||||
rm: remove write-protected regular file 'z/fu'
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user