* tests/misc/read-errors.sh: Add a new test. * tests/misc/date-f.sh: Remove unneeded test. * tests/misc/dircolors.sh: Likewise. * tests/local.mk: Reference new test, and dereference removed ones. --- tests/local.mk | 3 +- tests/misc/date-f.sh | 29 ------------- tests/misc/dircolors.sh | 28 ------------- tests/misc/read-errors.sh | 85 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 59 deletions(-) delete mode 100755 tests/misc/date-f.sh delete mode 100755 tests/misc/dircolors.sh create mode 100755 tests/misc/read-errors.sh
diff --git a/tests/local.mk b/tests/local.mk index a0c024905..fb5c9c4a5 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -173,6 +173,7 @@ all_tests = \ tests/cp/link-heap.sh \ tests/cp/no-ctx.sh \ tests/misc/tty-eof.pl \ + tests/misc/read-errors.sh \ tests/tail-2/inotify-hash-abuse.sh \ tests/tail-2/inotify-hash-abuse2.sh \ tests/tail-2/F-vs-missing.sh \ @@ -302,11 +303,9 @@ all_tests = \ tests/misc/csplit-io-err.sh \ tests/misc/csplit-suppress-matched.pl \ tests/misc/date-debug.sh \ - tests/misc/date-f.sh \ tests/misc/date-sec.sh \ tests/misc/date-tz.sh \ tests/misc/dircolors.pl \ - tests/misc/dircolors.sh \ tests/misc/dirname.pl \ tests/misc/env-null.sh \ tests/misc/env-S.pl \ diff --git a/tests/misc/date-f.sh b/tests/misc/date-f.sh deleted file mode 100755 index ebbb95652..000000000 --- a/tests/misc/date-f.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Verify -f processing - -# Copyright (C) 2023 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. - -. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ date - -# Make sure date fails when it can't read input -# (the current directory in this case) -if ! cat . >/dev/null; then - # can't read() directories - returns_ 1 date -f . || fail=1 -fi - -Exit $fail diff --git a/tests/misc/dircolors.sh b/tests/misc/dircolors.sh deleted file mode 100755 index 9e2ae2890..000000000 --- a/tests/misc/dircolors.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2023 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. - -. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ dircolors - -# Make sure dircolors fails when it can't read input -# (the current directory in this case) -if ! cat . >/dev/null; then - # can't read() directories - returns_ 1 dircolors . || fail=1 -fi - -Exit $fail diff --git a/tests/misc/read-errors.sh b/tests/misc/read-errors.sh new file mode 100755 index 000000000..216b1d039 --- /dev/null +++ b/tests/misc/read-errors.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# Make sure all of these programs diagnose read errors + +# Copyright (C) 2023 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src + +! cat . >/dev/null 2>&1 || skip_ "Need unreadable directories" + +echo "\ +basenc --base32 F +basenc -d --base64 F +cksum -a sysv F +cksum -a bsd F +cksum -a crc F +cksum -a md5 F +cksum -a sha1 F +cksum -a sha224 F +cksum -a sha256 F +cksum -a sha384 F +cksum -a sha512 F +cksum -a blake2b F +cksum -a sm3 F +comm F F +csplit F 1 +cut -b1 F +date -f F +dd if=F +dircolors F +expand F +fmt F +fold F +head F +join F F +nl F +numfmt < F +od F +paste F +pr F +ptx F +shuf F +sort F +split F +sum F +tac F +tail F +tee < F +tr 1 1 < F +tsort F +unexpand F +uniq F +wc F +" | sort -k 1b,1 > all_readers || framework_failure_ + +printf '%s\n' $built_programs | +sort -k 1b,1 > built_programs || framework_failure_ + +built_readers=$(join all_readers built_programs) || framework_failure_ + +echo "$built_readers" | +while read command; do + command=$(echo "$command" | sed 's/F/./g') + eval $command >/dev/null && + { + touch command_failed + echo "$command: should have failed" >&2 + } +done + +test -f command_failed && fail=1 + +Exit $fail -- 2.26.2