Skip to content

Commit fdf7c2a

Browse files
committed
build: split off tests into separate gyp file
Make it easier for Node.js to ship libuv in its tarballs without also including the test suite. Node.js already does so but recent changes to its build system complicate that. Kills two birds with one stone: it helps out Node.js and it makes it harder for us to introduce hidden dependencies between the library and the test suite. PR-URL: libuv#1725 Refs: nodejs/node#18287 Reviewed-By: Colin Ihrig <[email protected]>
1 parent 760556d commit fdf7c2a

File tree

4 files changed

+331
-314
lines changed

4 files changed

+331
-314
lines changed

gyp_uv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run_gyp(args):
4343

4444
if __name__ == '__main__':
4545
args = sys.argv[1:]
46-
args.extend('-I common.gypi uv.gyp'.split(' '))
46+
args.extend('-I common.gypi test/test.gyp'.split(' '))
4747
args.append('--depth=' + uv_root)
4848

4949
# There's a bug with windows which doesn't allow this feature.

test/test.gyp

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'run-tests',
5+
'type': 'executable',
6+
'dependencies': [ '../uv.gyp:libuv' ],
7+
'sources': [
8+
'blackhole-server.c',
9+
'echo-server.c',
10+
'run-tests.c',
11+
'runner.c',
12+
'runner.h',
13+
'test-get-loadavg.c',
14+
'task.h',
15+
'test-active.c',
16+
'test-async.c',
17+
'test-async-null-cb.c',
18+
'test-callback-stack.c',
19+
'test-callback-order.c',
20+
'test-close-fd.c',
21+
'test-close-order.c',
22+
'test-connect-unspecified.c',
23+
'test-connection-fail.c',
24+
'test-cwd-and-chdir.c',
25+
'test-default-loop-close.c',
26+
'test-delayed-accept.c',
27+
'test-eintr-handling.c',
28+
'test-error.c',
29+
'test-embed.c',
30+
'test-emfile.c',
31+
'test-env-vars.c',
32+
'test-fail-always.c',
33+
'test-fork.c',
34+
'test-fs.c',
35+
'test-fs-copyfile.c',
36+
'test-fs-event.c',
37+
'test-getters-setters.c',
38+
'test-get-currentexe.c',
39+
'test-get-memory.c',
40+
'test-get-passwd.c',
41+
'test-getaddrinfo.c',
42+
'test-gethostname.c',
43+
'test-getnameinfo.c',
44+
'test-getsockname.c',
45+
'test-handle-fileno.c',
46+
'test-homedir.c',
47+
'test-hrtime.c',
48+
'test-idle.c',
49+
'test-ip6-addr.c',
50+
'test-ipc.c',
51+
'test-ipc-send-recv.c',
52+
'test-list.h',
53+
'test-loop-handles.c',
54+
'test-loop-alive.c',
55+
'test-loop-close.c',
56+
'test-loop-stop.c',
57+
'test-loop-time.c',
58+
'test-loop-configure.c',
59+
'test-walk-handles.c',
60+
'test-watcher-cross-stop.c',
61+
'test-multiple-listen.c',
62+
'test-osx-select.c',
63+
'test-pass-always.c',
64+
'test-ping-pong.c',
65+
'test-pipe-bind-error.c',
66+
'test-pipe-connect-error.c',
67+
'test-pipe-connect-multiple.c',
68+
'test-pipe-connect-prepare.c',
69+
'test-pipe-getsockname.c',
70+
'test-pipe-pending-instances.c',
71+
'test-pipe-sendmsg.c',
72+
'test-pipe-server-close.c',
73+
'test-pipe-close-stdout-read-stdin.c',
74+
'test-pipe-set-non-blocking.c',
75+
'test-pipe-set-fchmod.c',
76+
'test-platform-output.c',
77+
'test-poll.c',
78+
'test-poll-close.c',
79+
'test-poll-close-doesnt-corrupt-stack.c',
80+
'test-poll-closesocket.c',
81+
'test-poll-oob.c',
82+
'test-process-title.c',
83+
'test-process-title-threadsafe.c',
84+
'test-queue-foreach-delete.c',
85+
'test-ref.c',
86+
'test-run-nowait.c',
87+
'test-run-once.c',
88+
'test-semaphore.c',
89+
'test-shutdown-close.c',
90+
'test-shutdown-eof.c',
91+
'test-shutdown-twice.c',
92+
'test-signal.c',
93+
'test-signal-multiple-loops.c',
94+
'test-socket-buffer-size.c',
95+
'test-spawn.c',
96+
'test-fs-poll.c',
97+
'test-stdio-over-pipes.c',
98+
'test-tcp-alloc-cb-fail.c',
99+
'test-tcp-bind-error.c',
100+
'test-tcp-bind6-error.c',
101+
'test-tcp-close.c',
102+
'test-tcp-close-accept.c',
103+
'test-tcp-close-while-connecting.c',
104+
'test-tcp-create-socket-early.c',
105+
'test-tcp-connect-error-after-write.c',
106+
'test-tcp-shutdown-after-write.c',
107+
'test-tcp-flags.c',
108+
'test-tcp-connect-error.c',
109+
'test-tcp-connect-timeout.c',
110+
'test-tcp-connect6-error.c',
111+
'test-tcp-open.c',
112+
'test-tcp-write-to-half-open-connection.c',
113+
'test-tcp-write-after-connect.c',
114+
'test-tcp-writealot.c',
115+
'test-tcp-write-fail.c',
116+
'test-tcp-try-write.c',
117+
'test-tcp-unexpected-read.c',
118+
'test-tcp-oob.c',
119+
'test-tcp-read-stop.c',
120+
'test-tcp-write-queue-order.c',
121+
'test-threadpool.c',
122+
'test-threadpool-cancel.c',
123+
'test-thread-equal.c',
124+
'test-tmpdir.c',
125+
'test-mutexes.c',
126+
'test-thread.c',
127+
'test-barrier.c',
128+
'test-condvar.c',
129+
'test-timer-again.c',
130+
'test-timer-from-check.c',
131+
'test-timer.c',
132+
'test-tty.c',
133+
'test-udp-alloc-cb-fail.c',
134+
'test-udp-bind.c',
135+
'test-udp-create-socket-early.c',
136+
'test-udp-dgram-too-big.c',
137+
'test-udp-ipv6.c',
138+
'test-udp-open.c',
139+
'test-udp-options.c',
140+
'test-udp-send-and-recv.c',
141+
'test-udp-send-hang-loop.c',
142+
'test-udp-send-immediate.c',
143+
'test-udp-send-unreachable.c',
144+
'test-udp-multicast-join.c',
145+
'test-udp-multicast-join6.c',
146+
'test-dlerror.c',
147+
'test-udp-multicast-ttl.c',
148+
'test-ip4-addr.c',
149+
'test-ip6-addr.c',
150+
'test-udp-multicast-interface.c',
151+
'test-udp-multicast-interface6.c',
152+
'test-udp-try-send.c',
153+
],
154+
'conditions': [
155+
[ 'OS=="win"', {
156+
'sources': [
157+
'runner-win.c',
158+
'runner-win.h',
159+
'../src/win/snprintf.c',
160+
],
161+
'libraries': [ '-lws2_32' ]
162+
}, { # POSIX
163+
'sources': [
164+
'runner-unix.c',
165+
'runner-unix.h',
166+
],
167+
'conditions': [
168+
[ 'OS != "zos"', {
169+
'defines': [ '_GNU_SOURCE' ],
170+
'cflags': [ '-Wno-long-long' ],
171+
'xcode_settings': {
172+
'WARNING_CFLAGS': [ '-Wno-long-long' ]
173+
}
174+
}],
175+
]},
176+
],
177+
[ 'OS in "mac dragonflybsd freebsd linux netbsd openbsd".split()', {
178+
'link_settings': {
179+
'libraries': [ '-lutil' ],
180+
},
181+
}],
182+
[ 'OS=="solaris"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
183+
'defines': [
184+
'__EXTENSIONS__',
185+
'_XOPEN_SOURCE=500',
186+
],
187+
}],
188+
[ 'OS=="aix"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
189+
'defines': [
190+
'_ALL_SOURCE',
191+
'_XOPEN_SOURCE=500',
192+
],
193+
}],
194+
[ 'OS == "zos"', {
195+
'cflags': [ '-qxplink' ],
196+
'ldflags': [ '-qxplink' ],
197+
}],
198+
['uv_library=="shared_library"', {
199+
'defines': [ 'USING_UV_SHARED=1' ],
200+
'conditions': [
201+
[ 'OS == "zos"', {
202+
'cflags': [ '-Wc,DLL' ],
203+
}],
204+
],
205+
}],
206+
],
207+
'msvs-settings': {
208+
'VCLinkerTool': {
209+
'SubSystem': 1, # /subsystem:console
210+
},
211+
},
212+
},
213+
214+
{
215+
'target_name': 'run-benchmarks',
216+
'type': 'executable',
217+
'dependencies': [ '../uv.gyp:libuv' ],
218+
'sources': [
219+
'benchmark-async.c',
220+
'benchmark-async-pummel.c',
221+
'benchmark-fs-stat.c',
222+
'benchmark-getaddrinfo.c',
223+
'benchmark-list.h',
224+
'benchmark-loop-count.c',
225+
'benchmark-million-async.c',
226+
'benchmark-million-timers.c',
227+
'benchmark-multi-accept.c',
228+
'benchmark-ping-pongs.c',
229+
'benchmark-pound.c',
230+
'benchmark-pump.c',
231+
'benchmark-sizes.c',
232+
'benchmark-spawn.c',
233+
'benchmark-thread.c',
234+
'benchmark-tcp-write-batch.c',
235+
'benchmark-udp-pummel.c',
236+
'dns-server.c',
237+
'echo-server.c',
238+
'blackhole-server.c',
239+
'run-benchmarks.c',
240+
'runner.c',
241+
'runner.h',
242+
'task.h',
243+
],
244+
'conditions': [
245+
[ 'OS=="win"', {
246+
'sources': [
247+
'runner-win.c',
248+
'runner-win.h',
249+
'../src/win/snprintf.c',
250+
],
251+
'libraries': [ '-lws2_32' ]
252+
}, { # POSIX
253+
'defines': [ '_GNU_SOURCE' ],
254+
'sources': [
255+
'runner-unix.c',
256+
'runner-unix.h',
257+
]
258+
}],
259+
[ 'OS == "zos"', {
260+
'cflags': [ '-qxplink' ],
261+
'ldflags': [ '-qxplink' ],
262+
}],
263+
['uv_library=="shared_library"', {
264+
'defines': [ 'USING_UV_SHARED=1' ],
265+
'conditions': [
266+
[ 'OS == "zos"', {
267+
'cflags': [ '-Wc,DLL' ],
268+
}],
269+
],
270+
}],
271+
],
272+
'msvs-settings': {
273+
'VCLinkerTool': {
274+
'SubSystem': 1, # /subsystem:console
275+
},
276+
},
277+
},
278+
],
279+
}

0 commit comments

Comments
 (0)