bugGNU roff - Bugs: bug #59461, smoke-test_html_device.sh: make...

 
 

bug #59461: smoke-test_html_device.sh: make the test more independent of locale

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Fri 13 Nov 2020 06:02:49 PM UTC
   
 
Category:  Preprocessor html Severity:  3 - Normal
Item Group:  Test Status:  Rejected
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 02 Jun 2022 10:27:14 PM UTC, comment #5: 

No follow-up to "Need Info" status for about 18 months.

Resolving as "Won't Fix".

G. Branden Robinson <gbranden>
Group administrator
Mon 16 Nov 2020 01:08:38 PM UTC, comment #4: 

Bjarni, I don't feel your reply was responsive to my comment #2.

"This is a smoke test; it's there to make sure the HTML preprocessor and output driver (post-grohtml) don't SEGV or fail to produce output at all.

Careful consideration of locale support in HTML documents generated by groff should be developed in dedicated tests."

You are proposing adding stuff to the test that makes it longer without accomplishing any marginal benefit over the existing test infrastructure.

For instance, you don't need to test if test-groff exists and is executable, if it's not, it won't run, and tons of tests will fail, alerting the developer that something has gone badly wrong.  And a groff test suite, properly considered, doesn't need to test anything outside the build tree (and its corresponding source tree for non-generated files).

The audience for unit tests/regression tests is developers familiar with the software under test.  Handholding of confused users is a distraction from the task at hand.

If you're developing these for your own different purposes, to run against test-groff when available and against the system groff otherwise, that's fine, but it renders them inappropriate for incorporation into the test suite in the source tree.

I encourage you to experiment and explore, but I would ask that you not use Savannah to propose such materials for adoption by the project.  The mailing list is a more appropriate forum for sharing and discussion.

Regards,
Branden

G. Branden Robinson <gbranden>
Group administrator
Mon 16 Nov 2020 02:02:47 AM UTC, comment #3: 

  I am expanding the scope of the tests,
to test as many of them without a specific charmap interfering.

  Additionally to a missing "unset GROFF_ENCODING",
an "export" was missing in front of "LC_CTYPE=C.UTF-8".

  Oder of the tests matters.

  Not using "preconv" can matter.

  The test can be made variable with "LC_ALL=..." in front of the file.

  This is an improved version of the test file:

#!/bin/sh
#
groff="${abs_top_builddir:-.}/test-groff"

if test -x $groff;
then
  :
else
  groff=test-groff
  if command -v $groff > /dev/null
  then
    :
  else
    groff=groff
  fi
fi

echo Used groff is `which "$groff"`

#set -e

unset GROFF_ENCODING

echo 'testing -C -Thtml with'" \('a" >&2
printf "\('a" | "$groff" -C -Thtml | grep -qx '<p>&aacute;</p>' || \
  { echo Test failed >&2; exit 1; }

echo 'testing -C -Thtml with á' >&2
printf 'á' | "$groff" -C -Thtml | grep -qx '<p>&aacute;</p>' || \
  { echo Test failed >&2; exit 1; }

echo 'testing -Thtml with -Kutf8' >&2

export LC_CTYPE=C.UTF-8

test "$(locale charmap)" = UTF-8 || { echo charmap failed >&2; exit 77; } # skip
printf '\303\241' | "$groff" -Kutf8 -Thtml | grep -qx '<p>&aacute;</p>' ||\
  { echo Test failed >&2; exit 1; }


Bjarni Ingi Gislason <bjarniig>
Sun 15 Nov 2020 11:43:20 AM UTC, comment #2: 

What are you trying to achieve?  This is a smoke test; it's there to make sure the HTML preprocessor and output driver (post-grohtml) don't SEGV or fail to produce output at all.

Careful consideration of locale support in HTML documents generated by groff should be developed in dedicated tests.

I am inclined to regard this report as invalid unless its scope can be redrawn.

G. Branden Robinson <gbranden>
Group administrator
Fri 13 Nov 2020 07:57:10 PM UTC, comment #1: 

  unset GROFF_ENCODING

must be added to eliminate an external influence.

Bjarni Ingi Gislason <bjarniig>
Fri 13 Nov 2020 06:02:49 PM UTC, original submission:  

src/roff/groff/tests/smoke-test_html_device.sh:
  make the test more independent of the locale charset (charmap).

  Only test "locale" for the existence of a UTF-8 locale on the
computer.
(This might even be irrelevant.)

  As the encoding of the input is known, use that information.

  That is, change the option '-k' to '-Kutf8' for UTF-8 input,
and remove it for ascii input.

  Add a test for latin1 input.

  This was tested with

"locale charmap": ISO-8859-1

  and

"locale -a":

C
C.UTF-8
icelandic
is_IS
is_IS.iso88591
is_IS.utf8
POSIX

  A test without any UTF-8 locale file on the computer is missing (test
without the "locale -a | ...").

###

  Script to test changes:


#!/bin/sh

set -e

groff=/usr/bin/groff

# Check three forms of character transformation.
#

# We test compatibility-mode HTML output somewhat differently from the
# third test
# since preconv only emits groffish \[uXXXX] escapes for non-ASCII
# codepoints.

# 1)

echo "testing -C -Thtml with \"\('a\"" >&2
printf "\('a" | "$groff" -C -Thtml | grep -qx '<p>&aacute;</p>'

# 2)

echo "testing -C -Thtml with \"\('a\" as a latin1 code" >&2
printf "á" | "$groff" -C -Thtml | grep -qx '<p>&aacute;</p>'

# 3)
# We possibly can't run this tests, if no file for a UTF-8 locale exists

locale -a | grep -F -q UTF-8 || exit 77 # skip

# dash's built-in printf doesn't support \x or \u escapes, so likely
# other shells don't either, and expecting one, that does, to be in the
# $PATH seems optimistic.  So use UTF-8 octal bytes directly.

echo "testing -Kutf8 -Thtml" >&2
printf '\303\241' | "$groff" -Kutf8 -Thtml | grep -qx '<p>&aacute;</p>'

## End of script


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 bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-06-02 gbranden StatusNeed Info Rejected
        Assigned toNone gbranden
        Open/ClosedOpen Closed
    2020-11-15 gbranden StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code