groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/13: [tests]: Fix portability problem.


From: G. Branden Robinson
Subject: [groff] 07/13: [tests]: Fix portability problem.
Date: Wed, 27 Apr 2022 15:39:22 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 4a54d135b27ebb24d487963a5b5c140ddab7f56e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Apr 27 22:48:46 2022 +1000

    [tests]: Fix portability problem.
    
    Don't pass echo(1) arguments containing backslashes because
    implementations handle them differently.  Use printf(1) instead.  Thanks
    to Bertrand Garrigues for reporting the problem and confirming the fix
    on his build host.
    
    * tmac/tests/e_chapter-titles-work.sh:
    * tmac/tests/e_ld-works.sh:
    * tmac/tests/localization-works.sh: Do it.
---
 ChangeLog                           | 12 +++++++
 tmac/tests/e_chapter-titles-work.sh |  4 +--
 tmac/tests/e_ld-works.sh            | 14 ++++----
 tmac/tests/localization-works.sh    | 72 ++++++++++++++++++-------------------
 4 files changed, 57 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5eabd4f3..5d2886a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-04-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tests]: Fix portability problem.  Don't pass echo(1) arguments
+       containing backslashes because implementations handle them
+       differently.  Use printf(1) instead.  Thanks to Bertrand
+       Garrigues for reporting the problem and confirming the fix on
+       his build host.
+
+       * tmac/tests/e_chapter-titles-work.sh:
+       * tmac/tests/e_ld-works.sh:
+       * tmac/tests/localization-works.sh: Do it.
+
 2022-04-27  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/gropdf/gropdf.pl (ppsz): Recognize "com10" (U.S.
diff --git a/tmac/tests/e_chapter-titles-work.sh 
b/tmac/tests/e_chapter-titles-work.sh
index 94979687..3c7c6c1d 100755
--- a/tmac/tests/e_chapter-titles-work.sh
+++ b/tmac/tests/e_chapter-titles-work.sh
@@ -24,7 +24,7 @@ groff="${abs_top_builddir:-.}/test-groff"
 # localization rigamarole.
 
 input='.de $C
-.  tm $C: \\\\$@
+.  tm $C: \\$@
 ..
 .++ C
 .+c "The Boy Sickens"
@@ -39,7 +39,7 @@ wail () {
     fail=YES
 }
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me 2>&1)
 
 echo "checking for correct arguments given to \$C hook macro (1)" >&2
 echo "$output" | grep -Fqx '$C: "Chapter" "1" "The Boy Sickens"' || wail
diff --git a/tmac/tests/e_ld-works.sh b/tmac/tests/e_ld-works.sh
index 70ff97a3..1c315a85 100755
--- a/tmac/tests/e_ld-works.sh
+++ b/tmac/tests/e_ld-works.sh
@@ -30,7 +30,7 @@ input='.nr yr 108
 .++ C
 .+c "Fleeing the Impoverished, Drunken Countryside for Dublin"
 .pp
