diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-09-09 10:28:12 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-09-09 10:28:12 -0400 |
commit | 4c55e8a58f41933e76bcb309206c98e7b5a1d834 (patch) | |
tree | dc806fb333a97fa1e6891fd3ca725e2ae8d8e05f /src/test/test_address.c | |
parent | 2fe7e3d9d214b5cd7883ce83e5b11e14b02c5973 (diff) | |
download | tor-4c55e8a58f41933e76bcb309206c98e7b5a1d834.tar.gz tor-4c55e8a58f41933e76bcb309206c98e7b5a1d834.zip |
Fix cases where the tests were doing closesocket() on a non-socket
These seem to have caused warnings on windows. Hmmm.
Diffstat (limited to 'src/test/test_address.c')
-rw-r--r-- | src/test/test_address.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/test/test_address.c b/src/test/test_address.c index 9b4c52fdfc..1d13d5339c 100644 --- a/src/test/test_address.c +++ b/src/test/test_address.c @@ -557,6 +557,13 @@ fake_open_socket(int domain, int type, int protocol) return FAKE_SOCKET_FD; } +static int +fake_close_socket(tor_socket_t s) +{ + (void)s; + return 0; +} + static int last_connected_socket_fd = 0; static int connect_retval = 0; @@ -617,6 +624,7 @@ test_address_udp_socket_trick_whitebox(void *arg) MOCK(tor_open_socket,fake_open_socket); MOCK(tor_connect_socket,pretend_to_connect); MOCK(tor_getsockname,fake_getsockname); + MOCK(tor_close_socket,fake_close_socket); mock_addr = tor_malloc_zero(sizeof(struct sockaddr_storage)); sockaddr_in_from_string("23.32.246.118",(struct sockaddr_in *)mock_addr); @@ -647,11 +655,13 @@ test_address_udp_socket_trick_whitebox(void *arg) tt_assert(sockaddr_in6_are_equal(mock_addr6,ipv6_to_check)); + + done: UNMOCK(tor_open_socket); UNMOCK(tor_connect_socket); UNMOCK(tor_getsockname); + UNMOCK(tor_close_socket); - done: tor_free(ipv6_to_check); tor_free(mock_addr); tor_free(addr_from_hack); |