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.
This commit is contained in:
rl1987 2015-02-22 12:41:08 +02:00 committed by Nick Mathewson
parent 8a9d86bf05
commit 385558c32f
2 changed files with 9 additions and 5 deletions

4
changes/bug14980 Normal file
View File

@ -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.

View File

@ -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);