Remove the now-obsolete setup_test() and cleanup_test() functions

This commit is contained in:
Nick Mathewson 2010-05-26 13:18:30 -04:00
parent 899b0a39ab
commit e73f1d792a

View File

@ -297,54 +297,14 @@ combined_write_cb(evutil_socket_t fd, short event, void *arg)
exit(1);
}
/* Test infrastructure */
static int
setup_test(const char *name)
{
if (in_legacy_test_wrapper)
return 0;
fprintf(stdout, "%s", name);
if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) {
fprintf(stderr, "%s: socketpair\n", __func__);
exit(1);
}
if (evutil_make_socket_nonblocking(pair[0]) == -1)
fprintf(stderr, "fcntl(O_NONBLOCK)");
if (evutil_make_socket_nonblocking(pair[1]) == -1)
fprintf(stderr, "fcntl(O_NONBLOCK)");
test_ok = 0;
called = 0;
return (0);
}
static int
cleanup_test(void)
{
if (in_legacy_test_wrapper)
return 0;
#ifndef WIN32
close(pair[0]);
close(pair[1]);
#else
CloseHandle((HANDLE)pair[0]);
CloseHandle((HANDLE)pair[1]);
#endif
if (test_ok)
fprintf(stdout, "OK\n");
else {
fprintf(stdout, "FAILED\n");
exit(1);
}
test_ok = 0;
return (0);
}
/* These macros used to replicate the work of the legacy test wrapper code */
#define setup_test(x) do { \
if (!in_legacy_test_wrapper) { \
TT_FAIL(("Legacy test %s not wrapped properly", x)); \
return; \
} \
} while (0)
#define cleanup_test() setup_test("cleanup")
static void
test_simpleread(void)