foolio 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +21 -0
- data/examples/timer.rb +20 -0
- data/ext/foolio/extconf.rb +34 -0
- data/ext/foolio/foolio_ext.c +921 -0
- data/ext/foolio/gen.rb +50 -0
- data/ext/foolio/make_table.rb +12 -0
- data/ext/foolio/templ +243 -0
- data/ext/libuv/.gitignore +33 -0
- data/ext/libuv/.mailmap +13 -0
- data/ext/libuv/.travis.yml +9 -0
- data/ext/libuv/AUTHORS +61 -0
- data/ext/libuv/LICENSE +44 -0
- data/ext/libuv/Makefile +71 -0
- data/ext/libuv/README.md +90 -0
- data/ext/libuv/common.gypi +178 -0
- data/ext/libuv/gyp_uv +73 -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 +324 -0
- data/ext/libuv/include/uv-private/uv-win.h +517 -0
- data/ext/libuv/include/uv.h +1838 -0
- data/ext/libuv/src/fs-poll.c +235 -0
- data/ext/libuv/src/inet.c +293 -0
- data/ext/libuv/src/unix/async.c +148 -0
- data/ext/libuv/src/unix/core.c +696 -0
- data/ext/libuv/src/unix/cygwin.c +83 -0
- data/ext/libuv/src/unix/darwin.c +342 -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 +105 -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 +326 -0
- data/ext/libuv/src/unix/fs.c +739 -0
- data/ext/libuv/src/unix/internal.h +188 -0
- data/ext/libuv/src/unix/kqueue.c +120 -0
- data/ext/libuv/src/unix/linux/inotify.c +239 -0
- data/ext/libuv/src/unix/linux/linux-core.c +557 -0
- data/ext/libuv/src/unix/linux/syscalls.c +388 -0
- data/ext/libuv/src/unix/linux/syscalls.h +124 -0
- data/ext/libuv/src/unix/loop-watcher.c +62 -0
- data/ext/libuv/src/unix/loop.c +94 -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 +259 -0
- data/ext/libuv/src/unix/poll.c +114 -0
- data/ext/libuv/src/unix/process.c +495 -0
- data/ext/libuv/src/unix/signal.c +269 -0
- data/ext/libuv/src/unix/stream.c +990 -0
- data/ext/libuv/src/unix/sunos.c +481 -0
- data/ext/libuv/src/unix/tcp.c +393 -0
- data/ext/libuv/src/unix/thread.c +251 -0
- data/ext/libuv/src/unix/timer.c +136 -0
- data/ext/libuv/src/unix/tty.c +145 -0
- data/ext/libuv/src/unix/udp.c +659 -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 +380 -0
- data/ext/libuv/src/uv-common.h +170 -0
- data/ext/libuv/src/win/async.c +100 -0
- data/ext/libuv/src/win/atomicops-inl.h +56 -0
- data/ext/libuv/src/win/core.c +278 -0
- data/ext/libuv/src/win/dl.c +86 -0
- data/ext/libuv/src/win/error.c +155 -0
- data/ext/libuv/src/win/fs-event.c +510 -0
- data/ext/libuv/src/win/fs.c +1948 -0
- data/ext/libuv/src/win/getaddrinfo.c +365 -0
- data/ext/libuv/src/win/handle-inl.h +149 -0
- data/ext/libuv/src/win/handle.c +154 -0
- data/ext/libuv/src/win/internal.h +343 -0
- data/ext/libuv/src/win/loop-watcher.c +122 -0
- data/ext/libuv/src/win/pipe.c +1672 -0
- data/ext/libuv/src/win/poll.c +616 -0
- data/ext/libuv/src/win/process-stdio.c +500 -0
- data/ext/libuv/src/win/process.c +1013 -0
- data/ext/libuv/src/win/req-inl.h +220 -0
- data/ext/libuv/src/win/req.c +25 -0
- data/ext/libuv/src/win/signal.c +57 -0
- data/ext/libuv/src/win/stream-inl.h +67 -0
- data/ext/libuv/src/win/stream.c +167 -0
- data/ext/libuv/src/win/tcp.c +1394 -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 +224 -0
- data/ext/libuv/src/win/tty.c +1799 -0
- data/ext/libuv/src/win/udp.c +716 -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 +4452 -0
- data/ext/libuv/src/win/winsock.c +557 -0
- data/ext/libuv/src/win/winsock.h +171 -0
- data/ext/libuv/test/benchmark-async-pummel.c +97 -0
- data/ext/libuv/test/benchmark-async.c +137 -0
- data/ext/libuv/test/benchmark-fs-stat.c +135 -0
- data/ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/libuv/test/benchmark-list.h +127 -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 +44 -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 +295 -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 +355 -0
- data/ext/libuv/test/runner.h +159 -0
- data/ext/libuv/test/task.h +112 -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-cwd-and-chdir.c +64 -0
- data/ext/libuv/test/test-delayed-accept.c +188 -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 +474 -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-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 +427 -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 +72 -0
- data/ext/libuv/test/test-poll.c +573 -0
- data/ext/libuv/test/test-process-title.c +49 -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-signal.c +162 -0
- data/ext/libuv/test/test-spawn.c +863 -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-unexpected-read.c +113 -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 +375 -0
- data/ext/libuv/vcbuild.bat +105 -0
- data/foolio.gemspec +18 -0
- data/lib/foolio.rb +9 -0
- data/lib/foolio/handle.rb +27 -0
- data/lib/foolio/listener.rb +26 -0
- data/lib/foolio/loop.rb +79 -0
- data/lib/foolio/stream.rb +109 -0
- data/lib/foolio/version.rb +3 -0
- metadata +309 -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*)args,
|
107
|
+
sizeof(args) / sizeof(WCHAR),
|
108
|
+
L"\"%s\" %S %S",
|
109
|
+
image,
|
110
|
+
name,
|
111
|
+
part) < 0) {
|
112
|
+
goto error;
|
113
|
+
}
|
114
|
+
} else {
|
115
|
+
if (_snwprintf((WCHAR*)args,
|
116
|
+
sizeof(args) / sizeof(WCHAR),
|
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,355 @@
|
|
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
|
+
const char* fmt(double d) {
|
41
|
+
uint64_t v;
|
42
|
+
char* p;
|
43
|
+
|
44
|
+
p = (char *) calloc(1, 32) + 31; /* leaks memory */
|
45
|
+
v = (uint64_t) d;
|
46
|
+
|
47
|
+
#if 0 /* works but we don't care about fractional precision */
|
48
|
+
if (d - v >= 0.01) {
|
49
|
+
*--p = '0' + (uint64_t) (d * 100) % 10;
|
50
|
+
*--p = '0' + (uint64_t) (d * 10) % 10;
|
51
|
+
*--p = '.';
|
52
|
+
}
|
53
|
+
#endif
|
54
|
+
|
55
|
+
if (v == 0)
|
56
|
+
*--p = '0';
|
57
|
+
|
58
|
+
while (v) {
|
59
|
+
if (v) *--p = '0' + (v % 10), v /= 10;
|
60
|
+
if (v) *--p = '0' + (v % 10), v /= 10;
|
61
|
+
if (v) *--p = '0' + (v % 10), v /= 10;
|
62
|
+
if (v) *--p = ',';
|
63
|
+
}
|
64
|
+
|
65
|
+
return p;
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
int run_tests(int timeout, int benchmark_output) {
|
70
|
+
int total, passed, failed;
|
71
|
+
task_entry_t* task;
|
72
|
+
|
73
|
+
/* Count the number of tests. */
|
74
|
+
total = 0;
|
75
|
+
for (task = TASKS; task->main; task++) {
|
76
|
+
if (!task->is_helper) {
|
77
|
+
total++;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
/* Run all tests. */
|
82
|
+
passed = 0;
|
83
|
+
failed = 0;
|
84
|
+
for (task = TASKS; task->main; task++) {
|
85
|
+
if (task->is_helper) {
|
86
|
+
continue;
|
87
|
+
}
|
88
|
+
|
89
|
+
rewind_cursor();
|
90
|
+
if (!benchmark_output) {
|
91
|
+
log_progress(total, passed, failed, task->task_name);
|
92
|
+
}
|
93
|
+
|
94
|
+
if (run_test(task->task_name, timeout, benchmark_output) == 0) {
|
95
|
+
passed++;
|
96
|
+
} else {
|
97
|
+
failed++;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
rewind_cursor();
|
102
|
+
|
103
|
+
if (!benchmark_output) {
|
104
|
+
log_progress(total, passed, failed, "Done.\n");
|
105
|
+
}
|
106
|
+
|
107
|
+
return failed;
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
int run_test(const char* test, int timeout, int benchmark_output) {
|
112
|
+
char errmsg[1024] = "no error";
|
113
|
+
process_info_t processes[1024];
|
114
|
+
process_info_t *main_proc;
|
115
|
+
task_entry_t* task;
|
116
|
+
int process_count;
|
117
|
+
int result;
|
118
|
+
int status;
|
119
|
+
int i;
|
120
|
+
|
121
|
+
status = 255;
|
122
|
+
main_proc = NULL;
|
123
|
+
process_count = 0;
|
124
|
+
|
125
|
+
#ifndef _WIN32
|
126
|
+
/* Clean up stale socket from previous run. */
|
127
|
+
remove(TEST_PIPENAME);
|
128
|
+
#endif
|
129
|
+
|
130
|
+
/* If it's a helper the user asks for, start it directly. */
|
131
|
+
for (task = TASKS; task->main; task++) {
|
132
|
+
if (task->is_helper && strcmp(test, task->process_name) == 0) {
|
133
|
+
return task->main();
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
/* Start the helpers first. */
|
138
|
+
for (task = TASKS; task->main; task++) {
|
139
|
+
if (strcmp(test, task->task_name) != 0) {
|
140
|
+
continue;
|
141
|
+
}
|
142
|
+
|
143
|
+
/* Skip the test itself. */
|
144
|
+
if (!task->is_helper) {
|
145
|
+
continue;
|
146
|
+
}
|
147
|
+
|
148
|
+
if (process_start(task->task_name,
|
149
|
+
task->process_name,
|
150
|
+
&processes[process_count]) == -1) {
|
151
|
+
snprintf(errmsg,
|
152
|
+
sizeof errmsg,
|
153
|
+
"Process `%s` failed to start.",
|
154
|
+
task->process_name);
|
155
|
+
goto out;
|
156
|
+
}
|
157
|
+
|
158
|
+
process_count++;
|
159
|
+
}
|
160
|
+
|
161
|
+
/* Give the helpers time to settle. Race-y, fix this. */
|
162
|
+
uv_sleep(250);
|
163
|
+
|
164
|
+
/* Now start the test itself. */
|
165
|
+
for (task = TASKS; task->main; task++) {
|
166
|
+
if (strcmp(test, task->task_name) != 0) {
|
167
|
+
continue;
|
168
|
+
}
|
169
|
+
|
170
|
+
if (task->is_helper) {
|
171
|
+
continue;
|
172
|
+
}
|
173
|
+
|
174
|
+
if (process_start(task->task_name,
|
175
|
+
task->process_name,
|
176
|
+
&processes[process_count]) == -1) {
|
177
|
+
snprintf(errmsg,
|
178
|
+
sizeof errmsg,
|
179
|
+
"Process `%s` failed to start.",
|
180
|
+
task->process_name);
|
181
|
+
goto out;
|
182
|
+
}
|
183
|
+
|
184
|
+
main_proc = &processes[process_count];
|
185
|
+
process_count++;
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
|
189
|
+
if (main_proc == NULL) {
|
190
|
+
snprintf(errmsg,
|
191
|
+
sizeof errmsg,
|
192
|
+
"No test with that name: %s",
|
193
|
+
test);
|
194
|
+
goto out;
|
195
|
+
}
|
196
|
+
|
197
|
+
result = process_wait(main_proc, 1, timeout);
|
198
|
+
if (result == -1) {
|
199
|
+
FATAL("process_wait failed");
|
200
|
+
} else if (result == -2) {
|
201
|
+
/* Don't have to clean up the process, process_wait() has killed it. */
|
202
|
+
snprintf(errmsg,
|
203
|
+
sizeof errmsg,
|
204
|
+
"timeout");
|
205
|
+
goto out;
|
206
|
+
}
|
207
|
+
|
208
|
+
status = process_reap(main_proc);
|
209
|
+
if (status != 0) {
|
210
|
+
snprintf(errmsg,
|
211
|
+
sizeof errmsg,
|
212
|
+
"exit code %d",
|
213
|
+
status);
|
214
|
+
goto out;
|
215
|
+
}
|
216
|
+
|
217
|
+
if (benchmark_output) {
|
218
|
+
/* Give the helpers time to clean up their act. */
|
219
|
+
uv_sleep(1000);
|
220
|
+
}
|
221
|
+
|
222
|
+
out:
|
223
|
+
/* Reap running processes except the main process, it's already dead. */
|
224
|
+
for (i = 0; i < process_count - 1; i++) {
|
225
|
+
process_terminate(&processes[i]);
|
226
|
+
}
|
227
|
+
|
228
|
+
if (process_count > 0 &&
|
229
|
+
process_wait(processes, process_count - 1, -1) < 0) {
|
230
|
+
FATAL("process_wait failed");
|
231
|
+
}
|
232
|
+
|
233
|
+
/* Show error and output from processes if the test failed. */
|
234
|
+
if (status != 0 || task->show_output) {
|
235
|
+
if (status != 0) {
|
236
|
+
LOGF("\n`%s` failed: %s\n", test, errmsg);
|
237
|
+
} else {
|
238
|
+
LOGF("\n");
|
239
|
+
}
|
240
|
+
|
241
|
+
for (i = 0; i < process_count; i++) {
|
242
|
+
switch (process_output_size(&processes[i])) {
|
243
|
+
case -1:
|
244
|
+
LOGF("Output from process `%s`: (unavailable)\n",
|
245
|
+
process_get_name(&processes[i]));
|
246
|
+
break;
|
247
|
+
|
248
|
+
case 0:
|
249
|
+
LOGF("Output from process `%s`: (no output)\n",
|
250
|
+
process_get_name(&processes[i]));
|
251
|
+
break;
|
252
|
+
|
253
|
+
default:
|
254
|
+
LOGF("Output from process `%s`:\n", process_get_name(&processes[i]));
|
255
|
+
process_copy_output(&processes[i], fileno(stderr));
|
256
|
+
break;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
LOG("=============================================================\n");
|
260
|
+
|
261
|
+
/* In benchmark mode show concise output from the main process. */
|
262
|
+
} else if (benchmark_output) {
|
263
|
+
switch (process_output_size(main_proc)) {
|
264
|
+
case -1:
|
265
|
+
LOGF("%s: (unavailable)\n", test);
|
266
|
+
break;
|
267
|
+
|
268
|
+
case 0:
|
269
|
+
LOGF("%s: (no output)\n", test);
|
270
|
+
break;
|
271
|
+
|
272
|
+
default:
|
273
|
+
for (i = 0; i < process_count; i++) {
|
274
|
+
process_copy_output(&processes[i], fileno(stderr));
|
275
|
+
}
|
276
|
+
break;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
/* Clean up all process handles. */
|
281
|
+
for (i = 0; i < process_count; i++) {
|
282
|
+
process_cleanup(&processes[i]);
|
283
|
+
}
|
284
|
+
|
285
|
+
return status;
|
286
|
+
}
|
287
|
+
|
288
|
+
|
289
|
+
/* Returns the status code of the task part
|
290
|
+
* or 255 if no matching task was not found.
|
291
|
+
*/
|
292
|
+
int run_test_part(const char* test, const char* part) {
|
293
|
+
task_entry_t* task;
|
294
|
+
|
295
|
+
for (task = TASKS; task->main; task++) {
|
296
|
+
if (strcmp(test, task->task_name) == 0
|
297
|
+
&& strcmp(part, task->process_name) == 0) {
|
298
|
+
return task->main();
|
299
|
+
}
|
300
|
+
}
|
301
|
+
|
302
|
+
LOGF("No test part with that name: %s:%s\n", test, part);
|
303
|
+
return 255;
|
304
|
+
}
|
305
|
+
|
306
|
+
|
307
|
+
static int compare_task(const void* va, const void* vb) {
|
308
|
+
const task_entry_t* a = va;
|
309
|
+
const task_entry_t* b = vb;
|
310
|
+
return strcmp(a->task_name, b->task_name);
|
311
|
+
}
|
312
|
+
|
313
|
+
|
314
|
+
static int find_helpers(const task_entry_t* task, const task_entry_t** helpers) {
|
315
|
+
const task_entry_t* helper;
|
316
|
+
int n_helpers;
|
317
|
+
|
318
|
+
for (n_helpers = 0, helper = TASKS; helper->main; helper++) {
|
319
|
+
if (helper->is_helper && strcmp(helper->task_name, task->task_name) == 0) {
|
320
|
+
*helpers++ = helper;
|
321
|
+
n_helpers++;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
325
|
+
return n_helpers;
|
326
|
+
}
|
327
|
+
|
328
|
+
|
329
|
+
void print_tests(FILE* stream) {
|
330
|
+
const task_entry_t* helpers[1024];
|
331
|
+
const task_entry_t* task;
|
332
|
+
int n_helpers;
|
333
|
+
int n_tasks;
|
334
|
+
int i;
|
335
|
+
|
336
|
+
for (n_tasks = 0, task = TASKS; task->main; n_tasks++, task++);
|
337
|
+
qsort(TASKS, n_tasks, sizeof(TASKS[0]), compare_task);
|
338
|
+
|
339
|
+
for (task = TASKS; task->main; task++) {
|
340
|
+
if (task->is_helper) {
|
341
|
+
continue;
|
342
|
+
}
|
343
|
+
|
344
|
+
n_helpers = find_helpers(task, helpers);
|
345
|
+
if (n_helpers) {
|
346
|
+
printf("%-25s (helpers:", task->task_name);
|
347
|
+
for (i = 0; i < n_helpers; i++) {
|
348
|
+
printf(" %s", helpers[i]->process_name);
|
349
|
+
}
|
350
|
+
printf(")\n");
|
351
|
+
} else {
|
352
|
+
printf("%s\n", task->task_name);
|
353
|
+
}
|
354
|
+
}
|
355
|
+
}
|