@@ -167,8 +167,6 @@ def setUpClass(cls):
167167 os .environ ['NODE_PATH' ] = path_from_root ('node_modules' )
168168
169169 def test_sockets_echo (self , extra_args = []):
170- sockets_include = '-I' + test_file ('sockets' )
171-
172170 # Note: in the WebsockifyServerHarness and CompiledServerHarness tests below, explicitly use consecutive server listen ports,
173171 # because server teardown might not occur deterministically (python dtor time) and is a bit racy.
174172 # WebsockifyServerHarness uses two port numbers, x and x-1, so increment it by two.
@@ -177,18 +175,18 @@ def test_sockets_echo(self, extra_args=[]):
177175
178176 # Websockify-proxied servers can't run dgram tests
179177 harnesses = [
180- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' ], 49161 ), 0 ),
181- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=1' ], 49162 ), 1 ),
178+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=0' ], 49161 ), 0 ),
179+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=1' ], 49162 ), 1 ),
182180 # The following forces non-NULL addr and addlen parameters for the accept call
183- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' , '-DTEST_ACCEPT_ADDR=1' ], 49163 ), 0 )
181+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=0' , '-DTEST_ACCEPT_ADDR=1' ], 49163 ), 0 )
184182 ]
185183
186184 if not WINDOWS : # TODO: Python pickling bug causes WebsockifyServerHarness to not work on Windows.
187- harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include ], 49160 ), 0 )]
185+ harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [], 49160 ), 0 )]
188186
189187 for harness , datagram in harnesses :
190188 with harness :
191- self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram , sockets_include ])
189+ self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram ])
192190
193191 def test_sockets_echo_pthreads (self , extra_args = []):
194192 self .test_sockets_echo (['-sUSE_PTHREADS' , '-sPROXY_TO_PTHREAD' ])
@@ -199,28 +197,26 @@ def test_sdl2_sockets_echo(self):
199197 self .btest_exit ('sdl2_net_client.c' , args = ['-sUSE_SDL=2' , '-sUSE_SDL_NET=2' , '-DSOCKK=%d' % harness .listen_port ])
200198
201199 def test_sockets_async_echo (self ):
202- sockets_include = '-I' + test_file ('sockets' )
203-
204200 # Websockify-proxied servers can't run dgram tests
205201 harnesses = [
206- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' , '-DTEST_ASYNC=1' ], 49167 ), 0 ),
207- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=1' , '-DTEST_ASYNC=1' ], 49168 ), 1 ),
202+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=0' , '-DTEST_ASYNC=1' ], 49167 ), 0 ),
203+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=1' , '-DTEST_ASYNC=1' ], 49168 ), 1 ),
208204 # The following forces non-NULL addr and addlen parameters for the accept call
209- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' , '-DTEST_ACCEPT_ADDR=1' , '-DTEST_ASYNC=1' ], 49169 ), 0 )
205+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=0' , '-DTEST_ACCEPT_ADDR=1' , '-DTEST_ASYNC=1' ], 49169 ), 0 )
210206 ]
211207
212208 if not WINDOWS : # TODO: Python pickling bug causes WebsockifyServerHarness to not work on Windows.
213- harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_ASYNC=1' ], 49166 ), 0 )]
209+ harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_ASYNC=1' ], 49166 ), 0 )]
214210
215211 for harness , datagram in harnesses :
216212 print ('harness:' , harness )
217213 with harness :
218- 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 ])
214+ self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=%d' % harness .listen_port , '-DTEST_DGRAM=%d' % datagram , '-DTEST_ASYNC=1' ])
219215 return
220216
221217 # Deliberately attempt a connection on a port that will fail to test the error callback and getsockopt
222218 print ('expect fail' )
223- self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=49169' , '-DTEST_ASYNC=1' , sockets_include ])
219+ self .btest_exit (test_file ('sockets/test_sockets_echo_client.c' ), args = ['-DSOCKK=49169' , '-DTEST_ASYNC=1' ])
224220
225221 def test_sockets_echo_bigdata (self ):
226222 sockets_include = '-I' + test_file ('sockets' )
@@ -235,12 +231,12 @@ def test_sockets_echo_bigdata(self):
235231 create_file ('test_sockets_echo_bigdata.c' , src .replace ('#define MESSAGE "pingtothepong"' , '#define MESSAGE "%s"' % message ))
236232
237233 harnesses = [
238- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' ], 49172 ), 0 ),
239- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=1' ], 49173 ), 1 )
234+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=0' ], 49172 ), 0 ),
235+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=1' ], 49173 ), 1 )
240236 ]
241237
242238 if not WINDOWS : # TODO: Python pickling bug causes WebsockifyServerHarness to not work on Windows.
243- harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include ], 49171 ), 0 )]
239+ harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [], 49171 ), 0 )]
244240
245241 for harness , datagram in harnesses :
246242 with harness :
@@ -266,14 +262,12 @@ def test_sockets_select_server_down(self):
266262
267263 @no_windows ('This test is Unix-specific.' )
268264 def test_sockets_select_server_closes_connection_rw (self ):
269- sockets_include = '-I' + test_file ('sockets' )
270-
271265 for harness in [
272- WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DCLOSE_CLIENT_AFTER_ECHO' ], 49200 ),
273- CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DCLOSE_CLIENT_AFTER_ECHO' ], 49201 )
266+ WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DCLOSE_CLIENT_AFTER_ECHO' ], 49200 ),
267+ CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DCLOSE_CLIENT_AFTER_ECHO' ], 49201 )
274268 ]:
275269 with harness :
276- self .btest_exit (test_file ('sockets/test_sockets_select_server_closes_connection_client_rw.c' ), args = [sockets_include , '-DSOCKK=%d' % harness .listen_port ])
270+ self .btest_exit (test_file ('sockets/test_sockets_select_server_closes_connection_client_rw.c' ), args = ['-DSOCKK=%d' % harness .listen_port ])
277271
278272 @no_windows ('This test uses Unix-specific build architecture.' )
279273 def test_enet (self ):
@@ -296,15 +290,13 @@ def test_nodejs_sockets_echo(self):
296290 if config .NODE_JS not in config .JS_ENGINES :
297291 self .skipTest ('node is not present' )
298292
299- sockets_include = '-I' + test_file ('sockets' )
300-
301293 harnesses = [
302- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=0' ], 59162 ), 0 ),
303- (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include , '-DTEST_DGRAM=1' ], 59164 ), 1 )
294+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=0' ], 59162 ), 0 ),
295+ (CompiledServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), ['-DTEST_DGRAM=1' ], 59164 ), 1 )
304296 ]
305297
306298 if not WINDOWS : # TODO: Python pickling bug causes WebsockifyServerHarness to not work on Windows.
307- harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include ], 59160 ), 0 )]
299+ harnesses += [(WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [], 59160 ), 0 )]
308300
309301 # Basic test of node client against both a Websockified and compiled echo server.
310302 for harness , datagram in harnesses :
@@ -318,7 +310,7 @@ def test_nodejs_sockets_echo(self):
318310 # This test also checks that the connect url contains the correct subprotocols.
319311 print ("\n Testing compile time WebSocket configuration.\n " )
320312 for harness in [
321- WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include ], 59166 )
313+ WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [], 59166 )
322314 ]:
323315 with harness :
324316 self .run_process ([EMCC , '-Werror' , test_file ('sockets/test_sockets_echo_client.c' ), '-o' , 'client.js' , '-sSOCKET_DEBUG' , '-sWEBSOCKET_SUBPROTOCOL="base64, binary"' , '-DSOCKK=59166' ])
@@ -340,7 +332,7 @@ def test_nodejs_sockets_echo(self):
340332 };
341333 ''' )
342334 for harness in [
343- WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [sockets_include ], 59168 )
335+ WebsockifyServerHarness (test_file ('sockets/test_sockets_echo_server.c' ), [], 59168 )
344336 ]:
345337 with harness :
346338 self .run_process ([EMCC , '-Werror' , test_file ('sockets/test_sockets_echo_client.c' ), '-o' , 'client.js' , '--pre-js=websocket_pre.js' , '-sSOCKET_DEBUG' , '-DSOCKK=12345' ])
0 commit comments