bugGNU troff - Bugs: bug #55941, [PATCH] test-nroff: Create this...

 
 

bug #55941: [PATCH] test-nroff: Create this file to accompany "test-groff"

Submitted by:  Bjarni Ingi Gislason <bjarniig>
Submitted on:  Sun 17 Mar 2019 05:14:36 PM UTC  
 
Category:  None Severity:  1 - Wish
Item Group:  New feature Status:  Wont Fix
Privacy:  Public Assigned to:  G. Branden Robinson <gbranden>
Open/Closed:  Closed Planned Release:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 13 Feb 2020 10:40:19 AM UTC, comment #4: 

I have a new appreciation for Bjarni's request now that I've had to actually write a test for nroff.  :P

Because of the variable runtime environment, influenced by the configuration parameters, we can't just ship canned tests for it: we have to generate them, then run them.

I solved this problem in dd725dce808dcff643d33f180ed7ac73e32b0760 but it took a little bit of effort and thought, mainly due to my lack of familiarity with automake.

Just a comment.  Future nroff tests can ape my example and we still won't need a 'test-nroff', but if generating the tests comes to be viewed as ugly or excessively weighty, it might be wise to reconsider this report.

G. Branden Robinson <gbranden>
Project MemberIn charge of this item.
Sat 18 Jan 2020 05:47:35 AM UTC, comment #3: 

I concur with Dave and Ingo.  `test-groff` is nice and convenient but I don't think we need any other special wrappers.

Also, we really need more unit and regression tests, and we're slowly getting them.

