Test suite compatibility fixes
* tests/crlf-handling, tests/git-cleanup, tests/test-lib.sh: Use printf instead of echo -e / echo -n for compatibility with systems that don't support these echo options. * tests/merge: Minor other cleanups.
This commit is contained in:
parent
8b9b312dcd
commit
ad2aa68086
134
Test-suite-compatibility-fixes.patch
Normal file
134
Test-suite-compatibility-fixes.patch
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
From 3fc4998f31ffc7dfccfc4a3dde36184475c796ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andreas Gruenbacher <agruen@gnu.org>
|
||||||
|
Date: Wed, 7 Feb 2018 12:10:41 +0100
|
||||||
|
Subject: [PATCH] Test suite compatibility fixes
|
||||||
|
|
||||||
|
* tests/crlf-handling, tests/git-cleanup, tests/test-lib.sh: Use printf
|
||||||
|
instead of echo -e / echo -n for compatibility with systems that don't
|
||||||
|
support these echo options.
|
||||||
|
* tests/merge: Minor other cleanups.
|
||||||
|
|
||||||
|
Signed-off-by: Xibo.Wang <wangxb12@chinatelecom.cn>
|
||||||
|
---
|
||||||
|
tests/crlf-handling | 2 +-
|
||||||
|
tests/git-cleanup | 4 ++--
|
||||||
|
tests/merge | 18 ++++++++----------
|
||||||
|
tests/test-lib.sh | 21 +++++++--------------
|
||||||
|
4 files changed, 18 insertions(+), 27 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/crlf-handling b/tests/crlf-handling
|
||||||
|
index 239149c..c192cac 100644
|
||||||
|
--- a/tests/crlf-handling
|
||||||
|
+++ b/tests/crlf-handling
|
||||||
|
@@ -14,7 +14,7 @@ use_local_patch
|
||||||
|
use_tmpdir
|
||||||
|
|
||||||
|
lf2crlf() {
|
||||||
|
- while read l; do echo -e "$l\r"; done
|
||||||
|
+ while read l; do printf "%s\r\n" "$l"; done
|
||||||
|
}
|
||||||
|
|
||||||
|
echo 1 > a
|
||||||
|
diff --git a/tests/git-cleanup b/tests/git-cleanup
|
||||||
|
index 2e3e4c6..ca527a1 100644
|
||||||
|
--- a/tests/git-cleanup
|
||||||
|
+++ b/tests/git-cleanup
|
||||||
|
@@ -36,8 +36,8 @@ BAD PATCH
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo 1 > f
|
||||||
|
-echo -n '' > g
|
||||||
|
-echo -n '' > h
|
||||||
|
+printf '' > g
|
||||||
|
+printf '' > h
|
||||||
|
|
||||||
|
check 'patch -f -i 1.diff || echo status: $?' <<EOF
|
||||||
|
patching file f
|
||||||
|
diff --git a/tests/merge b/tests/merge
|
||||||
|
index 22d787b..b628891 100644
|
||||||
|
--- a/tests/merge
|
||||||
|
+++ b/tests/merge
|
||||||
|
@@ -30,30 +30,28 @@ x2() {
|
||||||
|
while test $# -gt 0 && test "$1" != -- ; do
|
||||||
|
echo "$1"
|
||||||
|
shift
|
||||||
|
- done > a.sed
|
||||||
|
- echo "$body" | sed -f a.sed > b
|
||||||
|
+ done > b.sed
|
||||||
|
+ echo "$body" | sed -f b.sed > b
|
||||||
|
shift
|
||||||
|
while test $# -gt 0 ; do
|
||||||
|
echo "$1"
|
||||||
|
shift
|
||||||
|
- done > b.sed
|
||||||
|
- echo "$body" | sed -f b.sed > c
|
||||||
|
- rm -f a.sed b.sed
|
||||||
|
+ done > c.sed
|
||||||
|
+ echo "$body" | sed -f c.sed > c
|
||||||
|
+ rm -f b.sed c.sed
|
||||||
|
output=`diff -u a b | patch $ARGS -f c`
|
||||||
|
status=$?
|
||||||
|
echo "$output" | sed -e '/^$/d' -e '/^patching file c$/d'
|
||||||
|
cat c
|
||||||
|
- test $status == 0 || echo "Status: $status"
|
||||||
|
+ test $status = 0 || echo "Status: $status"
|
||||||
|
}
|
||||||
|
|
||||||
|
x() {
|
||||||
|
- ARGS="$ARGS --merge" x2 "$@"
|
||||||
|
+ ARGS="--merge" x2 "$@"
|
||||||
|
echo
|
||||||
|
- ARGS="$ARGS --merge=diff3" x2 "$@"
|
||||||
|
+ ARGS="--merge=diff3" x2 "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
-unset ARGS
|
||||||
|
-
|
||||||
|
# ==============================================================
|
||||||
|
|
||||||
|
check 'x 3' <<EOF
|
||||||
|
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
|
||||||
|
index be0d7e3..661da52 100644
|
||||||
|
--- a/tests/test-lib.sh
|
||||||
|
+++ b/tests/test-lib.sh
|
||||||
|
@@ -41,7 +41,7 @@ use_local_patch() {
|
||||||
|
|
||||||
|
eval 'patch() {
|
||||||
|
if test -n "$GDB" ; then
|
||||||
|
- echo -e "\n" >&3
|
||||||
|
+ printf "\n\n" >&3
|
||||||
|
gdbserver localhost:53153 $PATCH "$@" 2>&3
|
||||||
|
else
|
||||||
|
$PATCH "$@"
|
||||||
|
@@ -113,22 +113,15 @@ cleanup() {
|
||||||
|
exit $status
|
||||||
|
}
|
||||||
|
|
||||||
|
-if test -z "`echo -n`"; then
|
||||||
|
- if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
|
||||||
|
- eval '
|
||||||
|
- _start_test() {
|
||||||
|
- echo -n "[${BASH_LINENO[2]}] $* -- "
|
||||||
|
- }'
|
||||||
|
- else
|
||||||
|
- eval '
|
||||||
|
- _start_test() {
|
||||||
|
- echo -n "* $* -- "
|
||||||
|
- }'
|
||||||
|
- fi
|
||||||
|
+if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
|
||||||
|
+ eval '
|
||||||
|
+ _start_test() {
|
||||||
|
+ printf "[${BASH_LINENO[2]}] %s -- " "$*"
|
||||||
|
+ }'
|
||||||
|
else
|
||||||
|
eval '
|
||||||
|
_start_test() {
|
||||||
|
- echo "* $*"
|
||||||
|
+ printf "* %s -- " "$*"
|
||||||
|
}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: patch
|
Name: patch
|
||||||
Version: 2.7.6
|
Version: 2.7.6
|
||||||
Release: 14
|
Release: 15
|
||||||
Summary: Utiliity which applies a patch file to original files.
|
Summary: Utiliity which applies a patch file to original files.
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/patch/patch.html
|
URL: http://www.gnu.org/software/patch/patch.html
|
||||||
@ -15,6 +15,7 @@ Patch6: CVE-2018-20969-and-CVE-2019-13638.patch
|
|||||||
Patch7: CVE-2019-13636.patch
|
Patch7: CVE-2019-13636.patch
|
||||||
Patch8: patch-selinux.patch
|
Patch8: patch-selinux.patch
|
||||||
Patch9: Avoid-set_file_attributes-sign-conversion-warnings.patch
|
Patch9: Avoid-set_file_attributes-sign-conversion-warnings.patch
|
||||||
|
Patch10: Test-suite-compatibility-fixes.patch
|
||||||
|
|
||||||
BuildRequires: gcc libselinux-devel libattr-devel ed
|
BuildRequires: gcc libselinux-devel libattr-devel ed
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-root
|
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-root
|
||||||
@ -57,6 +58,9 @@ CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"
|
|||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Dec 28 2022 Xibo.Wang <wangxb12@chinatelecom.cn> - 2.7.6-15
|
||||||
|
- Test suite compatibility fixes
|
||||||
|
|
||||||
* Wed Dec 28 2022 Xibo.Wang <wangxb12@chinatelecom.cn> - 2.7.6-14
|
* Wed Dec 28 2022 Xibo.Wang <wangxb12@chinatelecom.cn> - 2.7.6-14
|
||||||
- Avoid set_file_attributes sign conversion warnings
|
- Avoid set_file_attributes sign conversion warnings
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user