groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/08: [devpdf]: Revise tests.


From: G. Branden Robinson
Subject: [groff] 06/08: [devpdf]: Revise tests.
Date: Sat, 25 Feb 2023 06:57:30 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 168d596d31ecf3b0af67e41932c4cf1782a8edbf
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Feb 24 18:07:45 2023 -0600

    [devpdf]: Revise tests.
    
    * font/devpdf/tests/check-default-foundry.sh.in: Test only the base 14
      fonts of the PDF standard unconditionally.  Test the remainder from
      the set of 35 commonly distributed only if a Ghostscript interpreter
      was detected at configuration time, because the latter fonts _must_ be
      embedded in PDF documents.  If they're not present, skip the test
      rather than failing it.
    * font/devpdf/tests/check-urw-foundry.sh.in: Skip test if no URW fonts
      detected at configuration time, rather than failing it.
    * m4/groff.m4 (GROFF_GROPDF_PROGRAM_NOTICE, GROFF_URW_FONTS_NOTICE):
      Drop warnings of expected test failures.  The tests no longer fail in
      the anticipated circumstances.
---
 ChangeLog                                     | 17 ++++++
 font/devpdf/tests/check-default-foundry.sh.in | 83 ++++++++++++++++-----------
 font/devpdf/tests/check-urw-foundry.sh.in     | 13 ++++-
 m4/groff.m4                                   |  4 --
 4 files changed, 77 insertions(+), 40 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0323d7c99..738f0bc51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2023-02-25  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [devpdf]: Revise tests.
+
+       * font/devpdf/tests/check-default-foundry.sh.in: Test only the
+       base 14 fonts of the PDF standard unconditionally.  Test the
+       remainder from the set of 35 commonly distributed only if a
+       Ghostscript interpreter was detected at configuration time,
+       because the latter fonts _must_ be embedded in PDF documents.
+       If they're not present, skip the test rather than failing it.
+       * font/devpdf/tests/check-urw-foundry.sh.in: Skip test if no URW
+       fonts detected at configuration time, rather than failing it.
+       * m4/groff.m4 (GROFF_GROPDF_PROGRAM_NOTICE)
+       (GROFF_URW_FONTS_NOTICE): Drop warnings of expected test
+       failures.  The tests no longer fail in the anticipated
+       circumstances.
+
 2023-02-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [devpdf]: Generate tests from template files, so we can populate
diff --git a/font/devpdf/tests/check-default-foundry.sh.in 
b/font/devpdf/tests/check-default-foundry.sh.in
index 1ddd83d0b..026cc012a 100755
--- a/font/devpdf/tests/check-default-foundry.sh.in
+++ b/font/devpdf/tests/check-default-foundry.sh.in
@@ -18,19 +18,42 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 
-# Ensure that groff's PDF device has font description files for the
-# default (unnamed) foundry's PostScript Level 2 base 35 fonts, plus
-# groff's EURO.
-#
-# These font descriptions should be available in any gropdf
-# configuration because they can be copied from the devps font
-# descriptions even if the URW fonts are not available.
-#
-# Another test script checks the "U" (URW) foundry.
-
 devpdf_fontbuilddir="${abs_top_builddir:-.}"/font/devpdf
+ghostscript=@GHOSTSCRIPT@
+
+wail () {
+    echo ...FAILED >&2
+    fail=yes
+}
+
+fail=
+
+# The are the base 14 fonts required by the PDF standard.  They should
+# _always_ be present and supported.  If their corresponding Type 1 font
+# files are available, they too can be embedded in a PDF using gropdf's
+# "-e" option.  groff's "EURO" font is always available; we ship it.
+mandatory_fonts='CB
+CBI
+CI
+CR
+HB
+HBI
+HI
+HR
+S
+TB
+TBI
+TI
+TR
+ZD'
 
-fonts='AB
+# These fonts are commonly, but not universally, available; if used,
+# their corresponding Type 1 font files must be embedded in a document.
+#
+# Their groff font descriptions will always be available: we ship them.
+# But they are not usable with gropdf(1) if the Type 1 files are absent.
+# We thus will not test them if they are not expected to work.
+supplementary_fonts='AB
 ABI
 AI
 AR
@@ -38,19 +61,10 @@ BMB
 BMBI
 BMI
 BMR
-CB
-CBI
-CI
-CR
-EURO
-HB
-HBI
-HI
 HNB
 HNBI
 HNI
 HNR
-HR
 NB
 NBI
 NI
@@ -59,24 +73,25 @@ PB
 PBI
 PI
 PR
-S
-TB
-TBI
-TI
-TR
-ZCMI
-ZD'
+ZCMI'
 
-fail=
+for f in $mandatory_fonts
+do
+    printf "checking for font description %s...\n" "$f" >&2
+    test -f "$devpdf_fontbuilddir"/"$f" || wail
+done
+
+if [ "$ghostscript" = no ] || [ "$ghostscript" = missing ]
+then
+    echo "Ghostscript not available; skipping check for any further" \
+         "fonts in the default foundry" >&2
+    exit 77 # skip
+fi
 
-for f in $fonts
+for f in $supplementary_fonts
 do
     printf "checking for font description %s...\n" "$f" >&2
-    if ! [ -f "$devpdf_fontbuilddir"/"$f" ]
-    then
-        echo FAILED >&2
-        fail=yes
-    fi
+    test -f "$devpdf_fontbuilddir"/"$f" || wail
 done
 
 test -z "$fail"
diff --git a/font/devpdf/tests/check-urw-foundry.sh.in 
b/font/devpdf/tests/check-urw-foundry.sh.in
index 9d4e514bf..d31b3aa3e 100755
--- a/font/devpdf/tests/check-urw-foundry.sh.in
+++ b/font/devpdf/tests/check-urw-foundry.sh.in
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2022 Free Software Foundation, Inc.
+# Copyright (C) 2022-2023 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -19,8 +19,17 @@
 #
 
 # Ensure that groff's PDF device has URW font descriptions it expects.
+# These are generated at build time by afmtodit(1) if a URW font
+# directory was discovered at configuration time.
 
 devpdf_fontbuilddir="${abs_top_builddir:-.}"/font/devpdf
+urwfontsdir=@urwfontsdir@
+
+if [ -z "$urwfontsdir" ]
+then
+    echo "URW fonts not found at configuration time; skipping" >&2
+    exit 77 # skip
+fi
 
 fonts='AB
 ABI
@@ -67,7 +76,7 @@ do
     if ! test -f "$devpdf_fontbuilddir"/$f
     then
         echo test -f "$devpdf_fontbuilddir"/$f
-        echo FAILED >&2
+        echo ...FAILED >&2
         fail=yes
     fi
 done
diff --git a/m4/groff.m4 b/m4/groff.m4
index 06b32e159..617e16394 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -332,8 +332,6 @@ AC_DEFUN([GROFF_GROPDF_PROGRAM_NOTICE], [
   base 14 fonts, plus the 'EURO' font groff supplies, and font embedding
   with its '-e' option (accessed via the 'groff' command with the option
   '-P -e') will not be possible.
-
-  If you run "make check", an automated test for 'gropdf' will fail.
 ])
   fi
 ])
@@ -416,8 +414,6 @@ AC_DEFUN([GROFF_URW_FONTS_NOTICE], [
   the 'U' foundry in PDF documents generated by groff will not be
   possible.
 
-  If you run "make check", an automated test for 'gropdf' will fail.
-
   You can obtain the URW base 35 fonts from their GitHub project.  As of
   this writing (2023-02-15), you can find them in the 'fonts' directory
   of the following archives (choose one).



reply via email to

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