Make all tests that hit the network disabled by default

To run only these tests, run test/regress with @live_net.  To run all
tests, run test/regress with @all.
This commit is contained in:
Nick Mathewson 2012-06-28 13:18:28 -04:00
parent ef7c4f7956
commit f2cea873bb
4 changed files with 40 additions and 11 deletions

View File

@ -1832,10 +1832,10 @@ end:
struct testcase_t dns_testcases[] = {
DNS_LEGACY(server, TT_FORK|TT_NEED_BASE),
DNS_LEGACY(gethostbyname, TT_FORK|TT_NEED_BASE|TT_NEED_DNS),
DNS_LEGACY(gethostbyname6, TT_FORK|TT_NEED_BASE|TT_NEED_DNS),
DNS_LEGACY(gethostbyaddr, TT_FORK|TT_NEED_BASE|TT_NEED_DNS),
{ "resolve_reverse", dns_resolve_reverse, TT_FORK, NULL, NULL },
DNS_LEGACY(gethostbyname, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
DNS_LEGACY(gethostbyname6, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
DNS_LEGACY(gethostbyaddr, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
{ "resolve_reverse", dns_resolve_reverse, TT_FORK|TT_OFF_BY_DEFAULT, NULL, NULL },
{ "search", dns_search_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
{ "search_cancel", dns_search_cancel_test,
TT_FORK|TT_NEED_BASE, &basic_setup, NULL },

View File

@ -386,6 +386,19 @@ struct testgroup_t testgroups[] = {
END_OF_GROUPS
};
const char *alltests[] = { "+..", NULL };
const char *livenettests[] = {
"+util/getaddrinfo_live",
"+dns/gethostby..",
"+dns/resolve_reverse",
NULL
};
struct testlist_alias_t testaliases[] = {
{ "all", alltests },
{ "live_net", livenettests },
END_OF_ALIASES
};
int
main(int argc, const char **argv)
{
@ -413,6 +426,8 @@ main(int argc, const char **argv)
evthread_enable_lock_debuging();
#endif
tinytest_set_aliases(testaliases);
if (tinytest_main(argc,argv,testgroups))
return 1;

View File

@ -887,11 +887,6 @@ test_evutil_getaddrinfo(void *arg)
{
struct evutil_addrinfo *ai = NULL, *a;
struct evutil_addrinfo hints;
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
char buf[128];
const char *cp;
int r;
/* Try using it as a pton. */
@ -1018,6 +1013,23 @@ test_evutil_getaddrinfo(void *arg)
ai = NULL;
}
end:
if (ai)
evutil_freeaddrinfo(ai);
}
static void
test_evutil_getaddrinfo_live(void *arg)
{
struct evutil_addrinfo *ai = NULL;
struct evutil_addrinfo hints;
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
char buf[128];
const char *cp;
int r;
/* Now do some actual lookups. */
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET;
@ -1318,6 +1330,7 @@ struct testcase_t util_testcases[] = {
{ "integers", test_evutil_integers, 0, NULL, NULL },
{ "rand", test_evutil_rand, TT_FORK, NULL, NULL },
{ "getaddrinfo", test_evutil_getaddrinfo, TT_FORK, NULL, NULL },
{ "getaddrinfo_live", test_evutil_getaddrinfo_live, TT_FORK|TT_OFF_BY_DEFAULT, NULL, NULL },
#ifdef _WIN32
{ "loadsyslib", test_evutil_loadsyslib, TT_FORK, NULL, NULL },
#endif

View File

@ -4,6 +4,7 @@ BACKENDS="EVPORT KQUEUE EPOLL DEVPOLL POLL SELECT WIN32"
TESTS="test-eof test-weof test-time test-changelist test-fdleak"
FAILED=no
TEST_OUTPUT_FILE=${TEST_OUTPUT_FILE:-/dev/null}
REGRESS_ARGS=${REGRESS_ARGS:-}
# /bin/echo is a little more likely to support -n than sh's builtin echo,
# printf is even more likely
@ -94,9 +95,9 @@ run_tests () {
announce_n " regress: "
if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
then
$TEST_DIR/regress --quiet
$TEST_DIR/regress --quiet $REGRESS_ARGS
else
$TEST_DIR/regress >>"$TEST_OUTPUT_FILE"
$TEST_DIR/regress $REGRESS_ARGS >>"$TEST_OUTPUT_FILE"
fi
if test "$?" = "0" ;
then