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)