diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-09-04 11:04:21 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-04 11:04:21 -0400 |
commit | 3507fead10ef4f990c0373f4405bd235c0f0b35c (patch) | |
tree | 2eda3631bd503be2731f320f8ca46d60d2b86a16 /src/test/test_util.c | |
parent | 94b04d6c64ec998a9117d65a156888fa3af188e5 (diff) | |
parent | 820aba70efcc6f50f23cf676832412852a01141a (diff) | |
download | tor-3507fead10ef4f990c0373f4405bd235c0f0b35c.tar.gz tor-3507fead10ef4f990c0373f4405bd235c0f0b35c.zip |
Merge branch 'tor_api_owning_control'
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 6cbd504e34..b5a231dac6 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -38,6 +38,7 @@ #include "lib/meminfo/meminfo.h" #include "lib/time/tvdiff.h" #include "lib/encoding/confline.h" +#include "lib/net/socketpair.h" #ifdef HAVE_PWD_H #include <pwd.h> @@ -5612,10 +5613,13 @@ test_util_socketpair(void *arg) tt_assert(SOCKET_OK(fds[0])); tt_assert(SOCKET_OK(fds[1])); - tt_int_op(get_n_open_sockets(), OP_EQ, n + 2); + if (ersatz) + tt_int_op(get_n_open_sockets(), OP_EQ, n); + else + tt_int_op(get_n_open_sockets(), OP_EQ, n + 2); #ifdef CAN_CHECK_CLOEXEC - tt_int_op(fd_is_cloexec(fds[0]), OP_EQ, 1); - tt_int_op(fd_is_cloexec(fds[1]), OP_EQ, 1); + tt_int_op(fd_is_cloexec(fds[0]), OP_EQ, !ersatz); + tt_int_op(fd_is_cloexec(fds[1]), OP_EQ, !ersatz); #endif #ifdef CAN_CHECK_NONBLOCK tt_int_op(fd_is_nonblocking(fds[0]), OP_EQ, 0); @@ -5623,10 +5627,17 @@ test_util_socketpair(void *arg) #endif done: - if (SOCKET_OK(fds[0])) - tor_close_socket(fds[0]); - if (SOCKET_OK(fds[1])) - tor_close_socket(fds[1]); + if (ersatz) { + if (SOCKET_OK(fds[0])) + tor_close_socket_simple(fds[0]); + if (SOCKET_OK(fds[1])) + tor_close_socket_simple(fds[1]); + } else { + if (SOCKET_OK(fds[0])) + tor_close_socket(fds[0]); + if (SOCKET_OK(fds[1])) + tor_close_socket(fds[1]); + } } #undef SOCKET_EPROTO |