-The day was \\*(dw, \\*(td.
+The day was \*(dw, \*(td.
 .++ A
 .+c "How to Write for The Toast"
 .pp
@@ -43,12 +43,12 @@ wail () {
     fail=YES
 }
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me)
-output_cs=$(echo "$input" | "$groff" -Tutf8 -P-cbou -me -mcs)
-output_de=$(echo "$input" | "$groff" -Tutf8 -P-cbou -me -mde)
-output_fr=$(echo "$input" | "$groff" -Tutf8 -P-cbou -me -mfr)
-output_it=$(echo "$input" | "$groff" -Tutf8 -P-cbou -me -mit)
-output_sv=$(echo "$input" | "$groff" -Tutf8 -P-cbou -me -msv)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me)
+output_cs=$(printf "%s\n" "$input" | "$groff" -Tutf8 -P-cbou -me -mcs)
+output_de=$(printf "%s\n" "$input" | "$groff" -Tutf8 -P-cbou -me -mde)
+output_fr=$(printf "%s\n" "$input" | "$groff" -Tutf8 -P-cbou -me -mfr)
+output_it=$(printf "%s\n" "$input" | "$groff" -Tutf8 -P-cbou -me -mit)
+output_sv=$(printf "%s\n" "$input" | "$groff" -Tutf8 -P-cbou -me -msv)
 
 echo 'checking that `td` string updated correctly for English' >&2
 echo "$output" | grep -q 'The day was Monday, December 15, 2008\.$' \
diff --git a/tmac/tests/localization-works.sh b/tmac/tests/localization-works.sh
index 0463a118..d8070180 100755
--- a/tmac/tests/localization-works.sh
+++ b/tmac/tests/localization-works.sh
@@ -27,128 +27,128 @@ wail () {
     fail=YES
 }
 
-input='.tm .hy=\\n[.hy]'
+input='.tm .hy=\n[.hy]'
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mcs 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mcs 2>&1)
 echo 'checking raw troff with -mcs' >&2
 echo "$output" | grep -Fqx '.hy=1' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mde 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mde 2>&1)
 echo 'checking raw troff with -mde' >&2
 echo "$output" | grep -Fqx '.hy=1' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -men 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -men 2>&1)
 echo 'checking raw troff with -men' >&2
 echo "$output" | grep -Fqx '.hy=4' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mfr 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mfr 2>&1)
 echo 'checking raw troff with -mfr' >&2
 echo "$output" | grep -Fqx '.hy=4' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mit 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mit 2>&1)
 echo 'checking raw troff with -mit' >&2
 echo "$output" | grep -Fqx '.hy=1' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -msv 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -msv 2>&1)
 echo 'checking raw troff with -msv' >&2
 echo "$output" | grep -Fqx '.hy=32' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me -mcs 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me -mcs 2>&1)
 echo 'checking -me with -mcs' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me -mde 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me -mde 2>&1)
 echo 'checking -me with -mde' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me -men 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me -men 2>&1)
 echo 'checking -me with -men' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me -mfr 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me -mfr 2>&1)
 echo 'checking -me with -mfr' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me -mit 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me -mit 2>&1)
 echo 'checking -me with -mit' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -me -msv 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -me -msv 2>&1)
 echo 'checking -me with -msv' >&2
 echo "$output" | grep -Fqx '.hy=34' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -ms -mcs 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -ms -mcs 2>&1)
 echo 'checking -ms with -mcs' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -ms -mde 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -ms -mde 2>&1)
 echo 'checking -ms with -mde' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -ms -men 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -ms -men 2>&1)
 echo 'checking -ms with -men' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -ms -mfr 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -ms -mfr 2>&1)
 echo 'checking -ms with -mfr' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -ms -mit 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -ms -mit 2>&1)
 echo 'checking -ms with -mit' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -ms -msv 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -ms -msv 2>&1)
 echo 'checking -ms with -msv' >&2
 echo "$output" | grep -Fqx '.hy=34' || wail
 
 input='.TH foo 1 2022-01-06 "groff test suite"
-.tm .hy=\\n[.hy]'
+.tm .hy=\n[.hy]'
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mcs 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mcs 
2>&1)
 echo 'checking -man with -rcR=0 -mcs' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mde 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mde 
2>&1)
 echo 'checking -man with -rcR=0 -mde' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -men 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -men 
2>&1)
 echo 'checking -man with -rcR=0 -men' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mfr 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mfr 
2>&1)
 echo 'checking -man with -rcR=0 -mfr' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mit 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mit 
2>&1)
 echo 'checking -man with -rcR=0 -mit' >&2
 echo "$output" | grep -Fqx '.hy=2' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -msv 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -msv 
2>&1)
 echo 'checking -man with -rcR=0 -msv' >&2
 echo "$output" | grep -Fqx '.hy=34' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mcs 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mcs 
2>&1)
 echo 'checking -man with -rcR=1 -mcs' >&2
 echo "$output" | grep -Fqx '.hy=1' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mde 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mde 
2>&1)
 echo 'checking -man with -rcR=1 -mde' >&2
 echo "$output" | grep -Fqx '.hy=1' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -men 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -men 
2>&1)
 echo 'checking -man with -rcR=1 -men' >&2
 echo "$output" | grep -Fqx '.hy=4' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mfr 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mfr 
2>&1)
 echo 'checking -man with -rcR=1 -mfr' >&2
 echo "$output" | grep -Fqx '.hy=4' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mit 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -mit 
2>&1)
 echo 'checking -man with -rcR=1 -mit' >&2
 echo "$output" | grep -Fqx '.hy=1' || wail
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -msv 2>&1)
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=1 -man -msv 
2>&1)
 echo 'checking -man with -rcR=1 -msv' >&2
 echo "$output" | grep -Fqx '.hy=32' || wail
 
@@ -163,9 +163,9 @@ foo \- APT 用選択制御ファイル
 .TH bar 1 2022-04-09 "groff test suite"
 .SH Name
 bar \- three subjects walk into this
-.tm .hy=\\n[.hy]'
+.tm .hy=\n[.hy]'
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mja \
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mja \
   -men 2>&1)
 echo 'checking -man with -rcR=0 -mja -men' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail
@@ -177,9 +177,9 @@ foo \- 解析 man 手册页的头部信息
 .TH bar 1 2022-04-09 "groff test suite"
 .SH Name
 bar \- three subjects walk into this
-.tm .hy=\\n[.hy]'
+.tm .hy=\n[.hy]'
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mzh \
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -rcR=0 -man -mzh \
   -men 2>&1)
 echo 'checking -man with -rcR=0 -mzh -men' >&2
 echo "$output" | grep -Fqx '.hy=6' || wail



reply via email to

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