Blame SOURCES/patch-2.7.6-test-suite-compatibility-fixes.patch

0a6a4f
commit f6bc5b14bd193859851d15a049bafb1007acd288
0a6a4f
Author: Andreas Gruenbacher <agruen@gnu.org>
0a6a4f
Date:   Wed Feb 7 12:10:41 2018 +0100
0a6a4f
0a6a4f
    Test suite compatibility fixes
0a6a4f
    
0a6a4f
    * tests/crlf-handling, tests/git-cleanup, tests/test-lib.sh: Use printf
0a6a4f
    instead of echo -e / echo -n for compatibility with systems that don't
0a6a4f
    support these echo options.
0a6a4f
    * tests/merge: Minor other cleanups.
0a6a4f
0a6a4f
diff --git a/tests/crlf-handling b/tests/crlf-handling
0a6a4f
index 239149c..c192cac 100644
0a6a4f
--- a/tests/crlf-handling
0a6a4f
+++ b/tests/crlf-handling
0a6a4f
@@ -14,7 +14,7 @@ use_local_patch
0a6a4f
 use_tmpdir
0a6a4f
 
0a6a4f
 lf2crlf() {
0a6a4f
-    while read l; do echo -e "$l\r"; done
0a6a4f
+    while read l; do printf "%s\r\n" "$l"; done
0a6a4f
 }
0a6a4f
 
0a6a4f
 echo 1 > a
0a6a4f
diff --git a/tests/git-cleanup b/tests/git-cleanup
0a6a4f
index 2e3e4c6..ca527a1 100644
0a6a4f
--- a/tests/git-cleanup
0a6a4f
+++ b/tests/git-cleanup
0a6a4f
@@ -36,8 +36,8 @@ BAD PATCH
0a6a4f
 EOF
0a6a4f
 
0a6a4f
 echo 1 > f
0a6a4f
-echo -n '' > g
0a6a4f
-echo -n '' > h
0a6a4f
+printf '' > g
0a6a4f
+printf '' > h
0a6a4f
 
0a6a4f
 check 'patch -f -i 1.diff || echo status: $?' <
0a6a4f
 patching file f
0a6a4f
diff --git a/tests/merge b/tests/merge
0a6a4f
index 22d787b..b628891 100644
0a6a4f
--- a/tests/merge
0a6a4f
+++ b/tests/merge
0a6a4f
@@ -30,30 +30,28 @@ x2() {
0a6a4f
     while test $# -gt 0 && test "$1" != -- ; do
0a6a4f
 	echo "$1"
0a6a4f
 	shift
0a6a4f
-    done > a.sed
0a6a4f
-    echo "$body" | sed -f a.sed > b
0a6a4f
+    done > b.sed
0a6a4f
+    echo "$body" | sed -f b.sed > b
0a6a4f
     shift
0a6a4f
     while test $# -gt 0 ; do
0a6a4f
 	echo "$1"
0a6a4f
 	shift
0a6a4f
-    done > b.sed
0a6a4f
-    echo "$body" | sed -f b.sed > c
0a6a4f
-    rm -f a.sed b.sed
0a6a4f
+    done > c.sed
0a6a4f
+    echo "$body" | sed -f c.sed > c
0a6a4f
+    rm -f b.sed c.sed
0a6a4f
     output=`diff -u a b | patch $ARGS -f c`
0a6a4f
     status=$?
0a6a4f
     echo "$output" | sed -e '/^$/d' -e '/^patching file c$/d'
0a6a4f
     cat c
0a6a4f
-    test $status == 0 || echo "Status: $status"
0a6a4f
+    test $status = 0 || echo "Status: $status"
0a6a4f
 }
0a6a4f
 
0a6a4f
 x() {
0a6a4f
-    ARGS="$ARGS --merge" x2 "$@"
0a6a4f
+    ARGS="--merge" x2 "$@"
0a6a4f
     echo
0a6a4f
-    ARGS="$ARGS --merge=diff3" x2 "$@"
0a6a4f
+    ARGS="--merge=diff3" x2 "$@"
0a6a4f
 }
0a6a4f
 
0a6a4f
-unset ARGS
0a6a4f
-
0a6a4f
 # ==============================================================
0a6a4f
 
0a6a4f
 check 'x 3' <
0a6a4f
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
0a6a4f
index be0d7e3..661da52 100644
0a6a4f
--- a/tests/test-lib.sh
0a6a4f
+++ b/tests/test-lib.sh
0a6a4f
@@ -41,7 +41,7 @@ use_local_patch() {
0a6a4f
 
0a6a4f
     eval 'patch() {
0a6a4f
 	if test -n "$GDB" ; then
0a6a4f
-	  echo -e "\n" >&3
0a6a4f
+	  printf "\n\n" >&3
0a6a4f
 	  gdbserver localhost:53153 $PATCH "$@" 2>&3
0a6a4f
 	else
0a6a4f
           $PATCH "$@"
0a6a4f
@@ -113,22 +113,15 @@ cleanup() {
0a6a4f
     exit $status
0a6a4f
 }
0a6a4f
 
0a6a4f
-if test -z "`echo -n`"; then
0a6a4f
-    if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
0a6a4f
-	eval '
0a6a4f
-	    _start_test() {
0a6a4f
-		echo -n "[${BASH_LINENO[2]}] $* -- "
0a6a4f
-	    }'
0a6a4f
-    else
0a6a4f
-	eval '
0a6a4f
-	    _start_test() {
0a6a4f
-		echo -n "* $* -- "
0a6a4f
-	    }'
0a6a4f
-    fi
0a6a4f
+if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
0a6a4f
+    eval '
0a6a4f
+	_start_test() {
0a6a4f
+	    printf "[${BASH_LINENO[2]}] %s -- " "$*"
0a6a4f
+	}'
0a6a4f
 else
0a6a4f
     eval '
0a6a4f
 	_start_test() {
0a6a4f
-	    echo "* $*"
0a6a4f
+	    printf "* %s -- " "$*"
0a6a4f
 	}'
0a6a4f
 fi
0a6a4f