[libuv/fuchsia] Fuchsia support to libuv
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index a3a770d..779331f 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -1037,7 +1037,7 @@
 struct uv_process_s {
   UV_HANDLE_FIELDS
   uv_exit_cb exit_cb;
-  int pid;
+  uv_pid_t pid;
   UV_PROCESS_PRIVATE_FIELDS
 };
 
@@ -1047,6 +1047,7 @@
 UV_EXTERN int uv_process_kill(uv_process_t*, int signum);
 UV_EXTERN int uv_kill(int pid, int signum);
 UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*);
+UV_EXTERN uv_pid_t uv__waitpid(uv_pid_t pid, int *status, int options);
 
 
 /*
@@ -1178,7 +1179,9 @@
    uint64_t ru_nivcsw;    /* involuntary context switches */
 } uv_rusage_t;
 
+#ifndef __Fuchsia__
 UV_EXTERN int uv_getrusage(uv_rusage_t* rusage);
+#endif
 
 UV_EXTERN int uv_os_homedir(char* buffer, size_t* size);
 UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size);
@@ -1204,8 +1207,10 @@
 # define UV_PRIORITY_HIGHEST -20
 #endif
 
+#ifndef __Fuchsia__
 UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority);
 UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority);
+#endif
 
 UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
 UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
diff --git a/deps/uv/include/uv/unix.h b/deps/uv/include/uv/unix.h
index 3a13163..9b218b3 100644
--- a/deps/uv/include/uv/unix.h
+++ b/deps/uv/include/uv/unix.h
@@ -69,6 +69,9 @@
 # include "uv/posix.h"
 #elif defined(__HAIKU__)
 # include "uv/posix.h"
+#elif defined(__Fuchsia__)
+# include "uv/posix.h"
+# include <zircon/types.h>
 #endif
 
 #ifndef NI_MAXHOST
@@ -126,7 +129,11 @@
 typedef int uv_file;
 typedef int uv_os_sock_t;
 typedef int uv_os_fd_t;
+#ifdef __Fuchsia__
+typedef zx_handle_t uv_pid_t;
+#else
 typedef pid_t uv_pid_t;
+#endif 
 
 #define UV_ONCE_INIT PTHREAD_ONCE_INIT
 
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index 949eefa..4363ab8 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -38,7 +38,9 @@
 #include <arpa/inet.h>
 #include <limits.h> /* INT_MAX, PATH_MAX, IOV_MAX */
 #include <sys/uio.h> /* writev */
+#ifndef __Fuchsia__
 #include <sys/resource.h> /* getrusage */
+#endif
 #include <pwd.h>
 #include <sys/utsname.h>
 #include <sys/time.h>
@@ -955,6 +957,7 @@
 }
 
 
+#ifndef __Fuchsia__
 int uv_getrusage(uv_rusage_t* rusage) {
   struct rusage usage;
 
@@ -986,7 +989,7 @@
 
   return 0;
 }
-
+#endif // !__Fuchsia__
 
 int uv__open_cloexec(const char* path, int flags) {
 #if defined(O_CLOEXEC)
@@ -1398,7 +1401,7 @@
   return getppid();
 }
 
-
+#ifndef __Fuchsia__
 int uv_os_getpriority(uv_pid_t pid, int* priority) {
   int r;
 
@@ -1425,7 +1428,7 @@
 
   return 0;
 }
