groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/03: [libgroff]: Regression-test Savannah #61424.


From: G. Branden Robinson
Subject: [groff] 01/03: [libgroff]: Regression-test Savannah #61424.
Date: Sun, 7 Nov 2021 03:06:04 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 52f396189a4a9dd1294b16c6f84fcd47e4359221
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Nov 7 02:43:53 2021 +1100

    [libgroff]: Regression-test Savannah #61424.
    
    * src/roff/groff/tests/fp_should_not_traverse_directories.sh: Do it.
    * src/roff/groff/tests/artifacts/HONEYPOT: Add test artifact.
    * src/roff/groff/tests/artifacts/devascii/README: ...and this; we need
      an empty directory to make the test work but such things tend to look
      unintentional.
    
    * src/roff/groff/groff.am (groff_TESTS): Run test.
    
      (EXTRA_DIST): Ship artifacts.
    
    Test fails at this commit.
---
 ChangeLog                                          | 13 +++++
 src/roff/groff/groff.am                            |  6 +++
 src/roff/groff/tests/artifacts/HONEYPOT            | 15 ++++++
 src/roff/groff/tests/artifacts/devascii/README     |  1 +
 .../tests/fp_should_not_traverse_directories.sh    | 61 ++++++++++++++++++++++
 5 files changed, 96 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0ece7a9..5deca75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2021-11-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [libgroff]: Regression-test Savannah #61424.
+
+       * src/roff/groff/tests/fp_should_not_traverse_directories.sh: Do
+       it.
+       * src/roff/groff/tests/artifacts/HONEYPOT: Add test artifact.
+       * src/roff/groff/tests/artifacts/devascii/README: ...and this;
+       we need an empty directory to make the test work but such things
+       tend to look unintentional.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+       (EXTRA_DIST): Ship artifacts.
+
 2021-11-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [libgroff]: Fix diagnostic error wording.
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index fa5ef52..e5549e5 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -44,6 +44,7 @@ groff_TESTS = \
   src/roff/groff/tests/dot-cp_register_works.sh \
   src/roff/groff/tests/dot-nm_register_works.sh \
   src/roff/groff/tests/evc_produces_no_output_if_invalid.sh \
+  src/roff/groff/tests/fp_should_not_traverse_directories.sh \
   src/roff/groff/tests/initialization_is_quiet.sh \
   src/roff/groff/tests/localization_works.sh \
   src/roff/groff/tests/msoquiet_works.sh \
@@ -65,6 +66,11 @@ groff_TESTS = \
 TESTS += $(groff_TESTS)
 EXTRA_DIST += $(groff_TESTS)
 
+# required test artifacts
+EXTRA_DIST += \
+  src/roff/groff/tests/artifacts/HONEYPOT \
+  src/roff/groff/tests/artifacts/devascii/README
+
 groff_XFAIL_TESTS = \
   src/roff/groff/tests/string_case_xform_unicode_escape.sh
 XFAIL_TESTS += $(groff_XFAIL_TESTS)
diff --git a/src/roff/groff/tests/artifacts/HONEYPOT 
b/src/roff/groff/tests/artifacts/HONEYPOT
new file mode 100644
index 0000000..51a57dd
--- /dev/null
+++ b/src/roff/groff/tests/artifacts/HONEYPOT
@@ -0,0 +1,15 @@
+name HONEYPOT
+spacewidth 24
+charset
+a 0 0 77
+b 0 0 79
+d 0 0 76
+e 0 0 82
+i 0 0 105
+l 0 0 65
+m 0 0 109
+o 0 0 86
+r 0 0 73
+s 0 0 115
+w 0 0 69
+y 0 0 121
diff --git a/src/roff/groff/tests/artifacts/devascii/README 
b/src/roff/groff/tests/artifacts/devascii/README
new file mode 100644
index 0000000..d89ba03
--- /dev/null
+++ b/src/roff/groff/tests/artifacts/devascii/README
@@ -0,0 +1 @@
+This directory is intentionally empty (apart from this file).
diff --git a/src/roff/groff/tests/fp_should_not_traverse_directories.sh 
b/src/roff/groff/tests/fp_should_not_traverse_directories.sh
new file mode 100755
index 0000000..2e2f454
--- /dev/null
+++ b/src/roff/groff/tests/fp_should_not_traverse_directories.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (C) 2021 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+# Regression-test Savannah #61424.
+#
+# The `fp` request should not be able to access font description files
+# outside of the device and font description search path (configurable
+# with the -F option and GROFF_FONT_PATH environment variable).
+
+# An absolute file name _won't_ work: it gets dev\*[.T]/ stuck on the
+# front of it by libgroff.  (We have no idea where in a file system we
+# might be getting built anyway.)  So we hunt around for our test
+# artifact directory in some common locations.
+font_dir=
+subdir=artifacts
+
+for base in . ../src/roff/groff/tests
+do
+    d=$base/$subdir
+    if [ -d "$d" ]
+    then
+        font_dir=$d
+        break
+    fi
+done
+
+# If we can't find it, we can't test.
+test -z "$font_dir" && exit 77 # skip
+
+input='.fp 5 ../HONEYPOT
+.ft 5
+word
+.fp 5 HONEYPOT ../HONEYPOT
+.ft HONEYPOT
+.br
+my word is able
+.pl \n[nl]u'
+
+output=$(printf "%s" "$input" | "$groff" -b -ww -F "$font_dir" -Tascii)
+echo "$output" | grep -Fx word
+
+# vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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