@@ -2072,6 +2072,9 @@ class BrowserCore(RunnerCore):
2072
2072
# suite early, as otherwise we will wait for the timeout on every
2073
2073
# single test (hundreds of minutes)
2074
2074
MAX_UNRESPONSIVE_TESTS = 10
2075
+ PORT = 8888
2076
+ HARNESS_URL = 'http://localhost:%s/run_harness' % PORT
2077
+ BROWSER_TIMEOUT = 60
2075
2078
2076
2079
unresponsive_tests = 0
2077
2080
@@ -2091,7 +2094,7 @@ def browser_restart(cls):
2091
2094
logger .info ('Browser did not respond to `terminate`. Using `kill`' )
2092
2095
cls .browser_proc .kill ()
2093
2096
cls .browser_proc .wait ()
2094
- cls .browser_open (cls .harness_url )
2097
+ cls .browser_open (cls .HARNESS_URL )
2095
2098
2096
2099
@classmethod
2097
2100
def browser_open (cls , url ):
@@ -2106,17 +2109,14 @@ def browser_open(cls, url):
2106
2109
@classmethod
2107
2110
def setUpClass (cls ):
2108
2111
super ().setUpClass ()
2109
- cls .port = int (os .getenv ('EMTEST_BROWSER_PORT' , '8888' ))
2110
2112
if not has_browser () or EMTEST_BROWSER == 'node' :
2111
2113
return
2112
- cls .browser_timeout = 60
2113
2114
cls .harness_in_queue = multiprocessing .Queue ()
2114
2115
cls .harness_out_queue = multiprocessing .Queue ()
2115
- cls .harness_server = multiprocessing .Process (target = harness_server_func , args = (cls .harness_in_queue , cls .harness_out_queue , cls .port ))
2116
+ cls .harness_server = multiprocessing .Process (target = harness_server_func , args = (cls .harness_in_queue , cls .harness_out_queue , cls .PORT ))
2116
2117
cls .harness_server .start ()
2117
2118
print ('[Browser harness server on process %d]' % cls .harness_server .pid )
2118
- cls .harness_url = 'http://localhost:%s/run_harness' % cls .port
2119
- cls .browser_open (cls .harness_url )
2119
+ cls .browser_open (cls .HARNESS_URL )
2120
2120
2121
2121
@classmethod
2122
2122
def tearDownClass (cls ):
@@ -2158,11 +2158,11 @@ def run_browser(self, html_file, expected=None, message=None, timeout=None, extr
2158
2158
if expected is not None :
2159
2159
try :
2160
2160
self .harness_in_queue .put ((
2161
- 'http://localhost:%s/%s' % (self .port , html_file ),
2161
+ 'http://localhost:%s/%s' % (self .PORT , html_file ),
2162
2162
self .get_dir ()
2163
2163
))
2164
2164
if timeout is None :
2165
- timeout = self .browser_timeout
2165
+ timeout = self .BROWSER_TIMEOUT
2166
2166
try :
2167
2167
output = self .harness_out_queue .get (block = True , timeout = timeout )
2168
2168
except queue .Empty :
@@ -2213,7 +2213,6 @@ def compile_btest(self, filename, args, reporting=Reporting.FULL):
2213
2213
# If C reporting (i.e. the REPORT_RESULT macro) is required we
2214
2214
# also include report_result.c and force-include report_result.h
2215
2215
self .run_process ([EMCC , '-c' , '-I' + TEST_ROOT ,
2216
- '-DEMTEST_PORT_NUMBER=%d' % self .port ,
2217
2216
test_file ('report_result.c' )] + self .get_emcc_args (compile_only = True ) + (['-fPIC' ] if '-fPIC' in args else []))
2218
2217
args += ['report_result.o' , '-include' , test_file ('report_result.h' )]
2219
2218
if EMTEST_BROWSER == 'node' :
0 commit comments