-
+#endif // !__Fuchsia__
 
 int uv_os_uname(uv_utsname_t* buffer) {
   struct utsname buf;
diff --git a/deps/uv/src/unix/fuchsia.c b/deps/uv/src/unix/fuchsia.c
new file mode 100644
index 0000000..e7693b9
--- /dev/null
+++ b/deps/uv/src/unix/fuchsia.c
@@ -0,0 +1,69 @@
+#include "uv.h"
+#include "internal.h"
+
+#include <assert.h>
+#include <string.h>
+
+#include <zircon/syscalls.h>
+
+int uv_exepath(char* buffer, size_t* size) {
+  if (buffer == NULL || size == NULL || *size == 0) return UV_EINVAL;
+  const char* path = "/pkg/";
+  if (*size < strlen(path) + 1) return UV_EINVAL;
+  strcpy(buffer, "/pkg/");
+  return 0;
+}
+
+void uv_loadavg(double avg[3]) {
+  // Not implemented. As in the case of Windows, it returns [0, 0, 0].
+  avg[0] = avg[1] = avg[2] = 0;
+}
+
+int uv_uptime(double* uptime) {
+  if (uptime == NULL) return UV_EINVAL;
+  // TODO(victor): This is the number of nanoseconds since the system was
+  // powered on. It does not always reset on reboot and does not adjust during
+  // sleep, and thus should not be used as a reliable source of uptime.
+  zx_time_t time_ns = zx_clock_get_monotonic();
+  *uptime = time_ns / 1000000000.0;  // in seconds
+  return 0;
+}
+
+int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+  *cpu_infos = NULL;
+  *count = 0;
+  return UV_ENOSYS;
+}
+
+uint64_t uv_get_free_memory(void) {
+  assert(0 && "uv_get_free_memory not supported on Fuchsia.");
+  return 0;
+}
+
+uint64_t uv_get_constrained_memory(void) {
+  assert(0 && "uv_get_constrained_memory not supported on Fuchsia.");
+  return 0;
+}
+
+uint64_t uv_get_total_memory(void) {
+  assert(0 && "uv_get_total_memory not supported on Fuchsia.");
+  return 0;
+}
+
+int uv_resident_set_memory(size_t* rss) {
+  assert(0 && "uv_resident_set_memory not supported on Fuchsia.");
+  return 0;
+}
+
+int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+  *count = 0;
+  *addresses = NULL;
+  return UV_ENOSYS;
+}
+
+void uv_free_interface_addresses(uv_interface_address_t* addresses, int count) {
+  for (int i = 0; i < count; i++) {
+    uv__free(addresses[i].name);
+  }
+  uv__free(addresses);
+}
diff --git a/deps/uv/src/unix/loop.c b/deps/uv/src/unix/loop.c
index c2a03d7..39a9f0e 100644
--- a/deps/uv/src/unix/loop.c
+++ b/deps/uv/src/unix/loop.c
@@ -30,7 +30,7 @@
 int uv_loop_init(uv_loop_t* loop) {
   void* saved_data;
   int err;
-
+  
 
   saved_data = loop->data;
   memset(loop, 0, sizeof(*loop));
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 040d578..7cabcbd 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -160,11 +160,17 @@
     return err;
 #endif /* defined(__APPLE__) */
 
+#ifdef __Fuchsia__
+  // TODO(victor): fcntl is not returning the correct mode.
+  // As a temporary hack, we set both flags.
+  flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE;
+#else
   mode &= O_ACCMODE;
   if (mode != O_WRONLY)
     flags |= UV_HANDLE_READABLE;
   if (mode != O_RDONLY)
     flags |= UV_HANDLE_WRITABLE;
+#endif
 
   return uv__stream_open((uv_stream_t*)handle, fd, flags);
 }
diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c
index b021aae..6ac5b50 100644
--- a/deps/uv/src/unix/process.c
+++ b/deps/uv/src/unix/process.c
@@ -33,6 +33,11 @@
 #include <fcntl.h>
 #include <poll.h>
 
+#ifdef __Fuchsia__
+# include <lib/fdio/spawn.h>
+# include <zircon/syscalls.h>
+#endif
+
 #if defined(__APPLE__) && !TARGET_OS_IPHONE
 # include <crt_externs.h>
 # define environ (*_NSGetEnviron())
@@ -44,6 +49,30 @@
 # include <grp.h>
 #endif
 
+uv_pid_t uv__waitpid(uv_pid_t pid, int *status, int options) {
+#ifdef __Fuchsia__
+  // TODO(victor): ignoring options for now
+  assert(options == 0);
+
+  zx_status_t result = zx_object_wait_one(pid, ZX_TASK_TERMINATED, ZX_TIME_INFINITE, NULL);
+  if (result != ZX_OK)
+    goto error;
+
+  zx_info_process_t proc_info;
+  result = zx_object_get_info(pid, ZX_INFO_PROCESS, &proc_info, sizeof(proc_info), NULL, NULL);
+  if (result != ZX_OK)
+    goto error;
+
+  *status = proc_info.return_code;
+  return 0;
+
+error:
+  errno = ECHILD;
+  return -1;
+#else
+  return waitpid(pid, status, options);
+#endif
+}
 
 static void uv__chld(uv_signal_t* handle, int signum) {
   uv_process_t* process;
@@ -51,7 +80,7 @@
   int exit_status;
   int term_signal;
   int status;
-  pid_t pid;
+  uv_pid_t pid;
   QUEUE pending;
   QUEUE* q;
   QUEUE* h;
@@ -68,7 +97,7 @@
     q = QUEUE_NEXT(q);
 
     do
-      pid = waitpid(process->pid, &status, WNOHANG);
+      pid = uv__waitpid(process->pid, &status, WNOHANG);
     while (pid == -1 && errno == EINTR);
 
     if (pid == 0)
@@ -245,6 +274,7 @@
 }
 
 
+#ifndef __Fuchsia__
 static void uv__write_int(int fd, int val) {
   ssize_t n;
 
@@ -257,9 +287,10 @@
 
   assert(n == sizeof(val));
 }
+#endif
 
 
-#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH))
+#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH)) && !defined(__Fuchsia__)
 /* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be
  * avoided. Since this isn't called on those targets, the function
  * doesn't even need to be defined for them.
@@ -404,7 +435,6 @@
 }
 #endif
 
-
 int uv_spawn(uv_loop_t* loop,
              uv_process_t* process,
              const uv_process_options_t* options) {
@@ -417,7 +447,7 @@
   int (*pipes)[2];
   int stdio_count;
   ssize_t r;
-  pid_t pid;
+  uv_pid_t pid;
   int err;
   int exec_errorno;
   int i;
@@ -486,6 +516,30 @@
 
   /* Acquire write lock to prevent opening new fds in worker threads */
   uv_rwlock_wrlock(&loop->cloexec_lock);
+
+#ifdef __Fuchsia__
+  const char *executable_path;
+  if (*options->file == 0) {
+    // TODO(victor): This is not necessarilly the name of the process!!
+    executable_path = "/pkg/uv_tests";
+  } else {
+    executable_path = options->file;
+  }
+
+  // TODO(victor): missing uv_process_child_init logic before spawning.
+  char err_msg_out[FDIO_SPAWN_ERR_MSG_MAX_LENGTH];
+  zx_status_t zx_status = fdio_spawn_etc(ZX_HANDLE_INVALID, FDIO_SPAWN_CLONE_ALL, executable_path,
+    (const char* const *)options->args,
+    (const char* const *)options->env, 0, NULL,
+    &pid, err_msg_out);
+  if (zx_status != ZX_OK) {
+    err = UV__ERR(ENOENT);
+    uv_rwlock_wrunlock(&loop->cloexec_lock);
+    uv__close(signal_pipe[0]);
+    uv__close(signal_pipe[1]);
+    goto error;
+  }
+#else
   pid = fork();
 
   if (pid == -1) {
@@ -500,6 +554,7 @@
     uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]);
     abort();
   }
+#endif
 
   /* Release lock in parent process */
   uv_rwlock_wrunlock(&loop->cloexec_lock);
@@ -515,12 +570,12 @@
     ; /* okay, EOF */
   else if (r == sizeof(exec_errorno)) {
     do
-      err = waitpid(pid, &status, 0); /* okay, read errorno */
+      err = uv__waitpid(pid, &status, 0); /* okay, read errorno */
     while (err == -1 && errno == EINTR);
     assert(err == pid);
   } else if (r == -1 && errno == EPIPE) {
     do
-      err = waitpid(pid, &status, 0); /* okay, got EPIPE */
+      err = uv__waitpid(pid, &status, 0); /* okay, got EPIPE */
     while (err == -1 && errno == EINTR);
     assert(err == pid);
   } else
diff --git a/deps/uv/src/unix/signal.c b/deps/uv/src/unix/signal.c
index 1e7e8ac..39f900d 100644
--- a/deps/uv/src/unix/signal.c
+++ b/deps/uv/src/unix/signal.c
@@ -63,6 +63,8 @@
 static void uv__signal_global_reinit(void);
 
 static void uv__signal_global_init(void) {
+// TODO(victor): not sure if I can skip the lock here for fuchsia
+#ifndef __Fuchsia__
   if (uv__signal_lock_pipefd[0] == -1)
     /* pthread_atfork can register before and after handlers, one
      * for each child. This only registers one for the child. That
@@ -72,6 +74,7 @@
      */
     if (pthread_atfork(NULL, NULL, &uv__signal_global_reinit))
       abort();
+#endif
 
   uv__signal_global_reinit();
 }
diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c
index f10c351..723d5d2 100644
--- a/deps/uv/src/unix/thread.c
+++ b/deps/uv/src/unix/thread.c
@@ -27,7 +27,10 @@
 #include <errno.h>
 
 #include <sys/time.h>
+#ifndef __Fuchsia__
 #include <sys/resource.h>  /* getrlimit() */
+#endif
+
 #include <unistd.h>  /* getpagesize() */
 
 #include <limits.h>
diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c
index b7ca1f8..56816a7 100644
--- a/deps/uv/test/runner-unix.c
+++ b/deps/uv/test/runner-unix.c
@@ -21,6 +21,7 @@
 
 #include "runner-unix.h"
 #include "runner.h"
+#include "uv.h"
 
 #include <limits.h>
 #include <stdint.h> /* uintptr_t */
@@ -40,6 +41,11 @@
 #include <sys/time.h>
 #include <pthread.h>
 
+#ifdef __Fuchsia__
+# include <lib/fdio/spawn.h>
+# include <zircon/syscalls.h>
+#endif
+
 extern char** environ;
 
 static void closefd(int fd) {
@@ -75,23 +81,23 @@
   snprintf(executable_path, sizeof(executable_path), "%s", argv[0]);
 }
 
-
 /* Invoke "argv[0] test-name [test-part]". Store process info in *p. Make sure
  * that all stdio output of the processes is buffered up. */
 int process_start(char* name, char* part, process_info_t* p, int is_helper) {
   FILE* stdout_file;
   int stdout_fd;
-  const char* arg;
-  char* args[16];
+  const char* args[16];
   int pipefd[2];
   char fdstr[8];
   ssize_t rc;
   int n;
-  pid_t pid;
 
-  arg = getenv("UV_USE_VALGRIND");
   n = 0;
 
+#ifndef __Fuchsia__
+  const char* arg;
+  arg = getenv("UV_USE_VALGRIND");
+
   /* Disable valgrind for helpers, it complains about helpers leaking memory.
    * They're killed after the test and as such never get a chance to clean up.
    */
@@ -102,6 +108,7 @@
     args[n++] = "--show-reachable=yes";
     args[n++] = "--error-exitcode=125";
   }
+#endif
 
   args[n++] = executable_path;
   args[n++] = name;
@@ -122,6 +129,7 @@
     }
 
     snprintf(fdstr, sizeof(fdstr), "%d", pipefd[1]);
