[Pkg-voip-commits] [sipsak] 01/02: fix tests for big-endian
Victor Seva
vseva at moszumanska.debian.org
Mon Sep 19 15:44:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
vseva pushed a commit to branch master
in repository sipsak.
commit 2297cbfb841c6b369ba1304cd1759e682e2606a4
Author: Victor Seva <vseva at debian.org>
Date: Mon Sep 19 15:48:21 2016 +0200
fix tests for big-endian
---
debian/patches/0008-fix-test-big-endian.patch | 37 +++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 38 insertions(+)
diff --git a/debian/patches/0008-fix-test-big-endian.patch b/debian/patches/0008-fix-test-big-endian.patch
new file mode 100644
index 0000000..272d62d
--- /dev/null
+++ b/debian/patches/0008-fix-test-big-endian.patch
@@ -0,0 +1,37 @@
+From cf9621efd013a62df43db1f9d428ad0cc31f884d Mon Sep 17 00:00:00 2001
+From: Guillem Jover <gjover at sipwise.com>
+Date: Mon, 19 Sep 2016 15:28:38 +0200
+Subject: [PATCH] tests: Fix getaddress() unit test on big-endian systems
+
+The function returns the value in network-order (big-endian), and the
+result was checked against a hardcoded swapped value valid only on
+little-endian systems. Map the expected values to network-order so
+that it is independent of the system's byte order.
+---
+ tests/check_helper.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/tests/check_helper.c b/tests/check_helper.c
+index 66fffbf..39d1035 100644
+--- a/tests/check_helper.c
++++ b/tests/check_helper.c
+@@ -96,13 +96,17 @@ START_TEST (test_is_ip) {
+ END_TEST
+
+ START_TEST (test_getaddress) {
++ uint32_t localaddr;
++
+ /* failure case */
+ fail_unless(getaddress("") == 0, "getaddress(\"\") returned %lu, instead of 0", getaddress(""));
+
++ localaddr = htonl(0x7f000001L);
++
+ /* success cases */
+- fail_unless(getaddress("127.0.0.1") == 16777343, "getaddress(\"127.0.0.1\") returned %lu, instead of 16777343", getaddress("127.0.0.1"));
++ fail_unless(getaddress("127.0.0.1") == localaddr, "getaddress(\"127.0.0.1\") returned %lu, instead of %lu", getaddress("127.0.0.1"), localaddr);
+ /* this should work also without DNS */
+- fail_unless(getaddress("localhost") == 16777343, "getaddress(\"localhost\") returned %lu, instead of 16777343", getaddress("localhost"));
++ fail_unless(getaddress("localhost") == localaddr, "getaddress(\"localhost\") returned %lu, instead of %lu", getaddress("localhost"), localaddr);
+ }
+ END_TEST
+
diff --git a/debian/patches/series b/debian/patches/series
index 67c8a4f..a7baca4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
0005-Use-automake-subdir-objects-option.patch
0006-Use-AS_HELP_STRING-instead-of-deprecated-AC_HELP_STR.patch
0007-Fix-stack-protector-check.patch
+0008-fix-test-big-endian.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/sipsak.git
More information about the Pkg-voip-commits
mailing list