From c50de48f2ed0b9476c3389fd07a85a5e8be798e2 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Tue, 31 Aug 2021 08:53:23 -0400 Subject: New upstream version 4.8 --- testsuite/8bit.sh | 2 +- testsuite/8to7.sh | 2 +- testsuite/Coreutils.pm | 2 +- testsuite/CuSkip.pm | 2 +- testsuite/CuTmpdir.pm | 2 +- testsuite/badenc.sh | 2 +- testsuite/binary.sh | 2 +- testsuite/bsd-wrapper.sh | 2 +- testsuite/bug32082.sh | 2 +- testsuite/bug32271-1.sh | 2 +- testsuite/bug32271-2.sh | 5 +- testsuite/cmd-R.sh | 2 +- testsuite/cmd-l.sh | 2 +- testsuite/colon-with-no-label.sh | 2 +- testsuite/command-endings.sh | 2 +- testsuite/comment-n.sh | 2 +- testsuite/compile-errors.sh | 2 +- testsuite/compile-tests.sh | 2 +- testsuite/convert-number.sh | 2 +- testsuite/dc.sh | 2 +- testsuite/debug.pl | 2 +- testsuite/distrib.sh | 2 +- testsuite/envvar-check | 2 +- testsuite/eval.sh | 2 +- testsuite/execute-tests.sh | 2 +- testsuite/follow-symlinks-stdin.sh | 2 +- testsuite/follow-symlinks.sh | 2 +- testsuite/get-mb-cur-max.c | 2 +- testsuite/help-version.sh | 2 +- testsuite/help.sh | 2 +- testsuite/in-place-hyphen.sh | 2 +- testsuite/in-place-suffix-backup.sh | 2 +- testsuite/init.sh | 517 ++++++++++++++++++++---------------- testsuite/inplace-hold.sh | 2 +- testsuite/inplace-selinux.sh | 7 +- testsuite/invalid-mb-seq-UMR.sh | 2 +- testsuite/local.mk | 5 +- testsuite/mac-mf.sh | 2 +- testsuite/madding.sh | 2 +- testsuite/mb-bad-delim.sh | 2 +- testsuite/mb-charclass-non-utf8.sh | 2 +- testsuite/mb-match-slash.sh | 2 +- testsuite/mb-y-translate.sh | 2 +- testsuite/misc.pl | 2 +- testsuite/missing-filename.sh | 2 +- testsuite/newjis.sh | 2 +- testsuite/newline-dfa-bug.sh | 5 +- testsuite/no-perl | 6 + testsuite/normalize-text.sh | 2 +- testsuite/nulldata.sh | 2 +- testsuite/obinary.sh | 2 +- testsuite/panic-tests.sh | 2 +- testsuite/posix-char-class.sh | 2 +- testsuite/posix-mode-ERE.sh | 2 +- testsuite/posix-mode-N.sh | 2 +- testsuite/posix-mode-addr.sh | 2 +- testsuite/posix-mode-bad-ref.sh | 2 +- testsuite/posix-mode-s.sh | 2 +- testsuite/range-overlap.sh | 2 +- testsuite/recursive-escape-c.sh | 2 +- testsuite/regex-errors.sh | 2 +- testsuite/regex-max-int.sh | 2 +- testsuite/sandbox.sh | 2 +- testsuite/stdin-prog.sh | 2 +- testsuite/stdin.sh | 2 +- testsuite/subst-mb-incomplete.sh | 2 +- testsuite/subst-options.sh | 2 +- testsuite/subst-replacement.sh | 2 +- testsuite/temp-file-cleanup.sh | 2 +- testsuite/test-mbrtowc.c | 2 +- testsuite/title-case.sh | 6 +- testsuite/unbuffered.sh | 2 +- testsuite/uniq.sh | 2 +- testsuite/utf8-ru.sh | 2 +- testsuite/xemacs.good | 2 +- testsuite/xemacs.inp | 2 +- testsuite/xemacs.sh | 2 +- 77 files changed, 387 insertions(+), 304 deletions(-) create mode 100644 testsuite/no-perl (limited to 'testsuite') diff --git a/testsuite/8bit.sh b/testsuite/8bit.sh index 35a594c..09373c3 100755 --- a/testsuite/8bit.sh +++ b/testsuite/8bit.sh @@ -2,7 +2,7 @@ # Adapted from sed's old "8bit" test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/8to7.sh b/testsuite/8to7.sh index 8b0e014..be1d463 100755 --- a/testsuite/8to7.sh +++ b/testsuite/8to7.sh @@ -2,7 +2,7 @@ # Runner for old '8to7' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/Coreutils.pm b/testsuite/Coreutils.pm index 4e7a00a..a0c8c59 100644 --- a/testsuite/Coreutils.pm +++ b/testsuite/Coreutils.pm @@ -1,7 +1,7 @@ package Coreutils; # This is a testing framework. -# Copyright (C) 1998-2018 Free Software Foundation, Inc. +# Copyright (C) 1998-2020 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 diff --git a/testsuite/CuSkip.pm b/testsuite/CuSkip.pm index a2aad28..090abba 100644 --- a/testsuite/CuSkip.pm +++ b/testsuite/CuSkip.pm @@ -1,7 +1,7 @@ package CuSkip; # Skip a test: emit diag to log and to stderr, and exit 77 -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2020 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 diff --git a/testsuite/CuTmpdir.pm b/testsuite/CuTmpdir.pm index eee8a8d..015a92d 100644 --- a/testsuite/CuTmpdir.pm +++ b/testsuite/CuTmpdir.pm @@ -1,7 +1,7 @@ package CuTmpdir; # create, then chdir into a temporary sub-directory -# Copyright (C) 2007-2018 Free Software Foundation, Inc. +# Copyright (C) 2007-2020 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 diff --git a/testsuite/badenc.sh b/testsuite/badenc.sh index 2dd80ab..c3819c3 100755 --- a/testsuite/badenc.sh +++ b/testsuite/badenc.sh @@ -2,7 +2,7 @@ # Test runner for old 'badenc' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/binary.sh b/testsuite/binary.sh index 8ee7ec9..4ef503d 100755 --- a/testsuite/binary.sh +++ b/testsuite/binary.sh @@ -3,7 +3,7 @@ # Test runner for the binary-operation version of dc.sed. # Adapted from old-style 'binary.sed' test. -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/bsd-wrapper.sh b/testsuite/bsd-wrapper.sh index 557deb7..de7cc59 100644 --- a/testsuite/bsd-wrapper.sh +++ b/testsuite/bsd-wrapper.sh @@ -2,7 +2,7 @@ # Test runner for the old bsd tests -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/bug32082.sh b/testsuite/bug32082.sh index d5d4e92..51356bc 100755 --- a/testsuite/bug32082.sh +++ b/testsuite/bug32082.sh @@ -3,7 +3,7 @@ # Before sed 4.6 these would result in "Invalid read size of 4" reported # by valgrind from execute.c:992 -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 diff --git a/testsuite/bug32271-1.sh b/testsuite/bug32271-1.sh index df2e308..b8ad229 100755 --- a/testsuite/bug32271-1.sh +++ b/testsuite/bug32271-1.sh @@ -3,7 +3,7 @@ # Before sed 4.6 these would result in an extraneous NUL at end of lines. # -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 diff --git a/testsuite/bug32271-2.sh b/testsuite/bug32271-2.sh index d6e50ce..723d973 100755 --- a/testsuite/bug32271-2.sh +++ b/testsuite/bug32271-2.sh @@ -4,7 +4,7 @@ # uninitialised value(s)" and "Invalid read of size 1" # by valgrind from regexp.c:286 -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 @@ -64,6 +64,9 @@ valgrind --quiet --error-exitcode=1 \ grep 'valgrind: .*Assertion.*failed' err-no-posix > /dev/null \ && skip_ 'you seem to have a buggy version of valgrind' +# Remove any valgrind-added diagnostics from stderr. +sed -i '/^==/d' err + compare exp out || fail=1 compare /dev/null err || fail=1 diff --git a/testsuite/cmd-R.sh b/testsuite/cmd-R.sh index 4f4eb99..d0c2627 100644 --- a/testsuite/cmd-R.sh +++ b/testsuite/cmd-R.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test 'R' command -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/cmd-l.sh b/testsuite/cmd-l.sh index f5207e9..17f35e3 100755 --- a/testsuite/cmd-l.sh +++ b/testsuite/cmd-l.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test 'l' command with different widths -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/colon-with-no-label.sh b/testsuite/colon-with-no-label.sh index 915a192..3b6ae53 100755 --- a/testsuite/colon-with-no-label.sh +++ b/testsuite/colon-with-no-label.sh @@ -1,7 +1,7 @@ #!/bin/sh # Verify that a ":" command with no label is now rejected. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/command-endings.sh b/testsuite/command-endings.sh index 1c257e9..03e2617 100644 --- a/testsuite/command-endings.sh +++ b/testsuite/command-endings.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test command separators and endings -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/comment-n.sh b/testsuite/comment-n.sh index ad94c63..c2e05dd 100644 --- a/testsuite/comment-n.sh +++ b/testsuite/comment-n.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test the '#n' silent mode (activated by first line comment) -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/compile-errors.sh b/testsuite/compile-errors.sh index 7773adb..2b6236a 100644 --- a/testsuite/compile-errors.sh +++ b/testsuite/compile-errors.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test compilation errors -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/compile-tests.sh b/testsuite/compile-tests.sh index 75d5b6d..cb7d49d 100644 --- a/testsuite/compile-tests.sh +++ b/testsuite/compile-tests.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test compilation less-common cases -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/convert-number.sh b/testsuite/convert-number.sh index a485f47..c6b4449 100755 --- a/testsuite/convert-number.sh +++ b/testsuite/convert-number.sh @@ -2,7 +2,7 @@ # Test number conversion from escape sequences \xNN \oNNN \dNNN # (compile.c:convert_number()) -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/dc.sh b/testsuite/dc.sh index 96c000c..0e1e9b1 100755 --- a/testsuite/dc.sh +++ b/testsuite/dc.sh @@ -2,7 +2,7 @@ # Test runner for dc.sed -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/debug.pl b/testsuite/debug.pl index 661c5ed..49fd0b4 100644 --- a/testsuite/debug.pl +++ b/testsuite/debug.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # Test the --debug feature -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 diff --git a/testsuite/distrib.sh b/testsuite/distrib.sh index 700c983..db81505 100644 --- a/testsuite/distrib.sh +++ b/testsuite/distrib.sh @@ -2,7 +2,7 @@ # Test runner for the old 'distrib' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/envvar-check b/testsuite/envvar-check index 708013e..fcf7742 100644 --- a/testsuite/envvar-check +++ b/testsuite/envvar-check @@ -1,7 +1,7 @@ # -*- sh -*- # Check environment variables for sane values while testing. -# Copyright (C) 2000-2018 Free Software Foundation, Inc. +# Copyright (C) 2000-2020 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 diff --git a/testsuite/eval.sh b/testsuite/eval.sh index 33395dc..3dfca73 100755 --- a/testsuite/eval.sh +++ b/testsuite/eval.sh @@ -2,7 +2,7 @@ # Test runner for old 'eval' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/execute-tests.sh b/testsuite/execute-tests.sh index 191a518..cb6bc52 100644 --- a/testsuite/execute-tests.sh +++ b/testsuite/execute-tests.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test execution less-common cases -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/follow-symlinks-stdin.sh b/testsuite/follow-symlinks-stdin.sh index 788729c..b284a2a 100755 --- a/testsuite/follow-symlinks-stdin.sh +++ b/testsuite/follow-symlinks-stdin.sh @@ -1,7 +1,7 @@ #!/bin/sh # Verify that --follow-symlinks does not break reading from stdin. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/follow-symlinks.sh b/testsuite/follow-symlinks.sh index 6abc822..1342ac5 100644 --- a/testsuite/follow-symlinks.sh +++ b/testsuite/follow-symlinks.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test --follow-symlinks option -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/get-mb-cur-max.c b/testsuite/get-mb-cur-max.c index 6c34a88..a2ffac6 100644 --- a/testsuite/get-mb-cur-max.c +++ b/testsuite/get-mb-cur-max.c @@ -1,5 +1,5 @@ /* Auxiliary program to detect support for a locale. - Copyright 2010-2018 Free Software Foundation, Inc. + Copyright 2010-2020 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 diff --git a/testsuite/help-version.sh b/testsuite/help-version.sh index d053cf1..dcf105a 100755 --- a/testsuite/help-version.sh +++ b/testsuite/help-version.sh @@ -2,7 +2,7 @@ # Make sure all of these programs work properly # when invoked with --help or --version. -# Copyright (C) 2000-2018 Free Software Foundation, Inc. +# Copyright (C) 2000-2020 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 diff --git a/testsuite/help.sh b/testsuite/help.sh index bddaf08..087068c 100644 --- a/testsuite/help.sh +++ b/testsuite/help.sh @@ -2,7 +2,7 @@ # Test --help screen -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/in-place-hyphen.sh b/testsuite/in-place-hyphen.sh index 8a97ba3..bc8cadf 100755 --- a/testsuite/in-place-hyphen.sh +++ b/testsuite/in-place-hyphen.sh @@ -1,7 +1,7 @@ #!/bin/sh # Verify that "-" is treated as a file name with --in-place. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/in-place-suffix-backup.sh b/testsuite/in-place-suffix-backup.sh index bc7defc..2629522 100644 --- a/testsuite/in-place-suffix-backup.sh +++ b/testsuite/in-place-suffix-backup.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test -i/--inplace with backup suffixes -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/init.sh b/testsuite/init.sh index 93d14f5..b4a5944 100644 --- a/testsuite/init.sh +++ b/testsuite/init.sh @@ -1,6 +1,6 @@ # source this file; set up for tests -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2020 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 @@ -60,6 +60,9 @@ # 4. Finally # $ exit +# ============================================================================= +# Elementary diagnostics + ME_=`expr "./$0" : '.*/\(.*\)$'` # Prepare PATH_SEPARATOR. @@ -109,26 +112,8 @@ skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; } framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } -# This is used to simplify checking of the return value -# which is useful when ensuring a command fails as desired. -# I.e., just doing `command ... &&fail=1` will not catch -# a segfault in command for example. With this helper you -# instead check an explicit exit code like -# returns_ 1 command ... || fail -returns_ () { - # Disable tracing so it doesn't interfere with stderr of the wrapped command - { set +x; } 2>/dev/null - - local exp_exit="$1" - shift - "$@" - test $? -eq $exp_exit && ret_=0 || ret_=1 - - if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then - set -x - fi - { return $ret_; } 2>/dev/null -} +# ============================================================================= +# Ensure the shell supports modern syntax. # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE @@ -144,6 +129,8 @@ else fi # We require $(...) support unconditionally. +# We require that the printf built-in work correctly regarding octal escapes; +# this eliminates /bin/sh on AIX 7.2. # We require non-surprising "local" semantics (this eliminates dash). # This takes the admittedly draconian step of eliminating dash, because the # assignment tab=$(printf '\t') works fine, yet preceding it with "local " @@ -173,6 +160,12 @@ fi # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 +LC_ALL=en_US.UTF-8 printf "\\351" 2>/dev/null \ + | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ + || exit 1 +printf "\\351" 2>/dev/null \ + | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ + || exit 1 f_local_() { local v=1; }; f_local_ || exit 1 f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_ score_=10 @@ -255,6 +248,9 @@ else fi fi +# ============================================================================= +# Ensure the shell behaves reasonably. + # If this is bash, turn off all aliases. test -n "$BASH_VERSION" && unalias -a @@ -265,99 +261,177 @@ test -n "$BASH_VERSION" && unalias -a # widespread than that for hyphen-containing function names. test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases -# Enable glibc's malloc-perturbing option. -# This is useful for exposing code that depends on the fact that -# malloc-related functions often return memory that is mostly zeroed. -# If you have the time and cycles, use valgrind to do an even better job. -: ${MALLOC_PERTURB_=87} -export MALLOC_PERTURB_ +# ============================================================================= +# Creating a temporary directory (needed by the core test framework) -# This is a stub function that is run upon trap (upon regular exit and -# interrupt). Override it with a per-test function, e.g., to unmount -# a partition, or to undo any other global state changes. -cleanup_ () { :; } +# Create a temporary directory, much like mktemp -d does. +# Written by Jim Meyering. +# +# Usage: mktempd_ /tmp phoey.XXXXXXXXXX +# +# First, try to use the mktemp program. +# Failing that, we'll roll our own mktemp-like function: +# - try to get random bytes from /dev/urandom +# - failing that, generate output from a combination of quickly-varying +# sources and gzip. Ignore non-varying gzip header, and extract +# "random" bits from there. +# - given those bits, map to file-name bytes using tr, and try to create +# the desired directory. +# - make only $MAX_TRIES_ attempts -# Emit a header similar to that from diff -u; Print the simulated "diff" -# command so that the order of arguments is clear. Don't bother with @@ lines. -emit_diff_u_header_ () +# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. +rand_bytes_ () { - printf '%s\n' "diff -u $*" \ - "--- $1 1970-01-01" \ - "+++ $2 1970-01-01" + n_=$1 + + # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? + # But if they have openssl, they probably have mktemp, too. + + chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + dev_rand_=/dev/urandom + if test -r "$dev_rand_"; then + # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. + dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ + | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ + return + fi + + n_plus_50_=`expr $n_ + 50` + cmds_='date; date +%N; free; who -a; w; ps auxww; ps -ef' + data_=` (eval "$cmds_") 2>&1 | gzip ` + + # Ensure that $data_ has length at least 50+$n_ + while :; do + len_=`echo "$data_"|wc -c` + test $n_plus_50_ -le $len_ && break; + data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` + done + + echo "$data_" \ + | dd bs=1 skip=50 count=$n_ 2>/dev/null \ + | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ } -# Arrange not to let diff or cmp operate on /dev/null, -# since on some systems (at least OSF/1 5.1), that doesn't work. -# When there are not two arguments, or no argument is /dev/null, return 2. -# When one argument is /dev/null and the other is not empty, -# cat the nonempty file to stderr and return 1. -# Otherwise, return 0. -compare_dev_null_ () +mktempd_ () { - test $# = 2 || return 2 + case $# in + 2);; + *) fail_ "Usage: mktempd_ DIR TEMPLATE";; + esac - if test "x$1" = x/dev/null; then - test -s "$2" || return 0 - emit_diff_u_header_ "$@"; sed 's/^/+/' "$2" - return 1 - fi + destdir_=$1 + template_=$2 - if test "x$2" = x/dev/null; then - test -s "$1" || return 0 - emit_diff_u_header_ "$@"; sed 's/^/-/' "$1" - return 1 - fi + MAX_TRIES_=4 - return 2 + # Disallow any trailing slash on specified destdir: + # it would subvert the post-mktemp "case"-based destdir test. + case $destdir_ in + / | //) destdir_slash_=$destdir;; + */) fail_ "invalid destination dir: remove trailing slash(es)";; + *) destdir_slash_=$destdir_/;; + esac + + case $template_ in + *XXXX) ;; + *) fail_ \ + "invalid template: $template_ (must have a suffix of at least 4 X's)";; + esac + + # First, try to use mktemp. + d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` && + + # The resulting name must be in the specified directory. + case $d in "$destdir_slash_"*) :;; *) false;; esac && + + # It must have created the directory. + test -d "$d" && + + # It must have 0700 permissions. Handle sticky "S" bits. + perms=`ls -dgo "$d" 2>/dev/null` && + case $perms in drwx--[-S]---*) :;; *) false;; esac && { + echo "$d" + return + } + + # If we reach this point, we'll have to create a directory manually. + + # Get a copy of the template without its suffix of X's. + base_template_=`echo "$template_"|sed 's/XX*$//'` + + # Calculate how many X's we've just removed. + template_length_=`echo "$template_" | wc -c` + nx_=`echo "$base_template_" | wc -c` + nx_=`expr $template_length_ - $nx_` + + err_= + i_=1 + while :; do + X_=`rand_bytes_ $nx_` + candidate_dir_="$destdir_slash_$base_template_$X_" + err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ + && { echo "$candidate_dir_"; return; } + test $MAX_TRIES_ -le $i_ && break; + i_=`expr $i_ + 1` + done + fail_ "$err_" } -for diff_opt_ in -u -U3 -c '' no; do - test "$diff_opt_" != no && - diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` && - break -done -if test "$diff_opt_" != no; then - if test -z "$diff_out_"; then - compare_ () { diff $diff_opt_ "$@"; } - else - compare_ () - { - # If no differences were found, AIX and HP-UX 'diff' produce output - # like "No differences encountered". Hide this output. - diff $diff_opt_ "$@" > diff.out - diff_status_=$? - test $diff_status_ -eq 0 || cat diff.out || diff_status_=2 - rm -f diff.out || diff_status_=2 - return $diff_status_ - } - fi -elif cmp -s /dev/null /dev/null 2>/dev/null; then - compare_ () { cmp -s "$@"; } -else - compare_ () { cmp "$@"; } -fi +# ============================================================================= +# Core test framework -# Usage: compare EXPECTED ACTUAL -# -# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more. -# Otherwise, propagate $? to caller: any diffs have already been printed. -compare () +# An arbitrary prefix to help distinguish test directories. +testdir_prefix_ () { printf gt; } + +# Set up the environment for the test to run in. +setup_ () { - # This looks like it can be factored to use a simple "case $?" - # after unchecked compare_dev_null_ invocation, but that would - # fail in a "set -e" environment. - if compare_dev_null_ "$@"; then - return 0 - else - case $? in - 1) return 1;; - *) compare_ "$@";; - esac + if test "$VERBOSE" = yes; then + # Test whether set -x may cause the selected shell to corrupt an + # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh + # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5. + # If enabling verbose output this way would cause trouble, simply + # issue a warning and refrain. + if $gl_set_x_corrupts_stderr_; then + warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" + else + set -x + fi fi + + initial_cwd_=$PWD + + # Create and enter the temporary directory. + pfx_=`testdir_prefix_` + test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ + || fail_ "failed to create temporary directory in $initial_cwd_" + cd "$test_dir_" || fail_ "failed to cd to temporary directory" + # Set variables srcdir, builddir, for the convenience of the test. + case $srcdir in + /* | ?:*) ;; + *) srcdir="../$srcdir" ;; + esac + builddir=".." + export srcdir builddir + + # As autoconf-generated configure scripts do, ensure that IFS + # is defined initially, so that saving and restoring $IFS works. + gl_init_sh_nl_=' +' + IFS=" "" $gl_init_sh_nl_" + + # This trap statement, along with a trap on 0 below, ensure that the + # temporary directory, $test_dir_, is removed upon exit as well as + # upon receipt of any of the listed signals. + for sig_ in 1 2 3 13 15; do + eval "trap 'Exit $(expr $sig_ + 128)' $sig_" + done } -# An arbitrary prefix to help distinguish test directories. -testdir_prefix_ () { printf gt; } +# This is a stub function that is run upon trap (upon regular exit and +# interrupt). Override it with a per-test function, e.g., to unmount +# a partition, or to undo any other global state changes. +cleanup_ () { :; } # Run the user-overridable cleanup_ function, remove the temporary # directory and exit with the incoming value of $?. @@ -377,6 +451,9 @@ remove_tmp_ () exit $__st } +# ============================================================================= +# Prepending directories to PATH + # Given a directory name, DIR, if every entry in it that matches *.exe # contains only the specified bytes (see the case stmt below), then print # a space-separated list of those names and return 0. Otherwise, don't @@ -458,160 +535,148 @@ path_prepend_ () export PATH } -setup_ () -{ - if test "$VERBOSE" = yes; then - # Test whether set -x may cause the selected shell to corrupt an - # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh - # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5. - # If enabling verbose output this way would cause trouble, simply - # issue a warning and refrain. - if $gl_set_x_corrupts_stderr_; then - warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" - else - set -x - fi - fi +# ============================================================================= +# Convenience environment variables for the tests - initial_cwd_=$PWD +# ----------------------------------------------------------------------------- - pfx_=`testdir_prefix_` - test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ - || fail_ "failed to create temporary directory in $initial_cwd_" - cd "$test_dir_" || fail_ "failed to cd to temporary directory" +# Enable glibc's malloc-perturbing option. +# This is useful for exposing code that depends on the fact that +# malloc-related functions often return memory that is mostly zeroed. +# If you have the time and cycles, use valgrind to do an even better job. +: ${MALLOC_PERTURB_=87} +export MALLOC_PERTURB_ - # As autoconf-generated configure scripts do, ensure that IFS - # is defined initially, so that saving and restoring $IFS works. - gl_init_sh_nl_=' -' - IFS=" "" $gl_init_sh_nl_" +# ----------------------------------------------------------------------------- - # This trap statement, along with a trap on 0 below, ensure that the - # temporary directory, $test_dir_, is removed upon exit as well as - # upon receipt of any of the listed signals. - for sig_ in 1 2 3 13 15; do - eval "trap 'Exit $(expr $sig_ + 128)' $sig_" - done -} +# The interpreter for Bourne-shell scripts. +# No special standards compatibility requirements. +# Some environments, such as Android, don't have /bin/sh. +if test -f /bin/sh$EXEEXT; then + BOURNE_SHELL=/bin/sh +else + BOURNE_SHELL=sh +fi -# Create a temporary directory, much like mktemp -d does. -# Written by Jim Meyering. -# -# Usage: mktempd_ /tmp phoey.XXXXXXXXXX -# -# First, try to use the mktemp program. -# Failing that, we'll roll our own mktemp-like function: -# - try to get random bytes from /dev/urandom -# - failing that, generate output from a combination of quickly-varying -# sources and gzip. Ignore non-varying gzip header, and extract -# "random" bits from there. -# - given those bits, map to file-name bytes using tr, and try to create -# the desired directory. -# - make only $MAX_TRIES_ attempts +# ============================================================================= +# Convenience functions for the tests -# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. -rand_bytes_ () -{ - n_=$1 +# ----------------------------------------------------------------------------- +# Return value checking - # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? - # But if they have openssl, they probably have mktemp, too. +# This is used to simplify checking of the return value +# which is useful when ensuring a command fails as desired. +# I.e., just doing `command ... &&fail=1` will not catch +# a segfault in command for example. With this helper you +# instead check an explicit exit code like +# returns_ 1 command ... || fail +returns_ () { + # Disable tracing so it doesn't interfere with stderr of the wrapped command + { set +x; } 2>/dev/null - chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - dev_rand_=/dev/urandom - if test -r "$dev_rand_"; then - # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. - dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ - return - fi + local exp_exit="$1" + shift + "$@" + test $? -eq $exp_exit && ret_=0 || ret_=1 - n_plus_50_=`expr $n_ + 50` - cmds_='date; date +%N; free; who -a; w; ps auxww; ps -ef' - data_=` (eval "$cmds_") 2>&1 | gzip ` + if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then + set -x + fi + { return $ret_; } 2>/dev/null +} - # Ensure that $data_ has length at least 50+$n_ - while :; do - len_=`echo "$data_"|wc -c` - test $n_plus_50_ -le $len_ && break; - data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` - done +# ----------------------------------------------------------------------------- +# Text file comparison - echo "$data_" \ - | dd bs=1 skip=50 count=$n_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ +# Emit a header similar to that from diff -u; Print the simulated "diff" +# command so that the order of arguments is clear. Don't bother with @@ lines. +emit_diff_u_header_ () +{ + printf '%s\n' "diff -u $*" \ + "--- $1 1970-01-01" \ + "+++ $2 1970-01-01" } -mktempd_ () +# Arrange not to let diff or cmp operate on /dev/null, +# since on some systems (at least OSF/1 5.1), that doesn't work. +# When there are not two arguments, or no argument is /dev/null, return 2. +# When one argument is /dev/null and the other is not empty, +# cat the nonempty file to stderr and return 1. +# Otherwise, return 0. +compare_dev_null_ () { - case $# in - 2);; - *) fail_ "Usage: mktempd_ DIR TEMPLATE";; - esac - - destdir_=$1 - template_=$2 - - MAX_TRIES_=4 - - # Disallow any trailing slash on specified destdir: - # it would subvert the post-mktemp "case"-based destdir test. - case $destdir_ in - / | //) destdir_slash_=$destdir;; - */) fail_ "invalid destination dir: remove trailing slash(es)";; - *) destdir_slash_=$destdir_/;; - esac - - case $template_ in - *XXXX) ;; - *) fail_ \ - "invalid template: $template_ (must have a suffix of at least 4 X's)";; - esac - - # First, try to use mktemp. - d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` && - - # The resulting name must be in the specified directory. - case $d in "$destdir_slash_"*) :;; *) false;; esac && - - # It must have created the directory. - test -d "$d" && + test $# = 2 || return 2 - # It must have 0700 permissions. Handle sticky "S" bits. - perms=`ls -dgo "$d" 2>/dev/null` && - case $perms in drwx--[-S]---*) :;; *) false;; esac && { - echo "$d" - return - } + if test "x$1" = x/dev/null; then + test -s "$2" || return 0 + emit_diff_u_header_ "$@"; sed 's/^/+/' "$2" + return 1 + fi - # If we reach this point, we'll have to create a directory manually. + if test "x$2" = x/dev/null; then + test -s "$1" || return 0 + emit_diff_u_header_ "$@"; sed 's/^/-/' "$1" + return 1 + fi - # Get a copy of the template without its suffix of X's. - base_template_=`echo "$template_"|sed 's/XX*$//'` + return 2 +} - # Calculate how many X's we've just removed. - template_length_=`echo "$template_" | wc -c` - nx_=`echo "$base_template_" | wc -c` - nx_=`expr $template_length_ - $nx_` +for diff_opt_ in -u -U3 -c '' no; do + test "$diff_opt_" != no && + diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` && + break +done +if test "$diff_opt_" != no; then + if test -z "$diff_out_"; then + compare_ () { diff $diff_opt_ "$@"; } + else + compare_ () + { + # If no differences were found, AIX and HP-UX 'diff' produce output + # like "No differences encountered". Hide this output. + diff $diff_opt_ "$@" > diff.out + diff_status_=$? + test $diff_status_ -eq 0 || cat diff.out || diff_status_=2 + rm -f diff.out || diff_status_=2 + return $diff_status_ + } + fi +elif cmp -s /dev/null /dev/null 2>/dev/null; then + compare_ () { cmp -s "$@"; } +else + compare_ () { cmp "$@"; } +fi - err_= - i_=1 - while :; do - X_=`rand_bytes_ $nx_` - candidate_dir_="$destdir_slash_$base_template_$X_" - err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ - && { echo "$candidate_dir_"; return; } - test $MAX_TRIES_ -le $i_ && break; - i_=`expr $i_ + 1` - done - fail_ "$err_" +# Usage: compare EXPECTED ACTUAL +# +# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more. +# Otherwise, propagate $? to caller: any diffs have already been printed. +compare () +{ + # This looks like it can be factored to use a simple "case $?" + # after unchecked compare_dev_null_ invocation, but that would + # fail in a "set -e" environment. + if compare_dev_null_ "$@"; then + return 0 + else + case $? in + 1) return 1;; + *) compare_ "$@";; + esac + fi } +# ----------------------------------------------------------------------------- + # If you want to override the testdir_prefix_ function, # or to add more utility functions, use this file. test -f "$srcdir/init.cfg" \ && . "$srcdir/init.cfg" +# ============================================================================= +# Set up the environment for the test to run in. + setup_ "$@" # This trap is here, rather than in the setup_ function, because some # shells run the exit trap at shell function exit, rather than script exit. diff --git a/testsuite/inplace-hold.sh b/testsuite/inplace-hold.sh index 1bc293c..95525d6 100644 --- a/testsuite/inplace-hold.sh +++ b/testsuite/inplace-hold.sh @@ -2,7 +2,7 @@ # Test runner for old 'inplace-hold' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/inplace-selinux.sh b/testsuite/inplace-selinux.sh index 783c3de..f10fedf 100755 --- a/testsuite/inplace-selinux.sh +++ b/testsuite/inplace-selinux.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 @@ -18,6 +18,11 @@ print_ver_ sed require_selinux_ +sed --version | grep -q "with SELinux" \ + || skip_ "sed built without SELinux support" +sed --version | grep -q "^SELinux is enabled" \ + || skip_ "sed reports SELinux is disabled on this system" + touch a || framework_failure_ chcon -u system_u a || skip_ "chcon doesn't work" chcon -u user_u a || skip_ "chcon doesn't work" diff --git a/testsuite/invalid-mb-seq-UMR.sh b/testsuite/invalid-mb-seq-UMR.sh index 196db65..0edbc3c 100755 --- a/testsuite/invalid-mb-seq-UMR.sh +++ b/testsuite/invalid-mb-seq-UMR.sh @@ -2,7 +2,7 @@ # Inserting an invalid multibyte sequence could lead to # reading uninitialized memory. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/local.mk b/testsuite/local.mk index 43623bf..2b3bf86 100644 --- a/testsuite/local.mk +++ b/testsuite/local.mk @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 @@ -20,7 +20,7 @@ TEST_EXTENSIONS = .sh .pl if HAVE_PERL TESTSUITE_PERL = $(PERL) else -TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl +TESTSUITE_PERL = $(SHELL) $(srcdir)/testsuite/no-perl endif # Options passed to the perl invocations running the perl test scripts. @@ -199,6 +199,7 @@ EXTRA_DIST += \ testsuite/madding.good \ testsuite/madding.inp \ testsuite/madding.sed \ + testsuite/no-perl \ testsuite/uniq.good \ testsuite/uniq.inp \ testsuite/uniq.sed \ diff --git a/testsuite/mac-mf.sh b/testsuite/mac-mf.sh index d91b223..f909965 100755 --- a/testsuite/mac-mf.sh +++ b/testsuite/mac-mf.sh @@ -2,7 +2,7 @@ # Runner for old 'mac-mf' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/madding.sh b/testsuite/madding.sh index b2ea96f..c67af8d 100755 --- a/testsuite/madding.sh +++ b/testsuite/madding.sh @@ -2,7 +2,7 @@ # Runner for old 'madding' test (long lines) -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/mb-bad-delim.sh b/testsuite/mb-bad-delim.sh index 9ef16b5..c7735a1 100755 --- a/testsuite/mb-bad-delim.sh +++ b/testsuite/mb-bad-delim.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test 's' and 'y' non-slash delimiters in multibyte locales -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/mb-charclass-non-utf8.sh b/testsuite/mb-charclass-non-utf8.sh index 7bf8951..023ad18 100755 --- a/testsuite/mb-charclass-non-utf8.sh +++ b/testsuite/mb-charclass-non-utf8.sh @@ -4,7 +4,7 @@ # a single-byte character, or the second byte of a multibyte # character. -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/mb-match-slash.sh b/testsuite/mb-match-slash.sh index c824a2e..f2e69fd 100755 --- a/testsuite/mb-match-slash.sh +++ b/testsuite/mb-match-slash.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test slash following an incomplete multibyte character -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/mb-y-translate.sh b/testsuite/mb-y-translate.sh index 02238ec..8257235 100755 --- a/testsuite/mb-y-translate.sh +++ b/testsuite/mb-y-translate.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test multibyte y/// translations -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/misc.pl b/testsuite/misc.pl index 3fa5b84..7bc92f6 100644 --- a/testsuite/misc.pl +++ b/testsuite/misc.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # Test misc. -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/missing-filename.sh b/testsuite/missing-filename.sh index 704bc67..6bb0884 100755 --- a/testsuite/missing-filename.sh +++ b/testsuite/missing-filename.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test r/R/w/W commands without a file name. -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 diff --git a/testsuite/newjis.sh b/testsuite/newjis.sh index 51ed78e..e50fe23 100755 --- a/testsuite/newjis.sh +++ b/testsuite/newjis.sh @@ -2,7 +2,7 @@ # Test runner for newjis -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/newline-dfa-bug.sh b/testsuite/newline-dfa-bug.sh index af31ce5..05e2a3b 100755 --- a/testsuite/newline-dfa-bug.sh +++ b/testsuite/newline-dfa-bug.sh @@ -2,7 +2,7 @@ # sed may access to uninitialized memory if transit to 15th dfa state # with newline. This bug affected sed version 4.3. -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 @@ -32,6 +32,9 @@ valgrind --quiet --error-exitcode=1 \ grep 'valgrind: .*Assertion.*failed' err > /dev/null \ && skip_ 'you seem to have a buggy version of valgrind' +# Remove any valgrind-added diagnostics from stderr. +sed -i '/^==/d' err + compare exp out || fail=1 compare /dev/null err || fail=1 diff --git a/testsuite/no-perl b/testsuite/no-perl new file mode 100644 index 0000000..19cfcfb --- /dev/null +++ b/testsuite/no-perl @@ -0,0 +1,6 @@ +#!/bin/sh +# Perl is not available, the test should be considered skipped. +# FD 9 should have been opened by the test suite harness, pointing +# to the original stderr (usually, the user's terminal). +echo "test skipped: no usable version of Perl found" >&9 +exit 77 diff --git a/testsuite/normalize-text.sh b/testsuite/normalize-text.sh index 71b03bf..f9fe3f8 100644 --- a/testsuite/normalize-text.sh +++ b/testsuite/normalize-text.sh @@ -4,7 +4,7 @@ # \dNNN \xNN \oNNN - tested in 'convert-number.sh' # character-classes in POSIX mode - tested in 'posix-char-class.sh' -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/nulldata.sh b/testsuite/nulldata.sh index a8a0114..c23dc0a 100755 --- a/testsuite/nulldata.sh +++ b/testsuite/nulldata.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test -z/--null-data option -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/obinary.sh b/testsuite/obinary.sh index 78bffb5..0086d1c 100755 --- a/testsuite/obinary.sh +++ b/testsuite/obinary.sh @@ -2,7 +2,7 @@ # Test CR/LF behaviour on platforms which support O_BINARY file mode # (i.e. differentiates between text and binary files). -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 diff --git a/testsuite/panic-tests.sh b/testsuite/panic-tests.sh index 76146f9..29de75e 100644 --- a/testsuite/panic-tests.sh +++ b/testsuite/panic-tests.sh @@ -1,7 +1,7 @@ #!/bin/sh # Exercise some panic stops -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/posix-char-class.sh b/testsuite/posix-char-class.sh index ecbda07..df6821d 100644 --- a/testsuite/posix-char-class.sh +++ b/testsuite/posix-char-class.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test character-class definitions in POSIX mode. -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/posix-mode-ERE.sh b/testsuite/posix-mode-ERE.sh index 223593c..a43de0f 100644 --- a/testsuite/posix-mode-ERE.sh +++ b/testsuite/posix-mode-ERE.sh @@ -1,7 +1,7 @@ #!/bin/sh # Ensure extended regular expressions work in posix mode -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/posix-mode-N.sh b/testsuite/posix-mode-N.sh index 344ec19..2aae1a4 100755 --- a/testsuite/posix-mode-N.sh +++ b/testsuite/posix-mode-N.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test 'N' command with/without posix conformity -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/posix-mode-addr.sh b/testsuite/posix-mode-addr.sh index 1ba5fc7..99ab534 100644 --- a/testsuite/posix-mode-addr.sh +++ b/testsuite/posix-mode-addr.sh @@ -1,7 +1,7 @@ #!/bin/sh # Ensure GNU address extensions are rejected in posix mode -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/posix-mode-bad-ref.sh b/testsuite/posix-mode-bad-ref.sh index f933f79..80183c5 100755 --- a/testsuite/posix-mode-bad-ref.sh +++ b/testsuite/posix-mode-bad-ref.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test non-posix-conforming gnu extensions when using --posix. -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/posix-mode-s.sh b/testsuite/posix-mode-s.sh index 33ad92b..4bd8e07 100644 --- a/testsuite/posix-mode-s.sh +++ b/testsuite/posix-mode-s.sh @@ -1,7 +1,7 @@ #!/bin/sh # Ensure GNU extensions are rejected in posix mode -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/range-overlap.sh b/testsuite/range-overlap.sh index ddcd08f..98345ec 100755 --- a/testsuite/range-overlap.sh +++ b/testsuite/range-overlap.sh @@ -2,7 +2,7 @@ # Verify that even with overlapping ranges of line numbers, # only the selected lines are affected. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/recursive-escape-c.sh b/testsuite/recursive-escape-c.sh index 41bbced..c7df9b0 100644 --- a/testsuite/recursive-escape-c.sh +++ b/testsuite/recursive-escape-c.sh @@ -1,7 +1,7 @@ #!/bin/sh # test \c escaping -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/regex-errors.sh b/testsuite/regex-errors.sh index 454f7c0..ca0afa5 100644 --- a/testsuite/regex-errors.sh +++ b/testsuite/regex-errors.sh @@ -1,7 +1,7 @@ #!/bin/sh # Exercise regex_compile errors -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/regex-max-int.sh b/testsuite/regex-max-int.sh index fcea466..e105788 100755 --- a/testsuite/regex-max-int.sh +++ b/testsuite/regex-max-int.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test regex on input buffers larger than 2GB -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018-2020 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 diff --git a/testsuite/sandbox.sh b/testsuite/sandbox.sh index cd5e7c9..02a2773 100755 --- a/testsuite/sandbox.sh +++ b/testsuite/sandbox.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test --sandbox mode -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/stdin-prog.sh b/testsuite/stdin-prog.sh index 6a7167c..a7c2c16 100644 --- a/testsuite/stdin-prog.sh +++ b/testsuite/stdin-prog.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test program file from STDIN -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/stdin.sh b/testsuite/stdin.sh index 71c17d2..4bad7a2 100755 --- a/testsuite/stdin.sh +++ b/testsuite/stdin.sh @@ -2,7 +2,7 @@ # Test runner for old 'stdin' test -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/subst-mb-incomplete.sh b/testsuite/subst-mb-incomplete.sh index 5045e2d..8453a71 100755 --- a/testsuite/subst-mb-incomplete.sh +++ b/testsuite/subst-mb-incomplete.sh @@ -3,7 +3,7 @@ # performing a substitution with a replacement string containing an # incomplete multi-byte character. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/subst-options.sh b/testsuite/subst-options.sh index bc206aa..f5b323e 100644 --- a/testsuite/subst-options.sh +++ b/testsuite/subst-options.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test Substitute options (for code-coverage purposes as well) -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/subst-replacement.sh b/testsuite/subst-replacement.sh index 7f4854b..2964c83 100644 --- a/testsuite/subst-replacement.sh +++ b/testsuite/subst-replacement.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test Substitute replacements, e.g. 's/(.)/\U\1/' -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/temp-file-cleanup.sh b/testsuite/temp-file-cleanup.sh index dc53d57..9c738e5 100755 --- a/testsuite/temp-file-cleanup.sh +++ b/testsuite/temp-file-cleanup.sh @@ -2,7 +2,7 @@ # Verify that an erroneous use of sed -i no longer leaves behind # a temporary file. -# Copyright (C) 2015-2018 Free Software Foundation, Inc. +# Copyright (C) 2015-2020 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 diff --git a/testsuite/test-mbrtowc.c b/testsuite/test-mbrtowc.c index 912b14b..cd79764 100644 --- a/testsuite/test-mbrtowc.c +++ b/testsuite/test-mbrtowc.c @@ -1,5 +1,5 @@ /* Auxiliary program to test mbrtowc(3) behaviour. - Copyright 2016-2018 Free Software Foundation, Inc. + Copyright 2016-2020 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 diff --git a/testsuite/title-case.sh b/testsuite/title-case.sh index a365f08..7d0d559 100755 --- a/testsuite/title-case.sh +++ b/testsuite/title-case.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test case insensitive matching for titlecase and similarly odd chars. -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 @@ -26,8 +26,8 @@ c='\363' # sigma printf "$a\\n$b\\n$c\\n" >in || framework_failure_ for chr in "$a" "$b" "$c"; do - printf '/\(\)\\1'"$chr"/Ip >prog || fail=1 - LC_ALL=el_GR.iso88597 sed -n -f prog in >out || fail=1 + printf '/()\\1'"$chr"/Ip >prog || fail=1 + LC_ALL=el_GR.iso88597 sed -r -n -f prog in >out || fail=1 compare_ in out || fail=1 done diff --git a/testsuite/unbuffered.sh b/testsuite/unbuffered.sh index 5cdfc27..4fc5cb9 100644 --- a/testsuite/unbuffered.sh +++ b/testsuite/unbuffered.sh @@ -1,7 +1,7 @@ #!/bin/sh # Test -u/--unbuffered option -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2020 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 diff --git a/testsuite/uniq.sh b/testsuite/uniq.sh index f394cb3..afad9b3 100644 --- a/testsuite/uniq.sh +++ b/testsuite/uniq.sh @@ -2,7 +2,7 @@ # Test runner for the uniq.sed script -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/utf8-ru.sh b/testsuite/utf8-ru.sh index 695c383..b3213b3 100644 --- a/testsuite/utf8-ru.sh +++ b/testsuite/utf8-ru.sh @@ -4,7 +4,7 @@ # in "s///" command. # This is an adaptation of the old utf8-1/2/3/4 tests. -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 diff --git a/testsuite/xemacs.good b/testsuite/xemacs.good index abe2903..dff0941 100644 --- a/testsuite/xemacs.good +++ b/testsuite/xemacs.good @@ -1,6 +1,6 @@ #Makefile.in generated automatically by automake 1.5 from Makefile.am. -#Copyright 1994-2018 Free Software Foundation, Inc. +#Copyright 1994-2020 Free Software Foundation, Inc. #This Makefile.in is free software; the Free Software Foundation #gives unlimited permission to copy and/or distribute it, #with or without modifications, as long as this notice is preserved. diff --git a/testsuite/xemacs.inp b/testsuite/xemacs.inp index c313b4a..ba6c748 100644 --- a/testsuite/xemacs.inp +++ b/testsuite/xemacs.inp @@ -1,6 +1,6 @@ # Makefile.in generated automatically by automake 1.5 from Makefile.am. -# Copyright 1994-2018 Free Software Foundation, Inc. +# Copyright 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/testsuite/xemacs.sh b/testsuite/xemacs.sh index e1877a2..d52fcb9 100755 --- a/testsuite/xemacs.sh +++ b/testsuite/xemacs.sh @@ -2,7 +2,7 @@ # Test runner for xemacs.sed -# Copyright (C) 2017-2018 Free Software Foundation, Inc. +# Copyright (C) 2017-2020 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 -- cgit v1.2.3