aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2015-02-22 12:41:08 +0200
committerNick Mathewson <nickm@torproject.org>2015-02-23 09:57:17 -0500
commit385558c32f666456ed10ed9dce3f4009437b015d (patch)
treefcec9532942ff377c89740af883da17e9c17769c
parent8a9d86bf05110426e05c5dde4b22e45dfa99f8e9 (diff)
downloadtor-385558c32f666456ed10ed9dce3f4009437b015d.tar.gz
tor-385558c32f666456ed10ed9dce3f4009437b015d.zip
Fix endianness issues in test_config_resolve_my_address().
Since resolve_my_address() yields IP address in host order there is no need to use byteorder functions for conversion.
-rw-r--r--changes/bug149804
-rw-r--r--src/test/test_config.c10
2 files changed, 9 insertions, 5 deletions
diff --git a/changes/bug14980 b/changes/bug14980
new file mode 100644
index 0000000000..46767308e2
--- /dev/null
+++ b/changes/bug14980
@@ -0,0 +1,4 @@
+ o Minor bugfixes:
+ - Fix endianness issues in unit test for resolve_my_address() to
+ have it pass on big endian systems. Resolves issue 14980; bugfix on
+ Tor 0.2.6.3-alpha.
diff --git a/src/test/test_config.c b/src/test/test_config.c
index b63b78e386..0444062722 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -1092,7 +1092,7 @@ test_config_resolve_my_address(void *arg)
tt_want(retval == 0);
tt_want_str_op(method_used,==,"CONFIGURED");
tt_want(hostname_out == NULL);
- tt_assert(htonl(resolved_addr) == 0x69803480);
+ tt_assert(resolved_addr == 0x80348069);
tor_free(options->Address);
@@ -1117,7 +1117,7 @@ test_config_resolve_my_address(void *arg)
tt_want(n_hostname_01010101 == prev_n_hostname_01010101 + 1);
tt_want_str_op(method_used,==,"RESOLVED");
tt_want_str_op(hostname_out,==,"www.torproject.org");
- tt_assert(htonl(resolved_addr) == 0x01010101);
+ tt_assert(resolved_addr == 0x01010101);
UNMOCK(tor_lookup_hostname);
@@ -1149,7 +1149,7 @@ test_config_resolve_my_address(void *arg)
tt_want(n_hostname_01010101 == prev_n_hostname_01010101 + 1);
tt_want_str_op(method_used,==,"GETHOSTNAME");
tt_want_str_op(hostname_out,==,"onionrouter!");
- tt_assert(htonl(resolved_addr) == 0x01010101);
+ tt_assert(resolved_addr == 0x01010101);
UNMOCK(tor_gethostname);
UNMOCK(tor_lookup_hostname);
@@ -1242,7 +1242,7 @@ test_config_resolve_my_address(void *arg)
prev_n_get_interface_address + 1);
tt_want_str_op(method_used,==,"INTERFACE");
tt_want(hostname_out == NULL);
- tt_assert(resolved_addr == ntohl(0x08080808));
+ tt_assert(resolved_addr == 0x08080808);
UNMOCK(get_interface_address);
tor_free(hostname_out);
@@ -1297,7 +1297,7 @@ test_config_resolve_my_address(void *arg)
tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1);
tt_want(retval == 0);
tt_want_str_op(method_used,==,"INTERFACE");
- tt_assert(htonl(resolved_addr) == 0x09090909);
+ tt_assert(resolved_addr == 0x09090909);
UNMOCK(tor_lookup_hostname);
UNMOCK(tor_gethostname);