--- /dev/null
+ o Minor features (testing):
+ - When running tests that attempt to look up hostname, replace the libc
+ name lookup functions with ones that do not actually touch the network.
+ This way, the tests complete more quickly in the presence of a slow or
+ missing DNS resolver. Closes ticket 31841.
#include "test/log_test_helpers.h"
#include "lib/net/resolve.h"
#include "test/rng_test_helpers.h"
+#include "test/resolve_test_helpers.h"
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
static void
test_addr_parse(void *arg)
{
+
int r;
tor_addr_t addr;
uint16_t port;
(void)arg;
+ mock_hostname_resolver();
+
/* IPv6-mapped IPv4 addresses. Tor doesn't really use these. */
TEST_ADDR_V6_PARSE("11:22:33:44:55:66:1.2.3.4", 0,
"11:22:33:44:55:66:102:304");
"11:22::88",99);
done:
- ;
+ unmock_hostname_resolver();
}
static void
#include "app/config/statefile.h"
#include "test/test_helpers.h"
+#include "test/resolve_test_helpers.h"
#include "feature/dirclient/dir_server_st.h"
#include "core/or/port_cfg_st.h"
slout = smartlist_new();
+ mock_hostname_resolver();
+
// Test error when encounters an invalid Port specification
config_port_invalid = mock_config_line("DNSPort", "");
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0, NULL,
#endif /* defined(_WIN32) */
done:
+ unmock_hostname_resolver();
if (slout)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_free(slout);
#include "test/test.h"
#include "test/test_helpers.h"
#include "test/log_test_helpers.h"
+#include "test/resolve_test_helpers.h"
#include "app/config/config.h"
#include "feature/hs/hs_common.h"
int ret;
(void) arg;
+ mock_hostname_resolver();
/* Valid complex configuration. Basic client authorization. */
{
}
done:
- ;
+ unmock_hostname_resolver();
}
static void
int ret;
(void) arg;
+ mock_hostname_resolver();
/* Valid complex configuration. */
{
}
done:
- ;
+ unmock_hostname_resolver();
}
static void
END_OF_TESTCASES
};
-
#include "feature/nodelist/routerset.h"
#include "core/mainloop/mainloop.h"
#include "test/log_test_helpers.h"
+#include "test/resolve_test_helpers.h"
#include "lib/sandbox/sandbox.h"
#include "lib/memarea/memarea.h"
(void)arg;
setup_log_callback();
sandbox_disable_getaddrinfo_cache();
+ mock_hostname_resolver();
WANT_ERR("ExtORPort 500000", "Invalid ExtORPort", PH_VALIDATE);
close_temp_logs();
clear_log_messages();
+ unmock_hostname_resolver();
return;
}