URL: <https://savannah.gnu.org/bugs/?67939>
Summary: [PATCH] [hdtbl] test: get the number of created
pages directly from the PostScript file
Group: GNU roff
Submitter: bjarniig
Submitted: Wed 21 Jan 2026 12:06:12 AM UTC
Category: Macro package - others/general
Severity: 3 - Normal
Item Group: Test
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Unlocked
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Wed 21 Jan 2026 12:06:12 AM UTC By: Bjarni Ingi Gislason <bjarniig>
From 34299929019ba62b3e34b7dd56fcc55daf9f303f Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <[email protected]>
Date: Tue, 20 Jan 2026 23:29:41 +0000
Subject: [PATCH] Subject: [hdtbl] test: get the number of created pages
directly from the PostScript file
File: contrib/hdtbl/examples/test-hdtbl.sh.in
Use 'sed' to extract the data from the "%%Pages: " line,
instead of using the "ghostscript" program".
This greatly reduces the execution time.
Signed-off-by: Bjarni Ingi Gislason <[email protected]>
---
contrib/hdtbl/examples/test-hdtbl.sh.in | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/contrib/hdtbl/examples/test-hdtbl.sh.in
b/contrib/hdtbl/examples/test-hdtbl.sh.in
index 79cd0b468..bac0c4c46 100644
--- a/contrib/hdtbl/examples/test-hdtbl.sh.in
+++ b/contrib/hdtbl/examples/test-hdtbl.sh.in
@@ -21,15 +21,9 @@
# Count pages in generated files 'font_n.ps' and 'font_x.ps'.
builddir="@abs_top_builddir@"
-gs_program="@GHOSTSCRIPT@"
+fontdir="${builddir}/../font/devps"
ret=0
-if [ "$gs_program" = "missing" ]
-then
- echo "ghostscript program missing, can't check hdtbl examples" >&2
- exit 77
-fi
-
# $1 file, $2 expected number of pages
check_number_pages()
{
@@ -41,10 +35,7 @@ check_number_pages()
exit 2
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
+ res=$(sed -n -e '/^%%Pages: [0-9]\+/ {s/^%%Pages: //p;q}' $1)
if [ "$res" != $2 ]
then
@@ -53,8 +44,9 @@ check_number_pages()
fi
}
-check_number_pages "$builddir"/contrib/hdtbl/examples/fonts_n.ps 46
-check_number_pages "$builddir"/contrib/hdtbl/examples/fonts_x.ps 46
+nr_files=$(ls $fontdir | grep -c '^[[:upper:]-]\+$')
+check_number_pages "$builddir"/contrib/hdtbl/examples/fonts_n.ps $nr_files
+check_number_pages "$builddir"/contrib/hdtbl/examples/fonts_x.ps $nr_files
exit $ret
--
2.51.0
_______________________________________________________
File Attachments:
Name: 0001-Subject-hdtbl-test-get-the-number-of-created-pages-dir.txt Size:
2.0KiB
<https://file.savannah.gnu.org/file/0001-Subject-hdtbl-test-get-the-number-of-created-pages-dir.txt?file_id=58145>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-c0e7328b0919e9b907c12a3a42c8f9bea29fbc0e.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?67939>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
