gbranden pushed a commit to branch master
in repository groff.

commit 3d26055037d22ea0145aee739fc1d25e48127c99
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Feb 20 20:07:39 2026 -0600

    Make test scripts' "skip" notices more consistent.
    
    * Always issue a notice when skipping the test.
    * Always prefix the message with the script's identity (`$0`).
    * Drop the word "test" from the end of the notice since the script now
      identifies itself by name.
    * Always explicitly state that "skipping" is the outcome of the script.
---
 contrib/gdiffmk/tests/runtests.sh                      |  6 +++---
 contrib/mm/tests/letter-with-bottom-block-works.sh     |  6 +++++-
 contrib/mm/tests/letters-format-correctly.sh           | 12 ++++++++++--
 contrib/mm/tests/memoranda-format-correctly.sh         | 12 ++++++++++--
 contrib/mom/examples/test-mom.sh.in                    |  4 +++-
 font/devpdf/tests/check-default-foundry.sh.in          |  8 ++++----
 .../grotty/tests/basic-latin-glyphs-map-correctly.sh   |  2 +-
 .../preconv/tests/do-not-seek-the-unseekable.sh        |  4 ++--
 src/roff/groff/tests/html-device-smoke-test.sh         |  4 ++--
 src/roff/nroff/tests/verbose-option-works.sh           |  2 +-
 tmac/tests/an_UR-works.sh                              |  2 +-
 .../pdfpic_does-not-choke-on-bad-pdfinfo-output.sh     | 15 +++++++++++----
 tmac/tests/pdfpic_falls-back-to-PSPIC.sh               | 18 +++++++++++++-----
 13 files changed, 66 insertions(+), 29 deletions(-)

diff --git a/contrib/gdiffmk/tests/runtests.sh 
b/contrib/gdiffmk/tests/runtests.sh
index 95710b808..d4e44fce6 100755
--- a/contrib/gdiffmk/tests/runtests.sh
+++ b/contrib/gdiffmk/tests/runtests.sh
@@ -31,7 +31,7 @@ gdiffmk=${abs_top_out_dir:-.}/gdiffmk
 
 if ! diff -Dx /dev/null /dev/null >/dev/null 2>&1
 then
-    echo "$0: diff command does not support -D option" >&2
+    echo "$0: diff command does not support -D option; skipping" >&2
     exit 77 # skip
 fi
 
@@ -57,7 +57,7 @@ done
 # If we can't find it, we can't test.
 if [ -z "$in_dir" ]
 then
-    echo "$0: cannot locate test artifact input directory" >&2
+    echo "$0: cannot locate test artifact input directory; skipping" >&2
     exit 77 # skip
 fi
 
@@ -77,7 +77,7 @@ done
 # If we can't find it, we can't test.
 if [ -z "$out_dir" ]
 then
-    echo "$0: cannot locate test artifact output directory" >&2
+    echo "$0: cannot locate test artifact output directory; skipping" >&2
     exit 77 # skip
 fi
 
diff --git a/contrib/mm/tests/letter-with-bottom-block-works.sh 
b/contrib/mm/tests/letter-with-bottom-block-works.sh
index 21aeb7530..0ee587904 100755
--- a/contrib/mm/tests/letter-with-bottom-block-works.sh
+++ b/contrib/mm/tests/letter-with-bottom-block-works.sh
@@ -44,7 +44,11 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$artifacts_dir" && exit 77 # skip
+if [ -z "$artifacts_dir" ]
+then
+    echo "$0: cannot locate test artifact directory; skipping" >&2
+    exit 77 # skip
+fi
 
 input='.
 .BS
diff --git a/contrib/mm/tests/letters-format-correctly.sh 
b/contrib/mm/tests/letters-format-correctly.sh
index 77c179b8c..67dab3e0d 100755
--- a/contrib/mm/tests/letters-format-correctly.sh
+++ b/contrib/mm/tests/letters-format-correctly.sh
@@ -41,7 +41,11 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$examples_dir" && exit 77 # skip
+if [ -z "$examples_dir" ]
+then
+    echo "$0: cannot locate examples directory; skipping" >&2
+    exit 77 # skip
+fi
 
 # Locate directory containing our test artifacts.
 artifacts_dir=
@@ -57,7 +61,11 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$artifacts_dir" && exit 77 # skip
+if [ -z "$examples_dir" ]
+then
+    echo "$0: cannot locate test artifacts directory; skipping" >&2
+    exit 77 # skip
+fi
 
 input="$examples_dir"/letter.mm
 
diff --git a/contrib/mm/tests/memoranda-format-correctly.sh 
b/contrib/mm/tests/memoranda-format-correctly.sh
index cdd794f56..44240a28b 100755
--- a/contrib/mm/tests/memoranda-format-correctly.sh
+++ b/contrib/mm/tests/memoranda-format-correctly.sh
@@ -40,7 +40,11 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$examples_dir" && exit 77 # skip
+if [ -z "$examples_dir" ]
+then
+    echo "$0: cannot locate examples directory; skipping" >&2
+    exit 77 # skip
+fi
 
 # Locate directory containing our test artifacts.
 artifacts_dir=
