gbranden pushed a commit to branch master
in repository groff.
commit 232a943cc2c537d9732a7360bdab93efa5fb1744
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Feb 3 05:14:57 2026 -0600
[hdtbl]: Improve test script.
* Exit with test framework's "hard error" status (99, not 2) if required
build artifacts under test are not present.
* Emit error diagnostic in the foregoing case.
* When an artifact is present but the page count is wrong, disclose the
expected value.
* Clarify comment.
* Drop stump comment after license notice.
* Revise Vim modeline to communicate less esoterically.
---
contrib/hdtbl/examples/test-hdtbl.sh.in | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/contrib/hdtbl/examples/test-hdtbl.sh.in
b/contrib/hdtbl/examples/test-hdtbl.sh.in
index 79cd0b468..e064f390d 100644
--- a/contrib/hdtbl/examples/test-hdtbl.sh.in
+++ b/contrib/hdtbl/examples/test-hdtbl.sh.in
@@ -16,9 +16,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Count pages in generated files 'font_n.ps' and 'font_x.ps'.
+# Use Ghostscript to count pages in generated files "font_n.ps" and
+# "font_x.ps".
builddir="@abs_top_builddir@"
gs_program="@GHOSTSCRIPT@"
@@ -26,7 +26,7 @@ ret=0
if [ "$gs_program" = "missing" ]
then
- echo "ghostscript program missing, can't check hdtbl examples" >&2
+ echo "Ghostscript program missing; skipping" >&2
exit 77
fi
@@ -38,17 +38,22 @@ check_number_pages()
if ! [ -r "$1" ]
then
echo "error: \"$1\" does not exist or is not readable" >&2
- exit 2
+ exit 99
fi
res=$("$gs_program" -o /dev/null/ -sDEVICE=bbox "$1" 2>&1 \
| grep HiResBoundingBox | wc -l)
# macOS `wc` prefixes the line count with spaces. Get rid of them.
- res=$(( res + 0 )) || exit 99
+ if ! res=$(( res + 0 ))
+ then
+ echo "error: cannot perform arithmetic on output of 'wc'" \
+ "command" >&2
+ exit 99
+ fi
if [ "$res" != $2 ]
then
- echo "...FAILED; found $res page(s)" >&2
+ echo "...FAILED; found $res page(s), expected $2" >&2
ret=1
fi
}
@@ -58,4 +63,4 @@ check_number_pages
"$builddir"/contrib/hdtbl/examples/fonts_x.ps 46
exit $ret
-# vim:set ai et sw=4 ts=4 tw=72:
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit