forked from cory/tildefriends
libuv 1.42.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3650 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
50
deps/libuv/test/run-tests.c
vendored
50
deps/libuv/test/run-tests.c
vendored
@ -36,6 +36,16 @@
|
||||
/* Actual tests and helpers are defined in test-list.h */
|
||||
#include "test-list.h"
|
||||
|
||||
#ifdef __MVS__
|
||||
#include "zos-base.h"
|
||||
/* Initialize environment and zoslib */
|
||||
__attribute__((constructor)) void init() {
|
||||
zoslib_config_t config;
|
||||
init_zoslib_config(&config);
|
||||
init_zoslib(config);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ipc_helper(int listen_after_write);
|
||||
int ipc_helper_heavy_traffic_deadlock_bug(void);
|
||||
int ipc_helper_tcp_connection(void);
|
||||
@ -50,6 +60,10 @@ int spawn_tcp_server_helper(void);
|
||||
|
||||
static int maybe_run_test(int argc, char **argv);
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef BOOL (WINAPI *sCompareObjectHandles)(_In_ HANDLE, _In_ HANDLE);
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifndef _WIN32
|
||||
@ -149,7 +163,7 @@ static int maybe_run_test(int argc, char **argv) {
|
||||
if (strcmp(argv[1], "spawn_helper4") == 0) {
|
||||
notify_parent_process();
|
||||
/* Never surrender, never return! */
|
||||
while (1) uv_sleep(10000);
|
||||
for (;;) uv_sleep(10000);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "spawn_helper5") == 0) {
|
||||
@ -194,7 +208,7 @@ static int maybe_run_test(int argc, char **argv) {
|
||||
|
||||
/* Test if the test value from the parent is still set */
|
||||
test = getenv("ENV_TEST");
|
||||
ASSERT(test != NULL);
|
||||
ASSERT_NOT_NULL(test);
|
||||
|
||||
r = fprintf(stdout, "%s", test);
|
||||
ASSERT(r > 0);
|
||||
@ -202,22 +216,36 @@ static int maybe_run_test(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
if (strcmp(argv[1], "spawn_helper8") == 0) {
|
||||
int fd;
|
||||
|
||||
uv_os_fd_t closed_fd;
|
||||
uv_os_fd_t open_fd;
|
||||
#ifdef _WIN32
|
||||
DWORD flags;
|
||||
HMODULE kernelbase_module;
|
||||
sCompareObjectHandles pCompareObjectHandles; /* function introduced in Windows 10 */
|
||||
#endif
|
||||
notify_parent_process();
|
||||
ASSERT(sizeof(fd) == read(0, &fd, sizeof(fd)));
|
||||
ASSERT(fd > 2);
|
||||
ASSERT(sizeof(closed_fd) == read(0, &closed_fd, sizeof(closed_fd)));
|
||||
ASSERT(sizeof(open_fd) == read(0, &open_fd, sizeof(open_fd)));
|
||||
#ifdef _WIN32
|
||||
ASSERT((intptr_t) closed_fd > 0);
|
||||
ASSERT((intptr_t) open_fd > 0);
|
||||
ASSERT(0 != GetHandleInformation(open_fd, &flags));
|
||||
kernelbase_module = GetModuleHandleA("kernelbase.dll");
|
||||
pCompareObjectHandles = (sCompareObjectHandles)
|
||||
GetProcAddress(kernelbase_module, "CompareObjectHandles");
|
||||
ASSERT(pCompareObjectHandles == NULL || !pCompareObjectHandles(open_fd, closed_fd));
|
||||
#else
|
||||
ASSERT(open_fd > 2);
|
||||
ASSERT(closed_fd > 2);
|
||||
# if defined(__PASE__) /* On IBMi PASE, write() returns 1 */
|
||||
ASSERT(1 == write(fd, "x", 1));
|
||||
ASSERT(1 == write(closed_fd, "x", 1));
|
||||
# else
|
||||
ASSERT(-1 == write(fd, "x", 1));
|
||||
ASSERT(-1 == write(closed_fd, "x", 1));
|
||||
# endif /* !__PASE__ */
|
||||
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
if (strcmp(argv[1], "spawn_helper9") == 0) {
|
||||
notify_parent_process();
|
||||
|
Reference in New Issue
Block a user