Loading src/test/test_address.c +5 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "or.h" #include "address.h" #include "test.h" #include "log_test_helpers.h" /** Return 1 iff <b>sockaddr1</b> and <b>sockaddr2</b> represent * the same IP address and port combination. Otherwise, return 0. Loading Loading @@ -822,7 +823,10 @@ test_address_get_if_addrs6_list_no_internal(void *arg) (void)arg; int prev_level = setup_capture_of_logs(LOG_ERR); /* We might drop a log_err */ results = get_interface_address6_list(LOG_ERR, AF_INET6, 0); tt_int_op(smartlist_len(mock_saved_logs()), OP_LE, 1); teardown_capture_of_logs(prev_level); tt_assert(results != NULL); /* Work even on systems without IPv6 interfaces */ Loading Loading @@ -1110,7 +1114,7 @@ struct testcase_t address_tests[] = { ADDRESS_TEST(get_if_addrs_list_internal, 0), ADDRESS_TEST(get_if_addrs_list_no_internal, 0), ADDRESS_TEST(get_if_addrs6_list_internal, 0), ADDRESS_TEST(get_if_addrs6_list_no_internal, 0), ADDRESS_TEST(get_if_addrs6_list_no_internal, TT_FORK), ADDRESS_TEST(get_if_addrs_internal_fail, 0), ADDRESS_TEST(get_if_addrs_no_internal_fail, 0), ADDRESS_TEST(get_if_addrs, 0), Loading src/test/test_util.c +9 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #include "test.h" #include "memarea.h" #include "util_process.h" #include "log_test_helpers.h" #ifdef HAVE_PWD_H #include <pwd.h> Loading Loading @@ -5187,6 +5188,7 @@ test_util_pwdb(void *arg) const struct passwd *me = NULL, *me2, *me3; char *name = NULL; char *dir = NULL; int prev_level = -100; /* Uncached case. */ /* Let's assume that we exist. */ Loading Loading @@ -5225,8 +5227,13 @@ test_util_pwdb(void *arg) } tt_assert(found); tor_free(dir); prev_level = setup_capture_of_logs(LOG_ERR); /* We should do a LOG_ERR */ dir = get_user_homedir(badname); tt_assert(dir == NULL); tt_int_op(smartlist_len(mock_saved_logs()), OP_EQ, 1); teardown_capture_of_logs(prev_level); prev_level = -100; /* Now try to find a user that doesn't exist by ID. */ found = 0; Loading @@ -5243,6 +5250,8 @@ test_util_pwdb(void *arg) done: tor_free(name); tor_free(dir); if (prev_level >= 0) teardown_capture_of_logs(prev_level); } #endif Loading Loading
src/test/test_address.c +5 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "or.h" #include "address.h" #include "test.h" #include "log_test_helpers.h" /** Return 1 iff <b>sockaddr1</b> and <b>sockaddr2</b> represent * the same IP address and port combination. Otherwise, return 0. Loading Loading @@ -822,7 +823,10 @@ test_address_get_if_addrs6_list_no_internal(void *arg) (void)arg; int prev_level = setup_capture_of_logs(LOG_ERR); /* We might drop a log_err */ results = get_interface_address6_list(LOG_ERR, AF_INET6, 0); tt_int_op(smartlist_len(mock_saved_logs()), OP_LE, 1); teardown_capture_of_logs(prev_level); tt_assert(results != NULL); /* Work even on systems without IPv6 interfaces */ Loading Loading @@ -1110,7 +1114,7 @@ struct testcase_t address_tests[] = { ADDRESS_TEST(get_if_addrs_list_internal, 0), ADDRESS_TEST(get_if_addrs_list_no_internal, 0), ADDRESS_TEST(get_if_addrs6_list_internal, 0), ADDRESS_TEST(get_if_addrs6_list_no_internal, 0), ADDRESS_TEST(get_if_addrs6_list_no_internal, TT_FORK), ADDRESS_TEST(get_if_addrs_internal_fail, 0), ADDRESS_TEST(get_if_addrs_no_internal_fail, 0), ADDRESS_TEST(get_if_addrs, 0), Loading
src/test/test_util.c +9 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #include "test.h" #include "memarea.h" #include "util_process.h" #include "log_test_helpers.h" #ifdef HAVE_PWD_H #include <pwd.h> Loading Loading @@ -5187,6 +5188,7 @@ test_util_pwdb(void *arg) const struct passwd *me = NULL, *me2, *me3; char *name = NULL; char *dir = NULL; int prev_level = -100; /* Uncached case. */ /* Let's assume that we exist. */ Loading Loading @@ -5225,8 +5227,13 @@ test_util_pwdb(void *arg) } tt_assert(found); tor_free(dir); prev_level = setup_capture_of_logs(LOG_ERR); /* We should do a LOG_ERR */ dir = get_user_homedir(badname); tt_assert(dir == NULL); tt_int_op(smartlist_len(mock_saved_logs()), OP_EQ, 1); teardown_capture_of_logs(prev_level); prev_level = -100; /* Now try to find a user that doesn't exist by ID. */ found = 0; Loading @@ -5243,6 +5250,8 @@ test_util_pwdb(void *arg) done: tor_free(name); tor_free(dir); if (prev_level >= 0) teardown_capture_of_logs(prev_level); } #endif Loading