From c70e3c4bfbb202f9f6a2ae1426637550ed8de023 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Mon, 6 Mar 2023 11:23:34 -0600 Subject: [groff]: Revise a test to be more revealing. * src/roff/groff/tests/initialization_is_quiet.sh: Stop using "set -e". Instead use `fail` variable and `wail` function (and lowercase names for our internal variables) like many of our other tests. If the "unset" shell built-in fails, skip the test (prompted by /usr/xpg4/bin/sh on Solaris). Attempt every groff locale, with and without compatibility mode initially enabled, instead of stopping at the first failure. Report standard error and standard output content separately. Use groff's `-a` flag to prepare the standard output, for readability. * PROBLEMS: Document that this test might be skipped rather than failing on Solaris. (What actually happens depends on which shell you run it with, and we advise a variety of approaches.) Thanks to Bruno Haible for feedback regarding mysterious failures of this test on GNU/Hurd and NetBSD systems. --- src/roff/groff/tests/initialization_is_quiet.sh | 35 ++++++++++++++++++------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/roff/groff/tests/initialization_is_quiet.sh b/src/roff/groff/tests/initialization_is_quiet.sh index f693840c6..38ac81ffc 100755 --- a/src/roff/groff/tests/initialization_is_quiet.sh +++ b/src/roff/groff/tests/initialization_is_quiet.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2021 Free Software Foundation, Inc. +# Copyright (C) 2021-2023 Free Software Foundation, Inc. # # This file is part of groff. # @@ -20,7 +20,12 @@ groff="${abs_top_builddir:-.}/test-groff" -set -e +fail= + +wail () { + echo ...FAILED >&2 + fail=YES +} # Regression-test Savannah #60874. # @@ -28,15 +33,27 @@ set -e # or not, without producing diagnostics. # Keep preconv from being run. -unset GROFF_ENCODING +# +# The "unset" in Solaris /usr/xpg4/bin/sh can actually fail. +if ! unset GROFF_ENCODING +then + echo "unable to clear environment; skipping" >&2 + exit 77 +fi -for COMPAT in "" -C +for compat in "" " -C" do - for LOCALE in cs de en fr it ja sv zh + for locale in cs de en fr it ja sv zh do - echo "testing \"-m $LOCALE\"; COMPAT=\"$COMPAT\"" - OUTPUT=$("$groff" -ww -m $LOCALE "$COMPAT" < /dev/null 2>&1) - echo "$OUTPUT" - test -z "$OUTPUT" + echo testing \"-m $locale$compat\" >&2 + output=$("$groff" -ww -m $locale$compat -a /dev/null) + error=$("$groff" -ww -m $locale$compat -z &1) + test -n "$error" && echo "$error" + test -n "$output" && echo "$output" + test -n "$error$output" && wail done done + +test -z "$fail" + +# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72: -- cgit v1.2.1