(I guess you could say test-groff serves as a kind of integration test.  It doesn't quite simulate an installation environment, but  once I learned how it works I realized it comes pretty close.)

I also don't quite grasp Bjarni's original use case.

Why

DEFINE nroff test-nroff -mandoc -rF=0

when you could just as easily

DEFINE nroff nroff -whatever -options -you -like

As Dave noted in #57510, there is a bit of tension between nroff and {g,t}roff in that the former does locale detection but lacks a -P option.  The locale detection in particular makes it not a simple subsetted compatibility wrapper for troff as it claims to be.

But since it's my intention to add -P to nroff, I think we can get the best of both worlds.

I'm closing this as wontfix for now, but if Bjarni can come up with a more compelling argument for test-nroff I could reconsider.

G. Branden Robinson <gbranden>
Project MemberIn charge of this item.
Tue 19 Mar 2019 04:10:42 PM UTC, comment #2: 

This complicates matters a small amount for a small benefit.

Yes, if you want to do elaborate testing, you should install the package.  But if you want to do a simple test with the latest source code, perhaps to check whether some unexpected behavior in a release version also occurs with the current development code (I often do this before opening a bug report), test-groff is helpful.  test-nroff would be also.

Helpful enough to justify the extra installation complexity and maintenance?  Perhaps not.  I don't feel strongly about it either way.

Dave <barx>
Mon 18 Mar 2019 06:36:08 AM UTC, comment #1: 

This complicates matters for no benefit and should be rejected.
Having ad-hoc kludges like this merely hinders maintenance.
If you want to do elaborate testing, simply install the damn thing and be done with it.
Testing done without installation is worth almost nothing anyway because errors in installation procedures are about as common as other errors, in particular in very stable software like groff.

I'm not closing this ticket right away in case others disagree, but i think if another developer agrees, they should just close this ticket with Status: "Wont Fix".

Ingo Schwarze <schwarze>
Project Member
Sun 17 Mar 2019 05:14:36 PM UTC, original submission:  

From ba025a18d7eaeac4106cc041f5707e2530daced9 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Sun, 17 Mar 2019 16:44:35 +0000
Subject: [PATCH] test-nroff: Create this file to accompany "test-groff"

  The "man-db" software can use a file "$HOME/.manpath", where
the actual commands for "troff" and "nroff" can be defined.

  Example:

DEFINE troff test-groff -mandoc -rF=0
DEFINE nroff test-nroff -mandoc -rF=0

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 Makefile.am                  |  8 ++++---
 src/roff/nroff/test-nroff.am | 42 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 src/roff/nroff/test-nroff.am

diff --git a/Makefile.am b/Makefile.am
index 4cdd8c1a..59d69a40 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -702,6 +702,7 @@ include $(top_srcdir)/src/preproc/tbl/tbl.am
include $(top_srcdir)/src/roff/groff/groff.am
include $(top_srcdir)/src/roff/grog/grog.am
include $(top_srcdir)/src/roff/nroff/nroff.am
+include $(top_srcdir)/src/roff/nroff/test-nroff.am
include $(top_srcdir)/src/roff/troff/troff.am
include $(top_srcdir)/src/utils/addftinfo/addftinfo.am
include $(top_srcdir)/src/utils/afmtodit/afmtodit.am
@@ -723,8 +724,8 @@ include $(top_srcdir)/tmac/tmac.am
# src/roff/groff/groff.$(OBJEXT): defs.h)
BUILT_SOURCES += defs.h

-# Force generation of test-groff even though we don't ship it.
-BUILT_SOURCES += test-groff
+# Force generation of test-groff and test-nroff even though we don't ship it.
+BUILT_SOURCES += test-groff test-nroff

# if there is a name prefix we install the man pages by hand
all: generate_man_files
@@ -857,7 +858,8 @@ EXTRA_DIST += \
MOSTLYCLEANFILES += $(prefixexecbin_SCRIPTS) $(bin_SCRIPTS) \
   $(man1_MANS) $(man5_MANS) $(man7_MANS) \
   $(PREFIXMAN1) \
-  test-groff
+  test-groff \
+  test-nroff

# Suffix rule to build .1, .5 and .7 files from .1.man, .5.man and
# .7.man files.  The brackets around the @ are used to prevent the
diff --git a/src/roff/nroff/test-nroff.am b/src/roff/nroff/test-nroff.am
new file mode 100644
index 00000000..182fe86d
--- /dev/null
+++ b/src/roff/nroff/test-nroff.am
@@ -0,0 +1,42 @@
+# Copyright (C) 2014-2018 Free Software Foundation, Inc.
+#
+# Latest update: 15 Mar 2019
+#
+# 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/>.
+
+# Script SH_DEPS_SED_SCRIPT (shdeps.sed) is not needed for a POSIX
+# compliant system, see the script shdeps.sh.
+
+test-nroff: $(nroff_srcdir)/nroff.sh $(SH_DEPS_SED_SCRIPT) $(nroff_srcdir)/test-nroff.am
+        $(AM_V_GEN)rm -f $@ \
+        && sed        -e $(SH_SCRIPT_SED_CMD) \
+                -e "s|[@]VERSION[@]|$(VERSION)|" \
+                -e 's/Emulate nroff with groff/Emulate test-nroff with test-groff/' \
+                -e 's/GNU nroff /GNU test-nroff /' \
+                -e 's/usage: nroff /usage: test-nroff /' \
+                -e '/^. Set up the /,/^export GROFF_BIN_PATH/d' \
+                -e 's|PATH=.*groff |@abs_top_builddir@/groff |' \
+                -e 's/groff -mtty-char /test-groff -mtty-char /' \
+                $(nroff_srcdir)/nroff.sh \
+                >$@ \
+        && chmod +x $@
+
+
+########################################################################
+### Emacs settings
+# Local Variables:
+# mode: makefile-automake
+# End:
--
2.20.1

Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by barx (Posted a comment)
  • -email is unavailable- added by schwarze (Posted a comment)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-18 gbranden StatusNone => Wont Fix
        Assigned toNone => gbranden
        Open/ClosedOpen => Closed
    2019-03-18 schwarze Severity3 - Normal => 1 - Wish

    Back to the top


    Powered by Savane 3.5