@@ -189,15 +189,15 @@ def test_sockets_echo(self, extra_args=[]):
189
189
190
190
for harness , datagram in harnesses :
191
191
with harness :
192
- self .btest (test_file ('sockets/test_sockets_echo_client.c' ), expected = '0' , args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram , sockets_include ])
192
+ self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram , sockets_include ])
193
193
194
194
def test_sockets_echo_pthreads (self , extra_args = []):
195
195
self .test_sockets_echo (['-sUSE_PTHREADS' , '-sPROXY_TO_PTHREAD' ])
196
196
197
197
def test_sdl2_sockets_echo (self ):
198
198
harness = CompiledServerHarness ('sdl2_net_server.c' , ['-sUSE_SDL=2' , '-sUSE_SDL_NET=2' ], 49164 )
199
199
with harness :
200
- self .btest ('sdl2_net_client.c' , expected = '0 ' , args = ['-sUSE_SDL=2' , '-sUSE_SDL_NET=2' , '-DSOCKK=%d' % harness .listen_port ])
200
+ self .btest_exit ('sdl2_net_client.c' , args = ['-sUSE_SDL=2' , '-sUSE_SDL_NET=2' , '-DSOCKK=%d' % harness .listen_port ])
201
201
202
202
def test_sockets_async_echo (self ):
203
203
sockets_include = '-I' + test_file ('sockets' )
@@ -216,11 +216,12 @@ def test_sockets_async_echo(self):
216
216
for harness , datagram in harnesses :
217
217
print ('harness:' , harness )
218
218
with harness :
219
- self .btest (test_file ('sockets/test_sockets_echo_client.c' ), expected = '0' , args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram , '-DTEST_ASYNC=1' , sockets_include ])
219
+ self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram , '-DTEST_ASYNC=1' , sockets_include ])
220
+ return
220
221
221
222
# Deliberately attempt a connection on a port that will fail to test the error callback and getsockopt
222
223
print ('expect fail' )
223
- self .btest (test_file ('sockets/test_sockets_echo_client.c' ), expected = '0' , args = ['-DSOCKK=49169' , '-DTEST_ASYNC=1' , sockets_include ])
224
+ self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=49169' , '-DTEST_ASYNC=1' , sockets_include ])
224
225
225
226
def test_sockets_echo_bigdata (self ):
226
227
sockets_include = '-I' + test_file ('sockets' )
@@ -231,9 +232,8 @@ def test_sockets_echo_bigdata(self):
231
232
message += str (chr (ord ('a' ) + (i % 26 )))
232
233
233
234
# re-write the client test with this literal (it's too big to pass via command line)
234
- input_filename = test_file ('sockets/test_sockets_echo_client.c' )
235
- input = read_file (input_filename )
236
- create_file ('test_sockets_echo_bigdata.c' , input .replace ('#define MESSAGE "pingtothepong"' , '#define MESSAGE "%s"' % message ))
235
+ src = read_file (test_file ('sockets/test_sockets_echo_client.c' ))
236
+ create_file ('test_sockets_echo_bigdata.c' , src .replace ('#define MESSAGE "pingtothepong"' , '#define MESSAGE "%s"' % message ))
237
237
238
238
harnesses = [
239
239
(CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' ], 49172 ), 0 ),
@@ -245,7 +245,7 @@ def test_sockets_echo_bigdata(self):
245
245
246
246
for harness , datagram in harnesses :
247
247
with harness :
248
- self .btest ('test_sockets_echo_bigdata.c' , expected = '0 ' , args = [sockets_include , '-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram ])
248
+ self .btest_exit ('test_sockets_echo_bigdata.c' , args = [sockets_include , '-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram ])
249
249
250
250
@no_windows ('This test is Unix-specific.' )
251
251
def test_sockets_partial (self ):
@@ -263,7 +263,7 @@ def test_sockets_select_server_down(self):
263
263
CompiledServerHarness (test_file ('sockets/test_sockets_select_server_down_server.c' ), [], 49191 )
264
264
]:
265
265
with harness :
266
- self .btest (test_file ('sockets/test_sockets_select_server_down_client.c' ), expected = '266' , args = ['-DSOCKK=%d' % harness .listen_port ])
266
+ self .btest_exit (test_file ('sockets/test_sockets_select_server_down_client.c' ), args = ['-DSOCKK=%d' % harness .listen_port ])
267
267
268
268
@no_windows ('This test is Unix-specific.' )
269
269
def test_sockets_select_server_closes_connection_rw (self ):
@@ -274,7 +274,7 @@ def test_sockets_select_server_closes_connection_rw(self):
274
274
CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DCLOSE_CLIENT_AFTER_ECHO' ], 49201 )
275
275
]:
276
276
with harness :
277
- self .btest (test_file ('sockets/test_sockets_select_server_closes_connection_client_rw.c' ), expected = '266' , args = [sockets_include , '-DSOCKK=%d' % harness .listen_port ])
277
+ self .btest_exit (test_file ('sockets/test_sockets_select_server_closes_connection_client_rw.c' ), args = [sockets_include , '-DSOCKK=%d' % harness .listen_port ])
278
278
279
279
@no_windows ('This test uses Unix-specific build architecture.' )
280
280
def test_enet (self ):
@@ -290,7 +290,7 @@ def test_enet(self):
290
290
CompiledServerHarness (test_file ('sockets/test_enet_server.c' ), enet , 49210 )
291
291
]:
292
292
with harness :
293
- self .btest (test_file ('sockets/test_enet_client.c' ), expected = '0' , args = enet + ['-DSOCKK=%d' % harness .listen_port ])
293
+ self .btest_exit (test_file ('sockets/test_enet_client.c' ), args = enet + ['-DSOCKK=%d' % harness .listen_port ])
294
294
295
295
def test_nodejs_sockets_echo (self ):
296
296
# This test checks that sockets work when the client code is run in Node.js
@@ -354,7 +354,7 @@ def test_nodejs_sockets_echo(self):
354
354
# N.B. running this test requires 'npm install ws' in Emscripten root directory
355
355
def test_websocket_send (self ):
356
356
with NodeJsWebSocketEchoServerProcess ():
357
- self .btest (test_file ('websocket/test_websocket_send.c' ), expected = '101' , args = ['-lwebsocket' , '-sNO_EXIT_RUNTIME' , '-sWEBSOCKET_DEBUG' ])
357
+ self .btest_exit (test_file ('websocket/test_websocket_send.c' ), args = ['-lwebsocket' , '-sNO_EXIT_RUNTIME' , '-sWEBSOCKET_DEBUG' ])
358
358
359
359
# Test that native POSIX sockets API can be used by proxying calls to an intermediate WebSockets -> POSIX sockets bridge server
360
360
def test_posix_proxy_sockets (self ):
@@ -369,4 +369,4 @@ def test_posix_proxy_sockets(self):
369
369
with BackgroundServerProcess ([proxy_server , '8080' ]):
370
370
with PythonTcpEchoServerProcess ('7777' ):
371
371
# Build and run the TCP echo client program with Emscripten
372
- self .btest (test_file ('websocket/tcp_echo_client.cpp' ), expected = '101' , args = ['-lwebsocket' , '-sPROXY_POSIX_SOCKETS' , '-sUSE_PTHREADS' , '-sPROXY_TO_PTHREAD' ])
372
+ self .btest_exit (test_file ('websocket/tcp_echo_client.cpp' ), args = ['-lwebsocket' , '-sPROXY_POSIX_SOCKETS' , '-sUSE_PTHREADS' , '-sPROXY_TO_PTHREAD' ])
0 commit comments