@@ -56,7 +60,11 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$artifacts_dir" && exit 77 # skip
+if [ -z "$artifacts_dir" ]
+then
+    echo "$0: cannot locate test artifact directory; skipping" >&2
+    exit 77 # skip
+fi
 
 # Regression-test Savannah #65865 and other things that could go wrong.
 
diff --git a/contrib/mom/examples/test-mom.sh.in 
b/contrib/mom/examples/test-mom.sh.in
index f394c43d5..0f2f3cfd1 100644
--- a/contrib/mom/examples/test-mom.sh.in
+++ b/contrib/mom/examples/test-mom.sh.in
@@ -42,7 +42,7 @@ for cmd in pdfinfo pdfimages
 do
     if ! command -v $cmd >/dev/null
     then
-        echo "cannot locate '$cmd' command; skipping test" >&2
+        echo "$0: cannot locate '$cmd' command; skipping" >&2
         exit 77 # skip
     fi
 done
@@ -85,6 +85,8 @@ check_has_images()
     fi
 }
 
+# TODO: Make this a "hard error" (status 99).  See, e.g.,
+# "font/devpdf/tests/check-default-foundry.sh.in".
 for k in $examples
 do
     if ! [ -f "$examplesdir"/$k ]
diff --git a/font/devpdf/tests/check-default-foundry.sh.in 
b/font/devpdf/tests/check-default-foundry.sh.in
index 84a66eade..f41cf0800 100755
--- a/font/devpdf/tests/check-default-foundry.sh.in
+++ b/font/devpdf/tests/check-default-foundry.sh.in
@@ -85,8 +85,8 @@ test -z "$fail" || exit
 
 if [ "$ghostscript" = no ] || [ "$ghostscript" = missing ]
 then
-    echo "Ghostscript not available; skipping check for any further" \
-         "fonts in the default foundry" >&2
+    echo "$0: Ghostscript not available; skipping check for any"
+        "further fonts in the default foundry" >&2
     exit 77 # skip
 fi
 
@@ -94,13 +94,13 @@ foundry="$devpdf_fontbuilddir"/Foundry
 
 if ! test -f "$foundry"
 then
-    echo "cannot locate Foundry file at $foundry" >&2
+    echo "$0: cannot locate Foundry file at '$foundry'" >&2
     exit 99 # hard error
 fi
 
 if ! grep -q "BEGIN URW" "$foundry"
 then
-    echo "URW fonts not available; skipping check for any further" \
+    echo "$0: URW fonts not available; skipping check for any further" \
          "fonts in the default foundry" >&2
     exit 77 # skip
 fi
diff --git a/src/devices/grotty/tests/basic-latin-glyphs-map-correctly.sh 
b/src/devices/grotty/tests/basic-latin-glyphs-map-correctly.sh
index 7e32eb5e2..898d61235 100755
--- a/src/devices/grotty/tests/basic-latin-glyphs-map-correctly.sh
+++ b/src/devices/grotty/tests/basic-latin-glyphs-map-correctly.sh
@@ -136,7 +136,7 @@ do
 
         if [ -n "$give_up" ]
         then
-            echo "$message; skipping test" >&2
+            echo "$0: $message; skipping" >&2
             exit 77 # skip
         fi
     fi
diff --git a/src/preproc/preconv/tests/do-not-seek-the-unseekable.sh 
b/src/preproc/preconv/tests/do-not-seek-the-unseekable.sh
index f0605b334..6244b5070 100755
--- a/src/preproc/preconv/tests/do-not-seek-the-unseekable.sh
+++ b/src/preproc/preconv/tests/do-not-seek-the-unseekable.sh
@@ -47,13 +47,13 @@ test -z "$fail" || exit
 # Similarly, we must have a controlling terminal.
 if ! [ -c /dev/stdin ]
 then
-    echo "/dev/stdin is not a character device; skipping test" >&2
+    echo "$0: /dev/stdin is not a character device; skipping" >&2
     exit 77 # skip
 fi
 
 if [ "$(tty)" = "not a tty" ]
 then
-    echo "there is no controlling terminal; skipping test" >&2
+    echo "$0: there is no controlling terminal; skipping" >&2
     exit 77 # skip
 fi
 
diff --git a/src/roff/groff/tests/html-device-smoke-test.sh 
b/src/roff/groff/tests/html-device-smoke-test.sh
index b0e15e027..27e8cf950 100755
--- a/src/roff/groff/tests/html-device-smoke-test.sh
+++ b/src/roff/groff/tests/html-device-smoke-test.sh
@@ -26,7 +26,7 @@ for cmd in pnmcrop pamcut pnmtopng pnmtops ps2ps
 do
     if ! command -v $cmd >/dev/null
     then
-        echo "cannot locate '$cmd' command; skipping test" >&2
+        echo "$0: cannot locate '$cmd' command; skipping" >&2
         exit 77 # skip
     fi
 done
@@ -87,7 +87,7 @@ fi
 
 if [ -n "$give_up" ]
 then
