This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Have diff ignore line ending differences when testing
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Thu, 4 May 2017 12:28:08 +0200
- Subject: [PATCH] Have diff ignore line ending differences when testing
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+YZv4ofqgxRRS3c5/DWjV6vEWDqi1pXpvj8lJbxfHRM=; b=k6jeJFoSIG8lcBJSBj/V1F53q47Lx5zYsftKCWFpwOSiUUSNtrBmwDwcl5w4frpPW3EbN9lVmiHqUrJib3b/s9Bs8M8Sktltebi5enTUIO90EGJp6qAOPx2LMdV0+tLr/kiCGSCEWRH+SAye/k08ekkxzYhfiUPAC3zEky2AoEU=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
This accounts for the CR/LF problem we get when producing text files on
windows.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
tests/ChangeLog | 7 +++++++
tests/run-addr2line-test.sh | 8 ++++----
tests/run-readelf-test1.sh | 2 +-
tests/run-unstrip-n.sh | 2 +-
tests/test-subr.sh | 2 +-
5 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index b091ae0..5616c74 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,12 @@
2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
+ * run-addr2line-test.sh: Add --strip-trailing-cr option to diff.
+ * run-readelf-test1.sh: Likewise.
+ * run-unstrip-n.sh: Likewise.
+ * test-subr.sh: Likewise.
+
+2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
+
* alldts.c: Open files in O_BINARY.
* allfcts.c: Likewise.
* arextract.c: Likewise.
diff --git a/tests/run-addr2line-test.sh b/tests/run-addr2line-test.sh
index 1079c3e..0dae42d 100755
--- a/tests/run-addr2line-test.sh
+++ b/tests/run-addr2line-test.sh
@@ -56,7 +56,7 @@ EOF
echo "# Everything from stdin (with newlines)."
cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1
-cmp good.out stdin.nl.out || exit 1
+diff --strip-trailing-cr good.out stdin.nl.out || exit 1
cat > foo.out <<\EOF
foo
@@ -65,11 +65,11 @@ EOF
echo "# stdin without newline address, just EOF."
echo -n "0x08048468" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nonl.out || exit 1
-cmp foo.out stdin.nonl.out || exit 1
+diff --strip-trailing-cr foo.out stdin.nonl.out || exit 1
echo "# stdin without newline symbol, just EOF."
echo -n "foo" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1
-cmp foo.out stdin.nonl.out || exit 1
+diff --strip-trailing-cr foo.out stdin.nonl.out || exit 1
tempfiles good.addr.out
@@ -105,7 +105,7 @@ cat good.addr.out | testrun_compare ${abs_top_builddir}/src/addr2line -a -f -e t
echo "# Everything from stdin (with newlines) with addresses."
cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -a -f -e testfile > stdin.nl.out || exit 1
-cmp good.addr.out stdin.nl.out || exit 1
+diff --strip-trailing-cr good.addr.out stdin.nl.out || exit 1
echo "# Pretty with functions and addresses."
testrun_compare ${abs_top_builddir}/src/addr2line --pretty -a -f -e testfile 0x08048468 0x0804845c << EOF
diff --git a/tests/run-readelf-test1.sh b/tests/run-readelf-test1.sh
index 4725049..40b664f 100755
--- a/tests/run-readelf-test1.sh
+++ b/tests/run-readelf-test1.sh
@@ -28,7 +28,7 @@ tempfiles testfile.temp
testrun ${abs_top_builddir}/src/readelf -r testfile3 > testfile.temp
-diff -u - testfile.temp <<EOF
+diff -u --strip-trailing-cr - testfile.temp <<EOF
Relocation section [ 8] '.rel.got' for section [19] '.got' at offset 0x294 contains 1 entry:
Offset Type Value Name
diff --git a/tests/run-unstrip-n.sh b/tests/run-unstrip-n.sh
index 37cbd60..f90f9d5 100755
--- a/tests/run-unstrip-n.sh
+++ b/tests/run-unstrip-n.sh
@@ -65,7 +65,7 @@ testrun_out $outfile ${abs_top_builddir}/src/unstrip -n -e test-core.exec --core
outfile2=test-core.out2
remove_files="$remove_files $outfile2"
grep -v libc.so.6 $outfile | sort >$outfile2
-diff -u $outfile2 - <<EOF
+diff -u --strip-trailing-cr $outfile2 - <<EOF
0x400000+0x202038 - test-core.exec - test-core.exec
0x7f67f2aaf000+0x202000 - . - /home/jkratoch/redhat/elfutils-libregr/test-core-lib.so
0x7fff1596c000+0x1000 a9cf37f53897b5468ee018655760be61b8633d3c@0x7fff1596c340 . - linux-vdso.so.1
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index a765db6..8bea18c 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -64,7 +64,7 @@ testrun_compare()
{
outfile="${1##*/}.out"
testrun_out $outfile "$@"
- diff -u $outfile -
+ diff -u --strip-trailing-cr $outfile -
# diff's exit status will kill the script.
}
--
2.1.4