groff
[Top][All Lists]
Advanced

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

Re: GNUism in groff tests


From: Ingo Schwarze
Subject: Re: GNUism in groff tests
Date: Mon, 30 Dec 2019 18:12:58 +0100
User-agent: Mutt/1.12.2 (2019-09-21)

Hi,

here is a patch to make the test suite portable.

Do you think something like this should be done?

Problems fixed:

 - The lone "'" inside the here document inside $() results in
   ./src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh[36]: no closing quote
   with ksh.  So much quoting and escaping is hard to read either way.

 - The <() syntax looks like a GNUism to me.

 - Everything else doesn't appear to actually require bash(1).

Yours,
  Ingo


diff --git a/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh 
b/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh
index a0d81f19..20406333 100755
--- a/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh
+++ b/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
@@ -22,10 +22,10 @@ groff="${abs_top_builddir:-.}/test-groff"
 
 expected="' = '"
 
-actual=$("$groff" -Tlatin1 <<EOF
-.pl 1v
-\[oq] = '
-EOF
-)
+actual=$(printf ".pl 1v\n\\\\[oq] = '\n" | "$groff" -Tlatin1)
 
-diff -u <(echo "$expected") <(echo "$actual")
+test "X$actual" = "X$expected" && exit 0
+
+echo "expected: $expected"
+echo "actual:   $actual"
+exit 1
diff --git a/src/roff/groff/tests/string_case_xform_errors.sh 
b/src/roff/groff/tests/string_case_xform_errors.sh
index 56f322d7..3fcae68f 100755
--- a/src/roff/groff/tests/string_case_xform_errors.sh
+++ b/src/roff/groff/tests/string_case_xform_errors.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
@@ -27,4 +27,8 @@ actual=$("$groff" -Tutf8 2>&1 <<EOF
 EOF
 )
 
-diff -u <(echo "$expected") <(echo "$actual")
+test "X$actual" = "X$expected" && exit 0
+
+echo "expected: $expected"
+echo "actual:   $actual"
+exit 1
diff --git a/src/roff/groff/tests/string_case_xform_requests.sh 
b/src/roff/groff/tests/string_case_xform_requests.sh
index a5f4c955..42367dcc 100755
--- a/src/roff/groff/tests/string_case_xform_requests.sh
+++ b/src/roff/groff/tests/string_case_xform_requests.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
@@ -33,4 +33,8 @@ actual=$("$groff" -Tutf8 <<EOF
 EOF
 )
 
-diff -u <(echo "$expected") <(echo "$actual")
+test "X$actual" = "X$expected" && exit 0
+
+echo "expected: $expected"
+echo "actual:   $actual"
+exit 1
diff --git a/src/roff/groff/tests/string_case_xform_unicode_escape.sh 
b/src/roff/groff/tests/string_case_xform_unicode_escape.sh
index 8f9e3906..3d686855 100755
--- a/src/roff/groff/tests/string_case_xform_unicode_escape.sh
+++ b/src/roff/groff/tests/string_case_xform_unicode_escape.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
@@ -38,4 +38,8 @@ actual=$("$groff" -Tutf8 2>&1 > /dev/null <<EOF
 EOF
 )
 
-diff -u <(echo "$expected") <(echo "$actual")
+test "X$actual" = "X$expected" && exit 0
+
+echo "expected: $expected"
+echo "actual:   $actual"
+exit 1
diff --git a/tmac/tests/an-old_CS_register_off.sh 
b/tmac/tests/an-old_CS_register_off.sh
index d896233d..1990c2f7 100755
--- a/tmac/tests/an-old_CS_register_off.sh
+++ b/tmac/tests/an-old_CS_register_off.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
diff --git a/tmac/tests/an-old_CS_register_on.sh 
b/tmac/tests/an-old_CS_register_on.sh
index 5dfca32a..7ba59fe7 100755
--- a/tmac/tests/an-old_CS_register_on.sh
+++ b/tmac/tests/an-old_CS_register_on.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
diff --git a/tmac/tests/an-old_CS_register_unspecified.sh 
b/tmac/tests/an-old_CS_register_unspecified.sh
index e53924cd..cbb26595 100755
--- a/tmac/tests/an-old_CS_register_unspecified.sh
+++ b/tmac/tests/an-old_CS_register_unspecified.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
diff --git a/tmac/tests/an-old_CT_register_off.sh 
b/tmac/tests/an-old_CT_register_off.sh
index 38ee37f0..f4e51b8a 100755
--- a/tmac/tests/an-old_CT_register_off.sh
+++ b/tmac/tests/an-old_CT_register_off.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
diff --git a/tmac/tests/an-old_CT_register_on.sh 
b/tmac/tests/an-old_CT_register_on.sh
index e6ca1ce2..1adde461 100755
--- a/tmac/tests/an-old_CT_register_on.sh
+++ b/tmac/tests/an-old_CT_register_on.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #
diff --git a/tmac/tests/an-old_CT_register_unspecified.sh 
b/tmac/tests/an-old_CT_register_unspecified.sh
index cf1ce121..4977faa5 100755
--- a/tmac/tests/an-old_CT_register_unspecified.sh
+++ b/tmac/tests/an-old_CT_register_unspecified.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # Copyright (C) 2019 Free Software Foundation, Inc.
 #



reply via email to

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