racer 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/bin/racer +33 -0
- data/ext/libuv/AUTHORS +45 -0
- data/ext/libuv/LICENSE +42 -0
- data/ext/libuv/Makefile +119 -0
- data/ext/libuv/README.md +88 -0
- data/ext/libuv/build/gcc_version.py +20 -0
- data/ext/libuv/common.gypi +176 -0
- data/ext/libuv/config-mingw.mk +61 -0
- data/ext/libuv/config-unix.mk +171 -0
- data/ext/libuv/gyp_uv +64 -0
- data/ext/libuv/include/ares.h +591 -0
- data/ext/libuv/include/ares_version.h +24 -0
- data/ext/libuv/include/uv-private/eio.h +403 -0
- data/ext/libuv/include/uv-private/ev.h +838 -0
- data/ext/libuv/include/uv-private/ngx-queue.h +108 -0
- data/ext/libuv/include/uv-private/tree.h +768 -0
- data/ext/libuv/include/uv-private/uv-unix.h +310 -0
- data/ext/libuv/include/uv-private/uv-win.h +510 -0
- data/ext/libuv/include/uv.h +1796 -0
- data/ext/libuv/src/ares/AUTHORS +37 -0
- data/ext/libuv/src/ares/CHANGES +1218 -0
- data/ext/libuv/src/ares/CMakeLists.txt +22 -0
- data/ext/libuv/src/ares/NEWS +21 -0
- data/ext/libuv/src/ares/README +60 -0
- data/ext/libuv/src/ares/README.cares +13 -0
- data/ext/libuv/src/ares/README.msvc +142 -0
- data/ext/libuv/src/ares/README.node +21 -0
- data/ext/libuv/src/ares/RELEASE-NOTES +26 -0
- data/ext/libuv/src/ares/TODO +23 -0
- data/ext/libuv/src/ares/ares__close_sockets.c +66 -0
- data/ext/libuv/src/ares/ares__get_hostent.c +263 -0
- data/ext/libuv/src/ares/ares__read_line.c +71 -0
- data/ext/libuv/src/ares/ares__timeval.c +111 -0
- data/ext/libuv/src/ares/ares_cancel.c +63 -0
- data/ext/libuv/src/ares/ares_data.c +190 -0
- data/ext/libuv/src/ares/ares_data.h +65 -0
- data/ext/libuv/src/ares/ares_destroy.c +105 -0
- data/ext/libuv/src/ares/ares_dns.h +90 -0
- data/ext/libuv/src/ares/ares_expand_name.c +200 -0
- data/ext/libuv/src/ares/ares_expand_string.c +75 -0
- data/ext/libuv/src/ares/ares_fds.c +63 -0
- data/ext/libuv/src/ares/ares_free_hostent.c +42 -0
- data/ext/libuv/src/ares/ares_free_string.c +25 -0
- data/ext/libuv/src/ares/ares_getenv.c +30 -0
- data/ext/libuv/src/ares/ares_getenv.h +26 -0
- data/ext/libuv/src/ares/ares_gethostbyaddr.c +301 -0
- data/ext/libuv/src/ares/ares_gethostbyname.c +523 -0
- data/ext/libuv/src/ares/ares_getnameinfo.c +427 -0
- data/ext/libuv/src/ares/ares_getopt.c +122 -0
- data/ext/libuv/src/ares/ares_getopt.h +53 -0
- data/ext/libuv/src/ares/ares_getsock.c +72 -0
- data/ext/libuv/src/ares/ares_init.c +1809 -0
- data/ext/libuv/src/ares/ares_iphlpapi.h +221 -0
- data/ext/libuv/src/ares/ares_ipv6.h +78 -0
- data/ext/libuv/src/ares/ares_library_init.c +142 -0
- data/ext/libuv/src/ares/ares_library_init.h +42 -0
- data/ext/libuv/src/ares/ares_llist.c +86 -0
- data/ext/libuv/src/ares/ares_llist.h +42 -0
- data/ext/libuv/src/ares/ares_mkquery.c +195 -0
- data/ext/libuv/src/ares/ares_nowarn.c +181 -0
- data/ext/libuv/src/ares/ares_nowarn.h +55 -0
- data/ext/libuv/src/ares/ares_options.c +248 -0
- data/ext/libuv/src/ares/ares_parse_a_reply.c +263 -0
- data/ext/libuv/src/ares/ares_parse_aaaa_reply.c +259 -0
- data/ext/libuv/src/ares/ares_parse_mx_reply.c +170 -0
- data/ext/libuv/src/ares/ares_parse_ns_reply.c +182 -0
- data/ext/libuv/src/ares/ares_parse_ptr_reply.c +217 -0
- data/ext/libuv/src/ares/ares_parse_srv_reply.c +179 -0
- data/ext/libuv/src/ares/ares_parse_txt_reply.c +201 -0
- data/ext/libuv/src/ares/ares_platform.c +11035 -0
- data/ext/libuv/src/ares/ares_platform.h +43 -0
- data/ext/libuv/src/ares/ares_private.h +355 -0
- data/ext/libuv/src/ares/ares_process.c +1295 -0
- data/ext/libuv/src/ares/ares_query.c +183 -0
- data/ext/libuv/src/ares/ares_rules.h +144 -0
- data/ext/libuv/src/ares/ares_search.c +321 -0
- data/ext/libuv/src/ares/ares_send.c +134 -0
- data/ext/libuv/src/ares/ares_setup.h +199 -0
- data/ext/libuv/src/ares/ares_strcasecmp.c +66 -0
- data/ext/libuv/src/ares/ares_strcasecmp.h +30 -0
- data/ext/libuv/src/ares/ares_strdup.c +42 -0
- data/ext/libuv/src/ares/ares_strdup.h +26 -0
- data/ext/libuv/src/ares/ares_strerror.c +56 -0
- data/ext/libuv/src/ares/ares_timeout.c +80 -0
- data/ext/libuv/src/ares/ares_version.c +11 -0
- data/ext/libuv/src/ares/ares_writev.c +79 -0
- data/ext/libuv/src/ares/ares_writev.h +36 -0
- data/ext/libuv/src/ares/bitncmp.c +59 -0
- data/ext/libuv/src/ares/bitncmp.h +26 -0
- data/ext/libuv/src/ares/config_cygwin/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_darwin/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_freebsd/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_linux/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_netbsd/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_openbsd/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_sunos/ares_config.h +512 -0
- data/ext/libuv/src/ares/config_win32/ares_config.h +369 -0
- data/ext/libuv/src/ares/get_ver.awk +35 -0
- data/ext/libuv/src/ares/inet_net_pton.c +451 -0
- data/ext/libuv/src/ares/inet_net_pton.h +31 -0
- data/ext/libuv/src/ares/inet_ntop.c +208 -0
- data/ext/libuv/src/ares/inet_ntop.h +26 -0
- data/ext/libuv/src/ares/nameser.h +203 -0
- data/ext/libuv/src/ares/setup_once.h +504 -0
- data/ext/libuv/src/ares/windows_port.c +22 -0
- data/ext/libuv/src/cares.c +225 -0
- data/ext/libuv/src/fs-poll.c +237 -0
- data/ext/libuv/src/unix/async.c +119 -0
- data/ext/libuv/src/unix/core.c +647 -0
- data/ext/libuv/src/unix/cygwin.c +84 -0
- data/ext/libuv/src/unix/darwin.c +341 -0
- data/ext/libuv/src/unix/dl.c +83 -0
- data/ext/libuv/src/unix/eio/Changes +63 -0
- data/ext/libuv/src/unix/eio/LICENSE +36 -0
- data/ext/libuv/src/unix/eio/Makefile.am +15 -0
- data/ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
- data/ext/libuv/src/unix/eio/autogen.sh +3 -0
- data/ext/libuv/src/unix/eio/config.h.in +86 -0
- data/ext/libuv/src/unix/eio/config_cygwin.h +80 -0
- data/ext/libuv/src/unix/eio/config_darwin.h +141 -0
- data/ext/libuv/src/unix/eio/config_freebsd.h +81 -0
- data/ext/libuv/src/unix/eio/config_linux.h +94 -0
- data/ext/libuv/src/unix/eio/config_netbsd.h +81 -0
- data/ext/libuv/src/unix/eio/config_openbsd.h +137 -0
- data/ext/libuv/src/unix/eio/config_sunos.h +84 -0
- data/ext/libuv/src/unix/eio/configure.ac +22 -0
- data/ext/libuv/src/unix/eio/demo.c +194 -0
- data/ext/libuv/src/unix/eio/ecb.h +370 -0
- data/ext/libuv/src/unix/eio/eio.3 +3428 -0
- data/ext/libuv/src/unix/eio/eio.c +2593 -0
- data/ext/libuv/src/unix/eio/eio.pod +969 -0
- data/ext/libuv/src/unix/eio/libeio.m4 +195 -0
- data/ext/libuv/src/unix/eio/xthread.h +164 -0
- data/ext/libuv/src/unix/error.c +104 -0
- data/ext/libuv/src/unix/ev/Changes +388 -0
- data/ext/libuv/src/unix/ev/LICENSE +36 -0
- data/ext/libuv/src/unix/ev/Makefile.am +18 -0
- data/ext/libuv/src/unix/ev/Makefile.in +771 -0
- data/ext/libuv/src/unix/ev/README +58 -0
- data/ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
- data/ext/libuv/src/unix/ev/autogen.sh +6 -0
- data/ext/libuv/src/unix/ev/config.guess +1526 -0
- data/ext/libuv/src/unix/ev/config.h.in +125 -0
- data/ext/libuv/src/unix/ev/config.sub +1658 -0
- data/ext/libuv/src/unix/ev/config_cygwin.h +123 -0
- data/ext/libuv/src/unix/ev/config_darwin.h +122 -0
- data/ext/libuv/src/unix/ev/config_freebsd.h +120 -0
- data/ext/libuv/src/unix/ev/config_linux.h +141 -0
- data/ext/libuv/src/unix/ev/config_netbsd.h +120 -0
- data/ext/libuv/src/unix/ev/config_openbsd.h +126 -0
- data/ext/libuv/src/unix/ev/config_sunos.h +122 -0
- data/ext/libuv/src/unix/ev/configure +13037 -0
- data/ext/libuv/src/unix/ev/configure.ac +18 -0
- data/ext/libuv/src/unix/ev/depcomp +630 -0
- data/ext/libuv/src/unix/ev/ev++.h +816 -0
- data/ext/libuv/src/unix/ev/ev.3 +5311 -0
- data/ext/libuv/src/unix/ev/ev.c +3925 -0
- data/ext/libuv/src/unix/ev/ev.pod +5243 -0
- data/ext/libuv/src/unix/ev/ev_epoll.c +266 -0
- data/ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
- data/ext/libuv/src/unix/ev/ev_poll.c +148 -0
- data/ext/libuv/src/unix/ev/ev_port.c +179 -0
- data/ext/libuv/src/unix/ev/ev_select.c +310 -0
- data/ext/libuv/src/unix/ev/ev_vars.h +203 -0
- data/ext/libuv/src/unix/ev/ev_win32.c +153 -0
- data/ext/libuv/src/unix/ev/ev_wrap.h +196 -0
- data/ext/libuv/src/unix/ev/event.c +402 -0
- data/ext/libuv/src/unix/ev/event.h +170 -0
- data/ext/libuv/src/unix/ev/install-sh +294 -0
- data/ext/libuv/src/unix/ev/libev.m4 +39 -0
- data/ext/libuv/src/unix/ev/ltmain.sh +8413 -0
- data/ext/libuv/src/unix/ev/missing +336 -0
- data/ext/libuv/src/unix/ev/mkinstalldirs +111 -0
- data/ext/libuv/src/unix/freebsd.c +312 -0
- data/ext/libuv/src/unix/fs.c +699 -0
- data/ext/libuv/src/unix/internal.h +180 -0
- data/ext/libuv/src/unix/kqueue.c +122 -0
- data/ext/libuv/src/unix/linux/core.c +474 -0
- data/ext/libuv/src/unix/linux/inotify.c +209 -0
- data/ext/libuv/src/unix/linux/syscalls.c +268 -0
- data/ext/libuv/src/unix/linux/syscalls.h +93 -0
- data/ext/libuv/src/unix/loop-watcher.c +63 -0
- data/ext/libuv/src/unix/loop.c +81 -0
- data/ext/libuv/src/unix/netbsd.c +108 -0
- data/ext/libuv/src/unix/openbsd.c +295 -0
- data/ext/libuv/src/unix/pipe.c +261 -0
- data/ext/libuv/src/unix/poll.c +116 -0
- data/ext/libuv/src/unix/process.c +447 -0
- data/ext/libuv/src/unix/stream.c +1026 -0
- data/ext/libuv/src/unix/sunos.c +483 -0
- data/ext/libuv/src/unix/tcp.c +328 -0
- data/ext/libuv/src/unix/thread.c +211 -0
- data/ext/libuv/src/unix/timer.c +138 -0
- data/ext/libuv/src/unix/tty.c +146 -0
- data/ext/libuv/src/unix/udp.c +661 -0
- data/ext/libuv/src/unix/uv-eio.c +107 -0
- data/ext/libuv/src/unix/uv-eio.h +13 -0
- data/ext/libuv/src/uv-common.c +384 -0
- data/ext/libuv/src/uv-common.h +171 -0
- data/ext/libuv/src/win/async.c +130 -0
- data/ext/libuv/src/win/core.c +283 -0
- data/ext/libuv/src/win/dl.c +86 -0
- data/ext/libuv/src/win/error.c +150 -0
- data/ext/libuv/src/win/fs-event.c +512 -0
- data/ext/libuv/src/win/fs.c +1856 -0
- data/ext/libuv/src/win/getaddrinfo.c +365 -0
- data/ext/libuv/src/win/handle-inl.h +145 -0
- data/ext/libuv/src/win/handle.c +150 -0
- data/ext/libuv/src/win/internal.h +337 -0
- data/ext/libuv/src/win/loop-watcher.c +123 -0
- data/ext/libuv/src/win/pipe.c +1675 -0
- data/ext/libuv/src/win/poll.c +618 -0
- data/ext/libuv/src/win/process-stdio.c +479 -0
- data/ext/libuv/src/win/process.c +1013 -0
- data/ext/libuv/src/win/req-inl.h +225 -0
- data/ext/libuv/src/win/req.c +25 -0
- data/ext/libuv/src/win/stream-inl.h +69 -0
- data/ext/libuv/src/win/stream.c +167 -0
- data/ext/libuv/src/win/tcp.c +1400 -0
- data/ext/libuv/src/win/thread.c +372 -0
- data/ext/libuv/src/win/threadpool.c +74 -0
- data/ext/libuv/src/win/timer.c +226 -0
- data/ext/libuv/src/win/tty.c +1801 -0
- data/ext/libuv/src/win/udp.c +718 -0
- data/ext/libuv/src/win/util.c +864 -0
- data/ext/libuv/src/win/winapi.c +132 -0
- data/ext/libuv/src/win/winapi.h +4443 -0
- data/ext/libuv/src/win/winsock.c +557 -0
- data/ext/libuv/src/win/winsock.h +171 -0
- data/ext/libuv/test/benchmark-ares.c +117 -0
- data/ext/libuv/test/benchmark-fs-stat.c +164 -0
- data/ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/libuv/test/benchmark-list.h +114 -0
- data/ext/libuv/test/benchmark-loop-count.c +88 -0
- data/ext/libuv/test/benchmark-million-timers.c +65 -0
- data/ext/libuv/test/benchmark-ping-pongs.c +213 -0
- data/ext/libuv/test/benchmark-pound.c +324 -0
- data/ext/libuv/test/benchmark-pump.c +462 -0
- data/ext/libuv/test/benchmark-sizes.c +42 -0
- data/ext/libuv/test/benchmark-spawn.c +162 -0
- data/ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
- data/ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
- data/ext/libuv/test/blackhole-server.c +118 -0
- data/ext/libuv/test/dns-server.c +321 -0
- data/ext/libuv/test/echo-server.c +378 -0
- data/ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/libuv/test/run-benchmarks.c +64 -0
- data/ext/libuv/test/run-tests.c +138 -0
- data/ext/libuv/test/runner-unix.c +290 -0
- data/ext/libuv/test/runner-unix.h +36 -0
- data/ext/libuv/test/runner-win.c +285 -0
- data/ext/libuv/test/runner-win.h +42 -0
- data/ext/libuv/test/runner.c +326 -0
- data/ext/libuv/test/runner.h +159 -0
- data/ext/libuv/test/task.h +109 -0
- data/ext/libuv/test/test-async.c +118 -0
- data/ext/libuv/test/test-callback-order.c +76 -0
- data/ext/libuv/test/test-callback-stack.c +203 -0
- data/ext/libuv/test/test-connection-fail.c +148 -0
- data/ext/libuv/test/test-counters-init.c +215 -0
- data/ext/libuv/test/test-cwd-and-chdir.c +64 -0
- data/ext/libuv/test/test-delayed-accept.c +197 -0
- data/ext/libuv/test/test-dlerror.c +58 -0
- data/ext/libuv/test/test-error.c +59 -0
- data/ext/libuv/test/test-fail-always.c +29 -0
- data/ext/libuv/test/test-fs-event.c +442 -0
- data/ext/libuv/test/test-fs-poll.c +146 -0
- data/ext/libuv/test/test-fs.c +1843 -0
- data/ext/libuv/test/test-get-currentexe.c +63 -0
- data/ext/libuv/test/test-get-loadavg.c +36 -0
- data/ext/libuv/test/test-get-memory.c +38 -0
- data/ext/libuv/test/test-getaddrinfo.c +122 -0
- data/ext/libuv/test/test-gethostbyname.c +189 -0
- data/ext/libuv/test/test-getsockname.c +342 -0
- data/ext/libuv/test/test-hrtime.c +54 -0
- data/ext/libuv/test/test-idle.c +81 -0
- data/ext/libuv/test/test-ipc-send-recv.c +209 -0
- data/ext/libuv/test/test-ipc.c +620 -0
- data/ext/libuv/test/test-list.h +421 -0
- data/ext/libuv/test/test-loop-handles.c +336 -0
- data/ext/libuv/test/test-multiple-listen.c +102 -0
- data/ext/libuv/test/test-mutexes.c +63 -0
- data/ext/libuv/test/test-pass-always.c +28 -0
- data/ext/libuv/test/test-ping-pong.c +253 -0
- data/ext/libuv/test/test-pipe-bind-error.c +140 -0
- data/ext/libuv/test/test-pipe-connect-error.c +96 -0
- data/ext/libuv/test/test-platform-output.c +87 -0
- data/ext/libuv/test/test-poll-close.c +77 -0
- data/ext/libuv/test/test-poll.c +573 -0
- data/ext/libuv/test/test-process-title.c +42 -0
- data/ext/libuv/test/test-ref.c +338 -0
- data/ext/libuv/test/test-run-once.c +48 -0
- data/ext/libuv/test/test-semaphore.c +111 -0
- data/ext/libuv/test/test-shutdown-close.c +103 -0
- data/ext/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/libuv/test/test-spawn.c +847 -0
- data/ext/libuv/test/test-stdio-over-pipes.c +246 -0
- data/ext/libuv/test/test-tcp-bind-error.c +191 -0
- data/ext/libuv/test/test-tcp-bind6-error.c +154 -0
- data/ext/libuv/test/test-tcp-close-while-connecting.c +80 -0
- data/ext/libuv/test/test-tcp-close.c +129 -0
- data/ext/libuv/test/test-tcp-connect-error-after-write.c +95 -0
- data/ext/libuv/test/test-tcp-connect-error.c +70 -0
- data/ext/libuv/test/test-tcp-connect-timeout.c +85 -0
- data/ext/libuv/test/test-tcp-connect6-error.c +68 -0
- data/ext/libuv/test/test-tcp-flags.c +51 -0
- data/ext/libuv/test/test-tcp-shutdown-after-write.c +131 -0
- data/ext/libuv/test/test-tcp-write-error.c +168 -0
- data/ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
- data/ext/libuv/test/test-tcp-writealot.c +170 -0
- data/ext/libuv/test/test-thread.c +183 -0
- data/ext/libuv/test/test-threadpool.c +57 -0
- data/ext/libuv/test/test-timer-again.c +141 -0
- data/ext/libuv/test/test-timer.c +152 -0
- data/ext/libuv/test/test-tty.c +110 -0
- data/ext/libuv/test/test-udp-dgram-too-big.c +86 -0
- data/ext/libuv/test/test-udp-ipv6.c +156 -0
- data/ext/libuv/test/test-udp-multicast-join.c +139 -0
- data/ext/libuv/test/test-udp-multicast-ttl.c +86 -0
- data/ext/libuv/test/test-udp-options.c +86 -0
- data/ext/libuv/test/test-udp-send-and-recv.c +208 -0
- data/ext/libuv/test/test-util.c +97 -0
- data/ext/libuv/test/test-walk-handles.c +77 -0
- data/ext/libuv/uv.gyp +452 -0
- data/ext/libuv/vcbuild.bat +105 -0
- data/ext/racer/extconf.rb +20 -0
- data/ext/racer/http_parser.c +2059 -0
- data/ext/racer/http_parser.h +318 -0
- data/ext/racer/mkmf.log +22 -0
- data/ext/racer/racer.c +551 -0
- data/lib/racer.rb +2 -0
- data/lib/racer/version.rb +3 -0
- metadata +382 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#ifndef TEST_RUNNER_UNIX_H
|
23
|
+
#define TEST_RUNNER_UNIX_H
|
24
|
+
|
25
|
+
#include <sys/types.h>
|
26
|
+
#include <stdio.h> /* FILE */
|
27
|
+
|
28
|
+
typedef struct {
|
29
|
+
FILE* stdout_file;
|
30
|
+
pid_t pid;
|
31
|
+
char* name;
|
32
|
+
int status;
|
33
|
+
int terminated;
|
34
|
+
} process_info_t;
|
35
|
+
|
36
|
+
#endif /* TEST_RUNNER_UNIX_H */
|
@@ -0,0 +1,285 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <fcntl.h>
|
23
|
+
#include <io.h>
|
24
|
+
#include <malloc.h>
|
25
|
+
#include <stdio.h>
|
26
|
+
#include <process.h>
|
27
|
+
#include <windows.h>
|
28
|
+
|
29
|
+
#include "task.h"
|
30
|
+
#include "runner.h"
|
31
|
+
|
32
|
+
|
33
|
+
/*
|
34
|
+
* Define the stuff that MinGW doesn't have
|
35
|
+
*/
|
36
|
+
#ifndef GetFileSizeEx
|
37
|
+
WINBASEAPI BOOL WINAPI GetFileSizeEx(HANDLE hFile,
|
38
|
+
PLARGE_INTEGER lpFileSize);
|
39
|
+
#endif
|
40
|
+
|
41
|
+
|
42
|
+
/* Do platform-specific initialization. */
|
43
|
+
void platform_init(int argc, char **argv) {
|
44
|
+
/* Disable the "application crashed" popup. */
|
45
|
+
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
|
46
|
+
SEM_NOOPENFILEERRORBOX);
|
47
|
+
|
48
|
+
_setmode(0, _O_BINARY);
|
49
|
+
_setmode(1, _O_BINARY);
|
50
|
+
_setmode(2, _O_BINARY);
|
51
|
+
|
52
|
+
/* Disable stdio output buffering. */
|
53
|
+
setvbuf(stdout, NULL, _IONBF, 0);
|
54
|
+
setvbuf(stderr, NULL, _IONBF, 0);
|
55
|
+
|
56
|
+
strcpy(executable_path, argv[0]);
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
int process_start(char *name, char *part, process_info_t *p) {
|
61
|
+
HANDLE file = INVALID_HANDLE_VALUE;
|
62
|
+
HANDLE nul = INVALID_HANDLE_VALUE;
|
63
|
+
WCHAR path[MAX_PATH], filename[MAX_PATH];
|
64
|
+
WCHAR image[MAX_PATH + 1];
|
65
|
+
WCHAR args[MAX_PATH * 2];
|
66
|
+
STARTUPINFOW si;
|
67
|
+
PROCESS_INFORMATION pi;
|
68
|
+
DWORD result;
|
69
|
+
|
70
|
+
if (GetTempPathW(sizeof(path) / sizeof(WCHAR), (WCHAR*)&path) == 0)
|
71
|
+
goto error;
|
72
|
+
if (GetTempFileNameW((WCHAR*)&path, L"uv", 0, (WCHAR*)&filename) == 0)
|
73
|
+
goto error;
|
74
|
+
|
75
|
+
file = CreateFileW((WCHAR*)filename,
|
76
|
+
GENERIC_READ | GENERIC_WRITE,
|
77
|
+
0,
|
78
|
+
NULL,
|
79
|
+
CREATE_ALWAYS,
|
80
|
+
FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE,
|
81
|
+
NULL);
|
82
|
+
if (file == INVALID_HANDLE_VALUE)
|
83
|
+
goto error;
|
84
|
+
|
85
|
+
if (!SetHandleInformation(file, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
|
86
|
+
goto error;
|
87
|
+
|
88
|
+
nul = CreateFileA("nul",
|
89
|
+
GENERIC_READ,
|
90
|
+
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
91
|
+
NULL,
|
92
|
+
OPEN_EXISTING,
|
93
|
+
FILE_ATTRIBUTE_NORMAL,
|
94
|
+
NULL);
|
95
|
+
if (nul == INVALID_HANDLE_VALUE)
|
96
|
+
goto error;
|
97
|
+
|
98
|
+
if (!SetHandleInformation(nul, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
|
99
|
+
goto error;
|
100
|
+
|
101
|
+
result = GetModuleFileNameW(NULL, (WCHAR*)&image, sizeof(image) / sizeof(WCHAR));
|
102
|
+
if (result == 0 || result == sizeof(image))
|
103
|
+
goto error;
|
104
|
+
|
105
|
+
if (part) {
|
106
|
+
if (_snwprintf((wchar_t*)args,
|
107
|
+
sizeof(args) / sizeof(wchar_t),
|
108
|
+
L"\"%s\" %S %S",
|
109
|
+
image,
|
110
|
+
name,
|
111
|
+
part) < 0) {
|
112
|
+
goto error;
|
113
|
+
}
|
114
|
+
} else {
|
115
|
+
if (_snwprintf((wchar_t*)args,
|
116
|
+
sizeof(args) / sizeof(wchar_t),
|
117
|
+
L"\"%s\" %S",
|
118
|
+
image,
|
119
|
+
name) < 0) {
|
120
|
+
goto error;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
memset((void*)&si, 0, sizeof(si));
|
125
|
+
si.cb = sizeof(si);
|
126
|
+
si.dwFlags = STARTF_USESTDHANDLES;
|
127
|
+
si.hStdInput = nul;
|
128
|
+
si.hStdOutput = file;
|
129
|
+
si.hStdError = file;
|
130
|
+
|
131
|
+
if (!CreateProcessW(image, args, NULL, NULL, TRUE,
|
132
|
+
0, NULL, NULL, &si, &pi))
|
133
|
+
goto error;
|
134
|
+
|
135
|
+
CloseHandle(pi.hThread);
|
136
|
+
|
137
|
+
SetHandleInformation(nul, HANDLE_FLAG_INHERIT, 0);
|
138
|
+
SetHandleInformation(file, HANDLE_FLAG_INHERIT, 0);
|
139
|
+
|
140
|
+
p->stdio_in = nul;
|
141
|
+
p->stdio_out = file;
|
142
|
+
p->process = pi.hProcess;
|
143
|
+
p->name = part;
|
144
|
+
|
145
|
+
return 0;
|
146
|
+
|
147
|
+
error:
|
148
|
+
if (file != INVALID_HANDLE_VALUE)
|
149
|
+
CloseHandle(file);
|
150
|
+
if (nul != INVALID_HANDLE_VALUE)
|
151
|
+
CloseHandle(nul);
|
152
|
+
|
153
|
+
return -1;
|
154
|
+
}
|
155
|
+
|
156
|
+
|
157
|
+
/* Timeout is is msecs. Set timeout < 0 to never time out. */
|
158
|
+
/* Returns 0 when all processes are terminated, -2 on timeout. */
|
159
|
+
int process_wait(process_info_t *vec, int n, int timeout) {
|
160
|
+
int i;
|
161
|
+
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
|
162
|
+
DWORD timeout_api, result;
|
163
|
+
|
164
|
+
/* If there's nothing to wait for, return immediately. */
|
165
|
+
if (n == 0)
|
166
|
+
return 0;
|
167
|
+
|
168
|
+
ASSERT(n <= MAXIMUM_WAIT_OBJECTS);
|
169
|
+
|
170
|
+
for (i = 0; i < n; i++)
|
171
|
+
handles[i] = vec[i].process;
|
172
|
+
|
173
|
+
if (timeout >= 0) {
|
174
|
+
timeout_api = (DWORD)timeout;
|
175
|
+
} else {
|
176
|
+
timeout_api = INFINITE;
|
177
|
+
}
|
178
|
+
|
179
|
+
result = WaitForMultipleObjects(n, handles, TRUE, timeout_api);
|
180
|
+
|
181
|
+
if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + n) {
|
182
|
+
/* All processes are terminated. */
|
183
|
+
return 0;
|
184
|
+
}
|
185
|
+
if (result == WAIT_TIMEOUT) {
|
186
|
+
return -2;
|
187
|
+
}
|
188
|
+
return -1;
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
long int process_output_size(process_info_t *p) {
|
193
|
+
LARGE_INTEGER size;
|
194
|
+
if (!GetFileSizeEx(p->stdio_out, &size))
|
195
|
+
return -1;
|
196
|
+
return (long int)size.QuadPart;
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
int process_copy_output(process_info_t *p, int fd) {
|
201
|
+
DWORD read;
|
202
|
+
char buf[1024];
|
203
|
+
|
204
|
+
if (SetFilePointer(p->stdio_out, 0, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
|
205
|
+
return -1;
|
206
|
+
|
207
|
+
while (ReadFile(p->stdio_out, (void*)&buf, sizeof(buf), &read, NULL) &&
|
208
|
+
read > 0)
|
209
|
+
write(fd, buf, read);
|
210
|
+
|
211
|
+
if (GetLastError() != ERROR_HANDLE_EOF)
|
212
|
+
return -1;
|
213
|
+
|
214
|
+
return 0;
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
char* process_get_name(process_info_t *p) {
|
219
|
+
return p->name;
|
220
|
+
}
|
221
|
+
|
222
|
+
|
223
|
+
int process_terminate(process_info_t *p) {
|
224
|
+
if (!TerminateProcess(p->process, 1))
|
225
|
+
return -1;
|
226
|
+
return 0;
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
int process_reap(process_info_t *p) {
|
231
|
+
DWORD exitCode;
|
232
|
+
if (!GetExitCodeProcess(p->process, &exitCode))
|
233
|
+
return -1;
|
234
|
+
return (int)exitCode;
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
void process_cleanup(process_info_t *p) {
|
239
|
+
CloseHandle(p->process);
|
240
|
+
CloseHandle(p->stdio_in);
|
241
|
+
CloseHandle(p->stdio_out);
|
242
|
+
}
|
243
|
+
|
244
|
+
|
245
|
+
static int clear_line() {
|
246
|
+
HANDLE handle;
|
247
|
+
CONSOLE_SCREEN_BUFFER_INFO info;
|
248
|
+
COORD coord;
|
249
|
+
DWORD written;
|
250
|
+
|
251
|
+
handle = (HANDLE)_get_osfhandle(fileno(stderr));
|
252
|
+
if (handle == INVALID_HANDLE_VALUE)
|
253
|
+
return -1;
|
254
|
+
|
255
|
+
if (!GetConsoleScreenBufferInfo(handle, &info))
|
256
|
+
return -1;
|
257
|
+
|
258
|
+
coord = info.dwCursorPosition;
|
259
|
+
if (coord.Y <= 0)
|
260
|
+
return -1;
|
261
|
+
|
262
|
+
coord.X = 0;
|
263
|
+
|
264
|
+
if (!SetConsoleCursorPosition(handle, coord))
|
265
|
+
return -1;
|
266
|
+
|
267
|
+
if (!FillConsoleOutputCharacterW(handle, 0x20, info.dwSize.X, coord, &written))
|
268
|
+
return -1;
|
269
|
+
|
270
|
+
return 0;
|
271
|
+
}
|
272
|
+
|
273
|
+
|
274
|
+
void rewind_cursor() {
|
275
|
+
if (clear_line() == -1) {
|
276
|
+
/* If clear_line fails (stdout is not a console), print a newline. */
|
277
|
+
fprintf(stderr, "\n");
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
|
282
|
+
/* Pause the calling thread for a number of milliseconds. */
|
283
|
+
void uv_sleep(int msec) {
|
284
|
+
Sleep(msec);
|
285
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
/* Don't complain about _snprintf being insecure. */
|
23
|
+
#define _CRT_SECURE_NO_WARNINGS
|
24
|
+
|
25
|
+
/* Don't complain about write(), fileno() etc. being deprecated. */
|
26
|
+
#pragma warning(disable : 4996)
|
27
|
+
|
28
|
+
|
29
|
+
#include <windows.h>
|
30
|
+
#include <stdio.h>
|
31
|
+
|
32
|
+
|
33
|
+
/* Windows has no snprintf, only _snprintf. */
|
34
|
+
#define snprintf _snprintf
|
35
|
+
|
36
|
+
|
37
|
+
typedef struct {
|
38
|
+
HANDLE process;
|
39
|
+
HANDLE stdio_in;
|
40
|
+
HANDLE stdio_out;
|
41
|
+
char *name;
|
42
|
+
} process_info_t;
|
@@ -0,0 +1,326 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <stdio.h>
|
23
|
+
#include <string.h>
|
24
|
+
|
25
|
+
#include "runner.h"
|
26
|
+
#include "task.h"
|
27
|
+
|
28
|
+
char executable_path[PATHMAX] = { '\0' };
|
29
|
+
|
30
|
+
|
31
|
+
static void log_progress(int total, int passed, int failed, const char* name) {
|
32
|
+
if (total == 0)
|
33
|
+
total = 1;
|
34
|
+
|
35
|
+
LOGF("[%% %3d|+ %3d|- %3d]: %s", (int) ((passed + failed) / ((double) total) * 100.0),
|
36
|
+
passed, failed, name);
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
int run_tests(int timeout, int benchmark_output) {
|
41
|
+
int total, passed, failed;
|
42
|
+
task_entry_t* task;
|
43
|
+
|
44
|
+
/* Count the number of tests. */
|
45
|
+
total = 0;
|
46
|
+
for (task = TASKS; task->main; task++) {
|
47
|
+
if (!task->is_helper) {
|
48
|
+
total++;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
/* Run all tests. */
|
53
|
+
passed = 0;
|
54
|
+
failed = 0;
|
55
|
+
for (task = TASKS; task->main; task++) {
|
56
|
+
if (task->is_helper) {
|
57
|
+
continue;
|
58
|
+
}
|
59
|
+
|
60
|
+
rewind_cursor();
|
61
|
+
if (!benchmark_output) {
|
62
|
+
log_progress(total, passed, failed, task->task_name);
|
63
|
+
}
|
64
|
+
|
65
|
+
if (run_test(task->task_name, timeout, benchmark_output) == 0) {
|
66
|
+
passed++;
|
67
|
+
} else {
|
68
|
+
failed++;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
rewind_cursor();
|
73
|
+
|
74
|
+
if (!benchmark_output) {
|
75
|
+
log_progress(total, passed, failed, "Done.\n");
|
76
|
+
}
|
77
|
+
|
78
|
+
return failed;
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
int run_test(const char* test, int timeout, int benchmark_output) {
|
83
|
+
char errmsg[1024] = "no error";
|
84
|
+
process_info_t processes[1024];
|
85
|
+
process_info_t *main_proc;
|
86
|
+
task_entry_t* task;
|
87
|
+
int process_count;
|
88
|
+
int result;
|
89
|
+
int status;
|
90
|
+
int i;
|
91
|
+
|
92
|
+
status = 255;
|
93
|
+
main_proc = NULL;
|
94
|
+
process_count = 0;
|
95
|
+
|
96
|
+
#ifndef _WIN32
|
97
|
+
/* Clean up stale socket from previous run. */
|
98
|
+
remove(TEST_PIPENAME);
|
99
|
+
#endif
|
100
|
+
|
101
|
+
/* If it's a helper the user asks for, start it directly. */
|
102
|
+
for (task = TASKS; task->main; task++) {
|
103
|
+
if (task->is_helper && strcmp(test, task->process_name) == 0) {
|
104
|
+
return task->main();
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
/* Start the helpers first. */
|
109
|
+
for (task = TASKS; task->main; task++) {
|
110
|
+
if (strcmp(test, task->task_name) != 0) {
|
111
|
+
continue;
|
112
|
+
}
|
113
|
+
|
114
|
+
/* Skip the test itself. */
|
115
|
+
if (!task->is_helper) {
|
116
|
+
continue;
|
117
|
+
}
|
118
|
+
|
119
|
+
if (process_start(task->task_name,
|
120
|
+
task->process_name,
|
121
|
+
&processes[process_count]) == -1) {
|
122
|
+
snprintf(errmsg,
|
123
|
+
sizeof errmsg,
|
124
|
+
"Process `%s` failed to start.",
|
125
|
+
task->process_name);
|
126
|
+
goto out;
|
127
|
+
}
|
128
|
+
|
129
|
+
process_count++;
|
130
|
+
}
|
131
|
+
|
132
|
+
/* Give the helpers time to settle. Race-y, fix this. */
|
133
|
+
uv_sleep(250);
|
134
|
+
|
135
|
+
/* Now start the test itself. */
|
136
|
+
for (task = TASKS; task->main; task++) {
|
137
|
+
if (strcmp(test, task->task_name) != 0) {
|
138
|
+
continue;
|
139
|
+
}
|
140
|
+
|
141
|
+
if (task->is_helper) {
|
142
|
+
continue;
|
143
|
+
}
|
144
|
+
|
145
|
+
if (process_start(task->task_name,
|
146
|
+
task->process_name,
|
147
|
+
&processes[process_count]) == -1) {
|
148
|
+
snprintf(errmsg,
|
149
|
+
sizeof errmsg,
|
150
|
+
"Process `%s` failed to start.",
|
151
|
+
task->process_name);
|
152
|
+
goto out;
|
153
|
+
}
|
154
|
+
|
155
|
+
main_proc = &processes[process_count];
|
156
|
+
process_count++;
|
157
|
+
break;
|
158
|
+
}
|
159
|
+
|
160
|
+
if (main_proc == NULL) {
|
161
|
+
snprintf(errmsg,
|
162
|
+
sizeof errmsg,
|
163
|
+
"No test with that name: %s",
|
164
|
+
test);
|
165
|
+
goto out;
|
166
|
+
}
|
167
|
+
|
168
|
+
result = process_wait(main_proc, 1, timeout);
|
169
|
+
if (result == -1) {
|
170
|
+
FATAL("process_wait failed");
|
171
|
+
} else if (result == -2) {
|
172
|
+
/* Don't have to clean up the process, process_wait() has killed it. */
|
173
|
+
snprintf(errmsg,
|
174
|
+
sizeof errmsg,
|
175
|
+
"timeout");
|
176
|
+
goto out;
|
177
|
+
}
|
178
|
+
|
179
|
+
status = process_reap(main_proc);
|
180
|
+
if (status != 0) {
|
181
|
+
snprintf(errmsg,
|
182
|
+
sizeof errmsg,
|
183
|
+
"exit code %d",
|
184
|
+
status);
|
185
|
+
goto out;
|
186
|
+
}
|
187
|
+
|
188
|
+
if (benchmark_output) {
|
189
|
+
/* Give the helpers time to clean up their act. */
|
190
|
+
uv_sleep(1000);
|
191
|
+
}
|
192
|
+
|
193
|
+
out:
|
194
|
+
/* Reap running processes except the main process, it's already dead. */
|
195
|
+
for (i = 0; i < process_count - 1; i++) {
|
196
|
+
process_terminate(&processes[i]);
|
197
|
+
}
|
198
|
+
|
199
|
+
if (process_count > 0 &&
|
200
|
+
process_wait(processes, process_count - 1, -1) < 0) {
|
201
|
+
FATAL("process_wait failed");
|
202
|
+
}
|
203
|
+
|
204
|
+
/* Show error and output from processes if the test failed. */
|
205
|
+
if (status != 0 || task->show_output) {
|
206
|
+
if (status != 0) {
|
207
|
+
LOGF("\n`%s` failed: %s\n", test, errmsg);
|
208
|
+
} else {
|
209
|
+
LOGF("\n");
|
210
|
+
}
|
211
|
+
|
212
|
+
for (i = 0; i < process_count; i++) {
|
213
|
+
switch (process_output_size(&processes[i])) {
|
214
|
+
case -1:
|
215
|
+
LOGF("Output from process `%s`: (unavailable)\n",
|
216
|
+
process_get_name(&processes[i]));
|
217
|
+
break;
|
218
|
+
|
219
|
+
case 0:
|
220
|
+
LOGF("Output from process `%s`: (no output)\n",
|
221
|
+
process_get_name(&processes[i]));
|
222
|
+
break;
|
223
|
+
|
224
|
+
default:
|
225
|
+
LOGF("Output from process `%s`:\n", process_get_name(&processes[i]));
|
226
|
+
process_copy_output(&processes[i], fileno(stderr));
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
LOG("=============================================================\n");
|
231
|
+
|
232
|
+
/* In benchmark mode show concise output from the main process. */
|
233
|
+
} else if (benchmark_output) {
|
234
|
+
switch (process_output_size(main_proc)) {
|
235
|
+
case -1:
|
236
|
+
LOGF("%s: (unavailable)\n", test);
|
237
|
+
break;
|
238
|
+
|
239
|
+
case 0:
|
240
|
+
LOGF("%s: (no output)\n", test);
|
241
|
+
break;
|
242
|
+
|
243
|
+
default:
|
244
|
+
for (i = 0; i < process_count; i++) {
|
245
|
+
process_copy_output(&processes[i], fileno(stderr));
|
246
|
+
}
|
247
|
+
break;
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
/* Clean up all process handles. */
|
252
|
+
for (i = 0; i < process_count; i++) {
|
253
|
+
process_cleanup(&processes[i]);
|
254
|
+
}
|
255
|
+
|
256
|
+
return status;
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
/* Returns the status code of the task part
|
261
|
+
* or 255 if no matching task was not found.
|
262
|
+
*/
|
263
|
+
int run_test_part(const char* test, const char* part) {
|
264
|
+
task_entry_t* task;
|
265
|
+
|
266
|
+
for (task = TASKS; task->main; task++) {
|
267
|
+
if (strcmp(test, task->task_name) == 0
|
268
|
+
&& strcmp(part, task->process_name) == 0) {
|
269
|
+
return task->main();
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
LOGF("No test part with that name: %s:%s\n", test, part);
|
274
|
+
return 255;
|
275
|
+
}
|
276
|
+
|
277
|
+
|
278
|
+
static int compare_task(const void* va, const void* vb) {
|
279
|
+
const task_entry_t* a = va;
|
280
|
+
const task_entry_t* b = vb;
|
281
|
+
return strcmp(a->task_name, b->task_name);
|
282
|
+
}
|
283
|
+
|
284
|
+
|
285
|
+
static int find_helpers(const task_entry_t* task, const task_entry_t** helpers) {
|
286
|
+
const task_entry_t* helper;
|
287
|
+
int n_helpers;
|
288
|
+
|
289
|
+
for (n_helpers = 0, helper = TASKS; helper->main; helper++) {
|
290
|
+
if (helper->is_helper && strcmp(helper->task_name, task->task_name) == 0) {
|
291
|
+
*helpers++ = helper;
|
292
|
+
n_helpers++;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
return n_helpers;
|
297
|
+
}
|
298
|
+
|
299
|
+
|
300
|
+
void print_tests(FILE* stream) {
|
301
|
+
const task_entry_t* helpers[1024];
|
302
|
+
const task_entry_t* task;
|
303
|
+
int n_helpers;
|
304
|
+
int n_tasks;
|
305
|
+
int i;
|
306
|
+
|
307
|
+
for (n_tasks = 0, task = TASKS; task->main; n_tasks++, task++);
|
308
|
+
qsort(TASKS, n_tasks, sizeof(TASKS[0]), compare_task);
|
309
|
+
|
310
|
+
for (task = TASKS; task->main; task++) {
|
311
|
+
if (task->is_helper) {
|
312
|
+
continue;
|
313
|
+
}
|
314
|
+
|
315
|
+
n_helpers = find_helpers(task, helpers);
|
316
|
+
if (n_helpers) {
|
317
|
+
printf("%-25s (helpers:", task->task_name);
|
318
|
+
for (i = 0; i < n_helpers; i++) {
|
319
|
+
printf(" %s", helpers[i]->process_name);
|
320
|
+
}
|
321
|
+
printf(")\n");
|
322
|
+
} else {
|
323
|
+
printf("%s\n", task->task_name);
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|