diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2020-04-13 21:33:19 +1000 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2020-04-13 21:33:19 +1000 |
commit | e44b590c872aa7d334cfceab0b40ac7291684541 (patch) | |
tree | 1abfc90434b8ac00a5d6504660a81a29a3062443 | |
parent | 642353ef06b3c2b49f74b71e0d5ecdfa866fe3de (diff) | |
download | groff-git-e44b590c872aa7d334cfceab0b40ac7291684541.tar.gz |
Catch nroff/groff version desync.
Note that this commit will likely lead to a failing test case (but
perhaps not, if your build environment lacks a system groff).
It's too easy for the nroff version to get desynced from the groff
version when we're running test cases, leading to spurious results.
Make it easier to see a discrepancy.
* src/roff/nroff/nroff.sh: Call groff with -v or --version when we are
called that way.
* src/roff/nroff/tests/verbose_option_works.sh.in: Check the nroff
version being tested against the groff version being wrapped. This
exposes a bug; the system groff rather than the build tree groff was
being invoked.
Also delete an old comment in nroff.sh. The file uses the Stephen
Bourne "brace style" now, so the issue is unlikely to recur.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | src/roff/nroff/nroff.sh | 4 | ||||
-rwxr-xr-x | src/roff/nroff/tests/verbose_option_works.sh.in | 9 |
3 files changed, 24 insertions, 3 deletions
@@ -1,5 +1,19 @@ 2020-04-13 G. Branden Robinson <g.branden.robinson@gmail.com> + It's too easy for the nroff version to get desynced from the + groff version when we're running test cases, leading to spurious + results. Make it easier to see a discrepancy. + + * src/roff/nroff/nroff.sh: Call groff with -v or --version when + we are called that way. + + * src/roff/nroff/tests/verbose_option_works.sh.in: Check the + nroff version being tested against the groff version being + wrapped. This exposes a bug; the system groff rather than the + build tree groff was being invoked. + +2020-04-13 G. Branden Robinson <g.branden.robinson@gmail.com> + Make our assert() C99-conformant. groff has its own implementation of the standard C library's diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh index 220ccdb81..ccddddbe2 100644 --- a/src/roff/nroff/nroff.sh +++ b/src/roff/nroff/nroff.sh @@ -59,8 +59,6 @@ case "`exec 2>/dev/null ; locale charmap`" in esac ;; esac -# 'for i; do' (with the semicolon) doesn't work with some versions of sh - Topt= opts= dry_run= @@ -93,7 +91,7 @@ do dry_run=yes ;; -v | --version) echo "GNU nroff (groff) version @VERSION@" - exit 0 ;; + opts="$opts $1" ;; --help) cat <<EOF usage: nroff [-cChipStUV] [-dCS] [-mNAME] [-MDIR] [-nNUM] [-oLIST] diff --git a/src/roff/nroff/tests/verbose_option_works.sh.in b/src/roff/nroff/tests/verbose_option_works.sh.in index f30fa8dd3..4f9086c2f 100755 --- a/src/roff/nroff/tests/verbose_option_works.sh.in +++ b/src/roff/nroff/tests/verbose_option_works.sh.in @@ -23,8 +23,17 @@ export LC_ALL=C # Ensure a predictable command search path. @GROFF_BIN_PATH_SETUP@ +set -e + nroff="${abs_top_builddir:-.}/nroff" +nroff_ver=$("$nroff" -v | awk 'NR == 1 {print $NF}') +groff_ver=$("$nroff" -v | awk 'NR == 2 {print $NF}') + +echo nroff: $nroff_ver >&2 +echo groff: $groff_ver >&2 +test "$nroff_ver" = "$groff_ver" + echo "testing 'nroff -V'" >&2 expected="PATH=$GROFF_RUNTIME$PATH groff -Tascii -mtty-char" actual=$("$nroff" -V) |