[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 05/09: Adapt tests to feeble systems.
From: |
G. Branden Robinson |
Subject: |
[groff] 05/09: Adapt tests to feeble systems. |
Date: |
Wed, 4 Dec 2024 09:51:22 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 2514dc63e0dbcc45e03e8aa0d18ca873bd6b8944
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Dec 3 16:57:24 2024 -0600
Adapt tests to feeble systems.
...lacking a shell or grep conforming to POSIX Issue 4 (1994).
* src/roff/groff/tests/msoquiet-request-works.sh:
* src/roff/groff/tests/soquiet-request-works.sh:
* tmac/tests/an_UR-works.sh: Do it.
* tmac/tests/an_UR-works.sh: Also cope with versions of pdftotext(1)
that transcribe "fi" as a ligature.
* HACKING:
* PROBLEMS: Update advice.
---
ChangeLog | 15 ++++++++
HACKING | 30 ++++++++++++++++
PROBLEMS | 50 ++------------------------
src/roff/groff/tests/msoquiet-request-works.sh | 10 ++++--
src/roff/groff/tests/soquiet-request-works.sh | 10 ++++--
tmac/tests/an_UR-works.sh | 14 ++++++--
6 files changed, 76 insertions(+), 53 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 44ecfd6af..332df7884 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-12-03 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ Adapt tests to feeble systems lacking a shell or grep conforming
+ to POSIX Issue 4 (1994).
+
+ * src/roff/groff/tests/msoquiet-request-works.sh:
+ * src/roff/groff/tests/soquiet-request-works.sh:
+ * tmac/tests/an_UR-works.sh: Do it.
+
+ * tmac/tests/an_UR-works.sh: Also cope with versions of
+ pdftotext(1) that transcribe "fi" as a ligature.
+
+ * HACKING:
+ * PROBLEMS: Update advice.
+
2024-12-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/main.cpp (usage): If asked for `--help`,
diff --git a/HACKING b/HACKING
index 9a2118a11..b2b4a1533 100644
--- a/HACKING
+++ b/HACKING
@@ -246,9 +246,39 @@ Here are some portability notes on writing automated tests.
};
}
+* Solaris 10 cksum's output is non-conforming with XPG4. It uses tabs
+ as field delimiters instead of spaces.
+
* Solaris 10 tr exits with an error if you try to use a POSIX character
class (such as "[:cntrl:]") in any locale but "C".
+* Solaris 10's /usr/xpg4/bin/sh is non-conforming with XPG4.
+ (Good job, guys!)
+
+ Its "unset" builtin is buggy. (The /usr/bin/sh in Solaris 11 does not
+ have this problem.)
+
+ We sometimes must use the "unset" shell builtin command to prevent
+ environment variables from confounding test results.
+
+ POSIX says "[u]nsetting a variable ... that was not previously set is
+ not considered an error and will not cause the shell to abort."
+
+ Nevertheless this builtin returns an error exit status in this
+ circumstance.
+
+ $ /usr/xpg4/bin/sh -c 'unset _NON_EXISTENT_XYZ; echo $?'
+ 1
+
+ You may want to check for this misbehavior and skip the test if
+ running under an afflicted shell.
+
+ if ! unset VARIABLE_OF_INTEREST
+ then
+ echo "unable to clear environment; skipping" >&2
+ exit 77
+ fi
+
Updating gnulib
---------------
diff --git a/PROBLEMS b/PROBLEMS
index 41df65b10..774716395 100644
--- a/PROBLEMS
+++ b/PROBLEMS
@@ -855,55 +855,11 @@ For Solaris 10, it is necessary to modify the shell-based
test scripts
in place to use a conforming shell. Here is an example.
$ gsed -i -e '1s@#!/bin/sh@#!/usr/xpg4/bin/sh@' \
- `find . -name '*.sh' | grep /tests/`
+ `find . -name '*.sh' | egrep '/(examples|tests)/'`
+ $ gsed -i -e '1s@#!/bin/sh@#!/usr/xpg4/bin/sh@' \
+ `find . -name '*.sh.in' | egrep '/(examples|tests)/'`
$ PATH=/usr/xpg4/bin:$PATH gmake check
-Some test failures remain expected on Solaris 10 and/or 11.
-
-1. FAIL: contrib/hdtbl/examples/test-hdtbl.sh
-
- /usr/bin/tr on Solaris 10 is non-conforming with the POSIX Issue 4
- standard. It furthermore issues anonymous diagnostics, saying only
- "Bad string".
-
- Install tr from GNU coreutils in the $PATH. Edit line 57 of each of
- contrib/hdtbl/examples/fonts_x.in and
- contrib/hdtbl/examples/fonts_n.in. Change "tr" to "gtr".
- Alternatively, you can use the absolute path to GNU tr's location.
- Re-run "gmake check" as above. (Some files will be rebuilt.)
-
- The tr commands in /usr/xpg4/bin and /usr/xpg6/bin also work, but
- the documents constructed from the above inputs use groff's `pso`
- request, which wraps the standard C library `popen()` function,
- which sanitizes $PATH to avoid privilege escalation, thus making it
- likely that the non-conforming tr in /usr/bin will be found first.
-
-2. FAIL: src/roff/groff/tests/initialization_is_quiet.sh
- FAIL: src/roff/groff/tests/msoquiet_works.sh
- FAIL: src/roff/groff/tests/soquiet_works.sh
-
- (The first of these might be SKIPped instead.)
-
- /usr/xpg4/bin/sh is non-conforming with the POSIX Issue 4 standard,
- despite its name. Its "unset" builtin is buggy. (The /usr/bin/sh
- in Solaris 11 does not have this problem.)
-
- These tests use the "unset" shell builtin command to prevent
- environment variables from confounding test results.
-
- POSIX says "[u]nsetting a variable ... that was not previously set
- is not considered an error and will not cause the shell to abort."
-
- Nevertheless this builtin returns an error exit status in this
- circumstance.
-
- $ /usr/xpg4/bin/sh -c 'unset _NON_EXISTENT_XYZ; echo $?'
- 1
-
- You may disregard these failures, edit the test scripts to append
- "|| true" to the "unset" commands, or change the scripts to use GNU
- Bash or some other POSIX-conforming shell as illustrated above.
-
----------------------------------------------------------------------
* I get warnings from afmtodit about names already being mapped.
diff --git a/src/roff/groff/tests/msoquiet-request-works.sh
b/src/roff/groff/tests/msoquiet-request-works.sh
index 80c085abb..7705c02b7 100755
--- a/src/roff/groff/tests/msoquiet-request-works.sh
+++ b/src/roff/groff/tests/msoquiet-request-works.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2024 Free Software Foundation, Inc.
#
# This file is part of groff.
#
@@ -23,7 +23,13 @@ groff="${abs_top_builddir:-.}/test-groff"
set -e
# Keep preconv from being run.
-unset GROFF_ENCODING
+#
+# The "unset" in Solaris /usr/xpg4/bin/sh can actually fail.
+if ! unset GROFF_ENCODING
+then
+ echo "unable to clear environment; skipping" >&2
+ exit 77
+fi
DOC='.msoquiet nonexistent'
diff --git a/src/roff/groff/tests/soquiet-request-works.sh
b/src/roff/groff/tests/soquiet-request-works.sh
index e2ea28687..f33c17709 100755
--- a/src/roff/groff/tests/soquiet-request-works.sh
+++ b/src/roff/groff/tests/soquiet-request-works.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2024 Free Software Foundation, Inc.
#
# This file is part of groff.
#
@@ -23,7 +23,13 @@ groff="${abs_top_builddir:-.}/test-groff"
set -e
# Keep preconv from being run.
-unset GROFF_ENCODING
+#
+# The "unset" in Solaris /usr/xpg4/bin/sh can actually fail.
+if ! unset GROFF_ENCODING
+then
+ echo "unable to clear environment; skipping" >&2
+ exit 77
+fi
DOC='.soquiet nonexistent'
diff --git a/tmac/tests/an_UR-works.sh b/tmac/tests/an_UR-works.sh
index 5d126bdc2..bf43df4fb 100755
--- a/tmac/tests/an_UR-works.sh
+++ b/tmac/tests/an_UR-works.sh
@@ -20,6 +20,12 @@
groff="${abs_top_builddir:-.}/test-groff"
+if ! echo foobar | grep -Fqx foobar >/dev/null 2>&1
+then
+ echo "$0: grep command does not support -Fqx options; skipping" >&2
+ exit 77 # skip
+fi
+
fail=
wail() {
@@ -115,10 +121,12 @@ else
fi
echo "$output"
+# The version of pdftotext on Solaris 10 writes 'figure' with an 'fi'
+# ligature.
echo "checking formatting of web URI with link text" \
"(pdf device; hyperlinks disabled)" >&2
# expected: See figure 1 〈http://foo.example.com〉.
-echo "$output" | grep -q 'See figure 1 .*http://foo.example.com.*\.' \
+echo "$output" | grep -q 'See .*gure 1 .*http://foo.example.com.*\.' \
|| wail
echo "checking formatting of web URI with no link text" \
@@ -138,10 +146,12 @@ else
fi
echo "$output"
+# The version of pdftotext on Solaris 10 writes 'figure' with an 'fi'
+# ligature.
echo "checking formatting of web URI with link text" \
"(pdf device; hyperlinks enabled)" >&2
# expected: See figure 1. Or http://bar.example.com.
-echo "$output" | grep -Fq 'See figure 1. Or' || wail
+echo "$output" | grep -q 'See .*gure 1. Or' || wail
echo "checking formatting of web URI with no link text" \
"(pdf device; hyperlinks enabled)" >&2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 05/09: Adapt tests to feeble systems.,
G. Branden Robinson <=