gbranden pushed a commit to branch master
in repository groff.

commit c5362acd9e678da07bbe2c6c7aa8fafeff2c1dc9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Mar 30 23:06:02 2025 -0500

    [nroff]: Improve automated test.
    
    * src/roff/nroff/tests/verbose-option-works.sh: Indirect invocation of
      "nroff" command through a shell variable to ensure that we test the
      one that has been built, not one in the $PATH.  Most other groff
      automated tests already work this way.  Also check for
      POSIX-non-comforming shell, and skip test if one doesn't seem to be
      present.
---
 ChangeLog                                    |  9 ++++++
 src/roff/nroff/tests/verbose-option-works.sh | 48 +++++++++++++++++-----------
 2 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aa8df6ee9..425856899 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-03-30  G. Branden Robinson <[email protected]>
+
+       * src/roff/nroff/tests/verbose-option-works.sh: Indirect
+       invocation of "nroff" command through a shell variable to ensure
+       that we test the one that has been built, not one in the $PATH.
+       Most other groff automated tests already work this way.  Also
+       check for POSIX-non-comforming shell, and skip test if one
+       doesn't seem to be present.
+
 2025-03-30  G. Branden Robinson <[email protected]>
 
        [nroff]: Now that our "configure" script searches for a shell
diff --git a/src/roff/nroff/tests/verbose-option-works.sh 
b/src/roff/nroff/tests/verbose-option-works.sh
index 56cf8b1b6..157a0815b 100755
--- a/src/roff/nroff/tests/verbose-option-works.sh
+++ b/src/roff/nroff/tests/verbose-option-works.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -18,6 +18,8 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 
+nroff="${abs_top_builddir:-.}/nroff"
+
 if ! echo foobar | grep -qx foobar >/dev/null 2>&1
 then
     echo "$0: grep command does not support -qx options; skipping" >&2
@@ -49,8 +51,8 @@ export GROFF_TEST_GROFF=${abs_top_builddir:-.}/test-groff
 sedexpr='s/^PATH=.*test-groff /test-groff /'
 PATH=${abs_top_builddir:-.}:$PATH
 
-nroff_ver=$(nroff -v | awk 'NR == 1 {print $NF}')
-groff_ver=$(nroff -v | awk 'NR == 2 {print $NF}')
+nroff_ver=$("$nroff" -v | awk 'NR == 1 {print $NF}')
+groff_ver=$("$nroff" -v | awk 'NR == 2 {print $NF}')
 
 # If this test is skipped, you may need to `make distclean` and rebuild.
 echo nroff: $nroff_ver >&2
@@ -62,43 +64,51 @@ then
 fi
 
 echo "checking 'nroff -V'" >&2
-nroff -V | sed "$sedexpr"
-nroff -V | sed "$sedexpr" | grep -qx "test-groff -Tascii -mtty-char" \
+"$nroff" -V | sed "$sedexpr"
+"$nroff" -V | sed "$sedexpr" | grep -qx "test-groff -Tascii -mtty-char" \
     || wail
 
 echo "checking 'nroff -V 1'" >&2
-nroff -V 1 | sed "$sedexpr"
-nroff -V 1 | sed "$sedexpr" \
+"$nroff" -V 1 | sed "$sedexpr"
+"$nroff" -V 1 | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char 1" || wail
 
 echo "checking 'nroff -V \"1a 1b\"'" >&2
-nroff -V \"1a 1b\" | sed "$sedexpr"
-nroff -V \"1a 1b\" | sed "$sedexpr" \
+"$nroff" -V \"1a 1b\" | sed "$sedexpr"
+"$nroff" -V \"1a 1b\" | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char \"1a 1b\"" || wail
 
 echo "checking 'nroff -V \"1a 1b\" 2'" >&2
-nroff -V \"1a 1b\" 2 | sed "$sedexpr"
-nroff -V \"1a 1b\" 2 | sed "$sedexpr" \
+"$nroff" -V \"1a 1b\" 2 | sed "$sedexpr"
+"$nroff" -V \"1a 1b\" 2 | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char \"1a 1b\" 2" || wail
 
 echo "checking 'nroff -V 1a\\\"1b 2'" >&2
-nroff -V 1a\"1b 2 | sed "$sedexpr"
-nroff -V 1a\"1b 2 | sed "$sedexpr" \
+"$nroff" -V 1a\"1b 2 | sed "$sedexpr"
+"$nroff" -V 1a\"1b 2 | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char 1a\"1b 2" || wail
 
 echo "checking 'nroff -V -d FOO=BAR 1'" >&2
-nroff -V -d FOO=BAR 1 | sed "$sedexpr"
-nroff -V -d FOO=BAR 1 | sed "$sedexpr" \
+"$nroff" -V -d FOO=BAR 1 | sed "$sedexpr"
+"$nroff" -V -d FOO=BAR 1 | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char -d FOO=BAR 1" || wail
 
+echo "checking for argument declustering support" >&2
+"$nroff" -V -tz
+if [ $? -eq 2 ]
+then
+    echo "$0: shell is not POSIX-conforming; skipping" >&2
+    exit 77 # skip
+fi
+
 echo "checking argument declustering: 'nroff -V -tz'" >&2
-nroff -V -tz | sed "$sedexpr"
-nroff -V -tz | sed "$sedexpr" \
+"$nroff" -V -tz | sed "$sedexpr"
+"$nroff" -V -tz | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char -t -z" || wail
 
 echo "checking argument declustering: 'nroff -V -tzms'" >&2
-nroff -V -tzms | sed "$sedexpr"
-nroff -V -tzms | sed "$sedexpr" \
+"$nroff" -V -tzms | sed "$sedexpr"
+"$nroff" -V -tzms | sed "$sedexpr" \
     | grep -qx "test-groff -Tascii -mtty-char -t -z -ms" || wail
 
 test -z "$fail"

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to