-    echo "$message; skipping test" >&2
+    echo "$0: $message; skipping" >&2
     exit 77 # skip
 fi
 
diff --git a/src/roff/nroff/tests/verbose-option-works.sh 
b/src/roff/nroff/tests/verbose-option-works.sh
index ee3f184c3..1c4133199 100755
--- a/src/roff/nroff/tests/verbose-option-works.sh
+++ b/src/roff/nroff/tests/verbose-option-works.sh
@@ -58,7 +58,7 @@ echo nroff: $nroff_ver >&2
 echo groff: $groff_ver >&2
 if [ "$nroff_ver" != "$groff_ver" ]
 then
-    echo "nroff and groff version numbers mismatch; skipping test" >&2
+    echo "$0: nroff and groff version numbers mismatch; skipping" >&2
     exit 77 # skip
 fi
 
diff --git a/tmac/tests/an_UR-works.sh b/tmac/tests/an_UR-works.sh
index 87a7a3f8a..a632019e2 100755
--- a/tmac/tests/an_UR-works.sh
+++ b/tmac/tests/an_UR-works.sh
@@ -111,7 +111,7 @@ test -z "$fail" || exit
 
 if ! command -v pdftotext >/dev/null
 then
-    echo "cannot locate 'pdftotext' command" >&2
+    echo "$0: cannot locate 'pdftotext' command; skipping" >&2
     exit 77 # skip
 fi
 
diff --git a/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh 
b/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh
index 7b6599345..0dd46954a 100755
--- a/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh
+++ b/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh
@@ -24,11 +24,14 @@ 
gnu_pdf="${abs_top_builddir:-.}/doc/gnu-no-choke-on-pdfinfo.pdf"
 # Regression-test Savannah #58206.
 
 # We need gs(1) and pdfpic.tmac needs pdfinfo(1).
+# TODO: Generate this test script from an '.in' file and search for the
+# `GHOSTSCRIPT` command name detected by our "configure" script.
+# See "contrib/hdtbl/examples/test-hdtbl.sh.in".
 for cmd in gs pdfinfo
 do
     if ! command -v $cmd >/dev/null
     then
-        echo "cannot locate '$cmd' command; skipping test" >&2
+        echo "$0: cannot locate '$cmd' command; skipping" >&2
         exit 77 # skip
     fi
 done
@@ -48,12 +51,16 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$artifact_dir" && exit 77 # skip
+if [ -z "$artifact_dir" ]
+then
+    echo "$0: cannot locate test artifact directory; skipping" >&2
+    exit 77 # skip
+fi
 
 if [ -e "$gnu_pdf" ]
 then
-    echo "temporary output file '$gnu_pdf' already exists; skipping" \
-        "test" >&2
+    echo "$0: temporary output file '$gnu_pdf' already exists;" \
+        "skipping" >&2
     exit 77 # skip
 fi
 
diff --git a/tmac/tests/pdfpic_falls-back-to-PSPIC.sh 
b/tmac/tests/pdfpic_falls-back-to-PSPIC.sh
index 6244cd4be..d4d92c17d 100755
--- a/tmac/tests/pdfpic_falls-back-to-PSPIC.sh
+++ b/tmac/tests/pdfpic_falls-back-to-PSPIC.sh
@@ -23,9 +23,12 @@ gnu_base="${abs_top_builddir:-.}/doc/gnu-fallback-pspic"
 gnu_fallback_eps="$gnu_base.eps"
 gnu_pdf="$gnu_base.pdf"
 
+# TODO: Generate this test script from an '.in' file and search for the
+# `GHOSTSCRIPT` command name detected by our "configure" script.
+# See "contrib/hdtbl/examples/test-hdtbl.sh.in".
 if ! command -v gs >/dev/null
 then
-    echo "cannot locate 'gs' command" >&2
+    echo "$0: cannot locate 'gs' command; skipping" >&2
     exit 77 # skip
 fi
 
@@ -44,12 +47,16 @@ do
 done
 
 # If we can't find it, we can't test.
-test -z "$artifact_dir" && exit 77 # skip
+if [ -z "$artifact_dir" ]
+then
+    echo "$0: cannot locate test artifact directory; skipping" >&2
+    exit 77 # skip
+fi
 
 if [ -e "$gnu_pdf" ]
 then
-    echo "temporary output file '$gnu_pdf' already exists; skipping" \
-        "test" >&2
+    echo "$0: temporary output file '$gnu_pdf' already exists;" \
+        "skipping" >&2
     exit 77 # skip
 fi
 
@@ -63,7 +70,8 @@ Here is a picture of a wildebeest.
 
 if ! gs -q -o - -sDEVICE=pdfwrite -f "$gnu_eps" > "$gnu_pdf"
 then
-    echo "gs command failed" >&2
+    # XXX: Should this be a "hard error" (status 99)?
+    echo "$0: gs command failed; skipping" >&2
     rm -f "$gnu_fallback_eps" "$gnu_pdf"
     exit 77 # skip
 fi

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

Reply via email to