diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-03-06 11:23:34 -0600 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-03-06 14:01:02 -0600 |
commit | c70e3c4bfbb202f9f6a2ae1426637550ed8de023 (patch) | |
tree | f772e5554cf4afe9d7237008afdf41ec08f5e153 /src | |
parent | 01b75d77548d67389815831dd451570ff28aa96e (diff) | |
download | groff-git-c70e3c4bfbb202f9f6a2ae1426637550ed8de023.tar.gz |
[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.
Diffstat (limited to 'src')
-rwxr-xr-x | src/roff/groff/tests/initialization_is_quiet.sh | 35 |
1 files changed, 26 insertions, 9 deletions
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 2>/dev/null) + error=$("$groff" -ww -m $locale$compat -z </dev/null 2>&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: |