groff-commit
[Top][All Lists]
Advanced

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

[groff] 25/25: [tests]: Make pdfpic tests more robust.


From: G. Branden Robinson
Subject: [groff] 25/25: [tests]: Make pdfpic tests more robust.
Date: Mon, 28 Mar 2022 12:08:22 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit cd7a4858ca793152b3dc67b620a6e90ef65bdcb0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Mar 29 02:26:35 2022 +1100

    [tests]: Make pdfpic tests more robust.
    
    * tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh:
    * tmac/tests/pdfpic_falls-back-to-PSPIC.sh: Remove output file even when
      skipping test.  Quote `fail` variable when checking it with `test -z`.
    
    * tmac/tests/pdfpic_falls-back-to-PSPIC.sh: Restore removal of the
      fallback EPS file that gets created.
    
    Did I mention how much I hate tests that write to the file system?
---
 ChangeLog                                                 |  7 +++++++
 tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh |  5 +++--
 tmac/tests/pdfpic_falls-back-to-PSPIC.sh                  | 12 ++++++++----
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d39bdac..bce677dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-03-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh:
+       * tmac/tests/pdfpic_falls-back-to-PSPIC.sh: Remove output file
+       even when skipping test.  Quote `fail` variable when checking it
+       with `test -z`.
+
 2022-03-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * man/groff_tmac.7.man (Auxiliary packages): Tweak sboxes
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 15e76a8e..dc1a6059 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
@@ -66,13 +66,14 @@ if ! gs -q -o - -sDEVICE=pdfwrite -f "$gnu_eps" \
     > "$gnu_pdf"
 then
     echo "gs command failed" >&2
+    rm -f "$gnu_pdf"
     exit 77 # skip
 fi
 
-test -z $fail \
+test -z "$fail" \
     && printf '%s\n' "$input" | "$groff" -Tpdf -U -z || fail=YES
 
 rm -f "$gnu_pdf"
-test -z $fail
+test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/pdfpic_falls-back-to-PSPIC.sh 
b/tmac/tests/pdfpic_falls-back-to-PSPIC.sh
index 31983d03..a77f4311 100755
--- a/tmac/tests/pdfpic_falls-back-to-PSPIC.sh
+++ b/tmac/tests/pdfpic_falls-back-to-PSPIC.sh
@@ -20,7 +20,9 @@
 
 groff="${abs_top_builddir:-.}/test-groff"
 # Give the output a name that won't collide with another test.
-gnu_pdf="${abs_top_builddir:-.}/doc/gnu-fallback-pspic.pdf"
+gnu_base="${abs_top_builddir:-.}/doc/gnu-fallback-pspic"
+gnu_fallback_eps="$gnu_base.eps"
+gnu_pdf="$gnu_base.pdf"
 
 if ! command -v gs >/dev/null
 then
@@ -62,12 +64,14 @@ Here is a picture of a wildebeest.
 if ! gs -q -o - -sDEVICE=pdfwrite -f "$gnu_eps" > "$gnu_pdf"
 then
     echo "gs command failed" >&2
+    rm -f "$gnu_fallback_eps" "$gnu_pdf"
     exit 77 # skip
 fi
-test -z $fail \
+
+test -z "$fail" \
     && printf '%s\n' "$input" | "$groff" -Tps -U -z || fail=YES
 
-rm -f "$gnu_pdf"
-test -z $fail
+rm -f "$gnu_fallback_eps" "$gnu_pdf"
+test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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