+    printf("setting UV_TEST_RUNNER_FD\n");
     if (setenv("UV_TEST_RUNNER_FD", fdstr, /* overwrite */ 1)) {
       perror("setenv");
       return -1;
@@ -131,6 +139,17 @@
   p->terminated = 0;
   p->status = 0;
 
+#ifdef __Fuchsia__
+  zx_status_t status;
+  
+  status = fdio_spawn(ZX_HANDLE_INVALID, FDIO_SPAWN_CLONE_ALL, executable_path, args, &p->pid);
+  if (status != ZX_OK) {
+    perror("fdio_spawn");
+    return -1;
+  }
+#else
+  pid_t pid;
+
   pid = fork();
 
   if (pid < 0) {
@@ -151,6 +170,8 @@
 
   /* parent */
   p->pid = pid;
+#endif
+
   p->name = strdup(name);
   p->stdout_file = stdout_file;
 
@@ -179,7 +200,6 @@
   return 0;
 }
 
-
 typedef struct {
   int pipe[2];
   process_info_t* vec;
@@ -199,7 +219,7 @@
   for (i = 0; i < args->n; i++) {
     p = (process_info_t*)(args->vec + i * sizeof(process_info_t));
     if (p->terminated) continue;
-    r = waitpid(p->pid, &p->status, 0);
+    r = uv__waitpid(p->pid, &p->status, 0);
     if (r < 0) {
       perror("waitpid");
       return NULL;
@@ -219,7 +239,6 @@
   return NULL;
 }
 
-
 /* Wait for all `n` processes in `vec` to terminate. Time out after `timeout`
  * msec, or never if timeout == -1. Return 0 if all processes are terminated,
  * -1 on error, -2 on timeout. */
@@ -324,7 +343,11 @@
     /* Timeout. Kill all the children. */
     for (i = 0; i < n; i++) {
       p = (process_info_t*)(vec + i * sizeof(process_info_t));
+#ifdef __Fuchsia__
+      assert(0 && "kill not supported!");
+#else
       kill(p->pid, SIGTERM);
+#endif
     }
     retval = -2;
   }
@@ -414,7 +437,12 @@
 
 /* Terminate process `p`. */
 int process_terminate(process_info_t *p) {
+#ifdef __Fuchsia__
+  assert(0 && "kill not supported");
+  return -1;
+#else
   return kill(p->pid, SIGTERM);
+#endif
 }
 
 
diff --git a/deps/uv/test/runner-unix.h b/deps/uv/test/runner-unix.h
index e21847f..bfb163e 100644
--- a/deps/uv/test/runner-unix.h
+++ b/deps/uv/test/runner-unix.h
@@ -25,9 +25,17 @@
 #include <sys/types.h>
 #include <stdio.h> /* FILE */
 
+#ifdef __Fuchsia__
+#include <zircon/types.h>
+#endif
+
 typedef struct {
   FILE* stdout_file;
+#ifdef __Fuchsia__
+  zx_handle_t pid;
+#else
   pid_t pid;
+#endif
   char* name;
   int status;
   int terminated;
diff --git a/deps/uv/test/task.h b/deps/uv/test/task.h
index 27b7310..085e306 100644
--- a/deps/uv/test/task.h
+++ b/deps/uv/test/task.h
@@ -36,7 +36,7 @@
 # include <stdint.h>
 #endif
 
-#if !defined(_WIN32)
+#if !defined(_WIN32) && !defined(__Fuchsia__)
 # include <sys/time.h>
 # include <sys/resource.h>  /* setrlimit() */
 #endif
diff --git a/deps/uv/test/test-close-fd.c b/deps/uv/test/test-close-fd.c
index 2ed9a10..41fa61b 100644
--- a/deps/uv/test/test-close-fd.c
+++ b/deps/uv/test/test-close-fd.c
@@ -45,7 +45,7 @@
     uv_close((uv_handle_t *) handle, NULL);
     break;
   default:
-    ASSERT(!"read_cb_called > 2");
+    ASSERT(0 && "read_cb_called > 2");
   }
 }
 
diff --git a/deps/uv/test/test-fs-copyfile.c b/deps/uv/test/test-fs-copyfile.c
index 3335c88..a5fa232 100644
--- a/deps/uv/test/test-fs-copyfile.c
+++ b/deps/uv/test/test-fs-copyfile.c
@@ -25,7 +25,7 @@
 #if defined(__unix__) || defined(__POSIX__) || \
     defined(__APPLE__) || defined(__sun) || \
     defined(_AIX) || defined(__MVS__) || \
-    defined(__HAIKU__)
+    defined(__HAIKU__) || defined(__Fuchsia__)
 #include <unistd.h> /* unlink, etc. */
 #else
 # include <direct.h>
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 2966a53..282357e 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -32,7 +32,7 @@
 #if defined(__unix__) || defined(__POSIX__) || \
     defined(__APPLE__) || defined(__sun) || \
     defined(_AIX) || defined(__MVS__) || \
-    defined(__HAIKU__)
+    defined(__HAIKU__) || defined(__Fuchsia__)
 #include <unistd.h> /* unlink, rmdir, etc. */
 #else
 # include <winioctl.h>
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index eb66657..ef823a3 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -74,7 +74,9 @@
 TEST_DECLARE   (tty_escape_sequence_processing)
 #endif
 TEST_DECLARE   (tty_file)
+#ifndef __Fuchsia__
 TEST_DECLARE   (tty_pty)
+#endif
 TEST_DECLARE   (stdio_over_pipes)
 TEST_DECLARE   (stdio_emulate_iocp)
 TEST_DECLARE   (ip6_pton)
@@ -221,7 +223,9 @@
 TEST_DECLARE   (loop_handles)
 TEST_DECLARE   (get_loadavg)
 TEST_DECLARE   (walk_handles)
+#ifndef __Fuchsia__
 TEST_DECLARE   (watcher_cross_stop)
+#endif
 TEST_DECLARE   (ref)
 TEST_DECLARE   (idle_ref)
 TEST_DECLARE   (async_ref)
@@ -250,7 +254,9 @@
 TEST_DECLARE   (pipe_set_non_blocking)
 TEST_DECLARE   (pipe_set_chmod)
 TEST_DECLARE   (process_ref)
+#ifndef __Fuchsia__
 TEST_DECLARE   (process_priority)
+#endif
 TEST_DECLARE   (has_ref)
 TEST_DECLARE   (active)
 TEST_DECLARE   (embed)
@@ -462,7 +468,9 @@
 TEST_DECLARE   (ipc_listen_after_bind_twice)
 TEST_DECLARE   (win32_signum_number)
 #else
+#ifndef __Fuchsia__
 TEST_DECLARE   (emfile)
+#endif
 TEST_DECLARE   (close_fd)
 TEST_DECLARE   (spawn_fs_open)
 TEST_DECLARE   (spawn_setuid_setgid)
@@ -511,8 +519,10 @@
 #endif
 #endif
 
+#ifndef __Fuchsia__
 TEST_DECLARE  (idna_toascii)
 TEST_DECLARE  (utf8_decode1)
+#endif
 TEST_DECLARE  (uname)
 
 TASK_LIST_START
@@ -583,7 +593,9 @@
   TEST_ENTRY  (tty_escape_sequence_processing)
 #endif
   TEST_ENTRY  (tty_file)
+#ifndef __Fuchsia__
   TEST_ENTRY  (tty_pty)
+#endif
   TEST_ENTRY  (stdio_over_pipes)
   TEST_ENTRY  (stdio_emulate_iocp)
   TEST_ENTRY  (ip6_pton)
@@ -804,13 +816,17 @@
   TEST_ENTRY  (pipe_ref4)
   TEST_HELPER (pipe_ref4, pipe_echo_server)
   TEST_ENTRY  (process_ref)
+#ifndef __Fuchsia__
   TEST_ENTRY  (process_priority)
+#endif
   TEST_ENTRY  (has_ref)
 
   TEST_ENTRY  (loop_handles)
   TEST_ENTRY  (walk_handles)
 
+#ifndef __Fuchsia__
   TEST_ENTRY  (watcher_cross_stop)
+#endif
 
   TEST_ENTRY  (active)
 
@@ -929,7 +945,9 @@
   TEST_ENTRY  (ipc_listen_after_bind_twice)
   TEST_ENTRY  (win32_signum_number)
 #else
+#ifndef __Fuchsia__
   TEST_ENTRY  (emfile)
+#endif
   TEST_ENTRY  (close_fd)
   TEST_ENTRY  (spawn_fs_open)
   TEST_ENTRY  (spawn_setuid_setgid)
@@ -1038,7 +1056,9 @@
 #endif
   TEST_ENTRY  (get_osfhandle_valid_handle)
   TEST_ENTRY  (open_osfhandle_valid_handle)
+#ifndef __Fuchsia__
   TEST_ENTRY  (strscpy)
+#endif
   TEST_ENTRY  (threadpool_queue_work_simple)
   TEST_ENTRY  (threadpool_queue_work_einval)
   TEST_ENTRY_CUSTOM (threadpool_multiple_event_loops, 0, 0, 60000)
@@ -1086,11 +1106,13 @@
 #endif
 #endif
 
+#ifndef __Fuchsia__
   TEST_ENTRY  (utf8_decode1)
+#endif
   TEST_ENTRY  (uname)
 
 /* Doesn't work on z/OS because that platform uses EBCDIC, not ASCII. */
-#ifndef __MVS__
+#if !defined(__MVS__) && !defined(__Fuchsia__) 
   TEST_ENTRY  (idna_toascii)
 #endif
 
diff --git a/deps/uv/test/test-platform-output.c b/deps/uv/test/test-platform-output.c
index 65cfa1b..a75ec5d 100644
--- a/deps/uv/test/test-platform-output.c
+++ b/deps/uv/test/test-platform-output.c
@@ -25,13 +25,13 @@
 
 
 TEST_IMPL(platform_output) {
+  ASSERT(0 && "my error");
   char buffer[512];
   size_t rss;
   size_t size;
   double uptime;
   uv_pid_t pid;
   uv_pid_t ppid;
-  uv_rusage_t rusage;
   uv_cpu_info_t* cpus;
   uv_interface_address_t* interfaces;
   uv_passwd_t pwd;
@@ -66,6 +66,8 @@
   printf("uv_uptime: %f\n", uptime);
 #endif
 
+#ifndef __Fuchsia__
+  uv_rusage_t rusage;
   err = uv_getrusage(&rusage);
   ASSERT(err == 0);
   ASSERT(rusage.ru_utime.tv_sec >= 0);
@@ -82,6 +84,7 @@
   printf("  page faults: %llu\n", (unsigned long long) rusage.ru_majflt);
   printf("  maximum resident set size: %llu\n",
          (unsigned long long) rusage.ru_maxrss);
+#endif
 
   err = uv_cpu_info(&cpus, &count);
 #if defined(__CYGWIN__) || defined(__MSYS__)
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
index 314a356..b1bf662 100644
--- a/deps/uv/test/test-spawn.c
+++ b/deps/uv/test/test-spawn.c
@@ -217,7 +217,7 @@
 
   /* verify the child is successfully cleaned up within libuv */
   do
-    err = waitpid(process.pid, &status, 0);
+    err = uv__waitpid(process.pid, &status, 0);
   while (err == -1 && errno == EINTR);
 
   ASSERT(err == -1);
diff --git a/deps/uv/test/test-strscpy.c b/deps/uv/test/test-strscpy.c
index 4e7db6f..43f3329 100644
--- a/deps/uv/test/test-strscpy.c
+++ b/deps/uv/test/test-strscpy.c
@@ -23,7 +23,6 @@
 #include "task.h"
 #include <string.h>
 
-#include "../src/strscpy.h"
 #include "../src/strscpy.c"
 
 TEST_IMPL(strscpy) {