groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 05/08: [groff]: Revise a test to be more revealing.


From: G. Branden Robinson
Subject: [groff] 05/08: [groff]: Revise a test to be more revealing.
Date: Mon, 6 Mar 2023 16:22:22 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit c70e3c4bfbb202f9f6a2ae1426637550ed8de023
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Mar 6 11:23:34 2023 -0600

    [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.
---
 ChangeLog                                       | 21 +++++++++++++++
 PROBLEMS                                        | 10 +++++++
 src/roff/groff/tests/initialization_is_quiet.sh | 35 ++++++++++++++++++-------
 3 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f0dfe960..6d2b6a4b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2023-03-06  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [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.
+
 2023-03-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * bootstrap.conf (gnulib_modules): Add "stdbool-c99" per
diff --git a/PROBLEMS b/PROBLEMS
index 3cfe187a1..471e4a526 100644
--- a/PROBLEMS
+++ b/PROBLEMS
@@ -826,6 +826,14 @@ overcome this problem.
 
 ----------------------------------------------------------------------
 
+* The "initialization_is_quiet" test fails on my GNU/Hurd or NetBSD box.
+
+This is a known problem.  We haven't tracked down the cause yet, but
+have improved the reporting of the test output in hopes that we can
+isolate it in a future release.
+
+----------------------------------------------------------------------
+
 * Tests fail when I run "make check" on Solaris 10 or 11.
 
 The test suite expects a POSIX-conforming shell and utilities.  Solaris
@@ -877,6 +885,8 @@ Some test failures remain expected on Solaris 10.
     FAIL: src/roff/groff/tests/msoquiet_works.sh
     FAIL: src/roff/groff/tests/soquiet_works.sh
 
+    (The first of these might be SKIPped instead.)
+
     /usr/xpg4/bin/sh is non-conforming with the POSIX Issue 4 standard,
     despite its name.  Its "unset" builtin is buggy.
 
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:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]