@@ -2310,7 +2310,8 @@ class BrowserCore(RunnerCore):
2310
2310
# single test (hundreds of minutes)
2311
2311
MAX_UNRESPONSIVE_TESTS = 10
2312
2312
PORT = 8888
2313
- HARNESS_URL = 'http://localhost:%s/run_harness' % PORT
2313
+ SERVER_URL = f'http://localhost:{ PORT } '
2314
+ HARNESS_URL = f'{ SERVER_URL } /run_harness'
2314
2315
BROWSER_TIMEOUT = 60
2315
2316
2316
2317
unresponsive_tests = 0
@@ -2378,6 +2379,11 @@ def tearDownClass(cls):
2378
2379
def is_browser_test (self ):
2379
2380
return True
2380
2381
2382
+ def add_browser_reporting (self ):
2383
+ contents = read_file (test_file ('browser_reporting.js' ))
2384
+ contents = contents .replace ('{{{REPORTING_URL}}}' , BrowserCore .SERVER_URL )
2385
+ create_file ('browser_reporting.js' , contents )
2386
+
2381
2387
def assert_out_queue_empty (self , who ):
2382
2388
if not self .harness_out_queue .empty ():
2383
2389
responses = []
@@ -2461,7 +2467,8 @@ def compile_btest(self, filename, cflags, reporting=Reporting.FULL):
2461
2467
# the header as there may be multiple files being compiled here).
2462
2468
if reporting != Reporting .NONE :
2463
2469
# For basic reporting we inject JS helper funtions to report result back to server.
2464
- cflags += ['--pre-js' , test_file ('browser_reporting.js' )]
2470
+ self .add_browser_reporting ()
2471
+ cflags += ['--pre-js' , 'browser_reporting.js' ]
2465
2472
if reporting == Reporting .FULL :
2466
2473
# If C reporting (i.e. the REPORT_RESULT macro) is required we
2467
2474
# also include report_result.c and force-include report_result.h
@@ -2473,6 +2480,9 @@ def compile_btest(self, filename, cflags, reporting=Reporting.FULL):
2473
2480
if not os .path .exists (filename ):
2474
2481
filename = test_file (filename )
2475
2482
self .run_process ([compiler_for (filename ), filename ] + self .get_cflags () + cflags )
2483
+ # Remove the file since some tests have assertions for how many files are in
2484
+ # the output directory.
2485
+ utils .delete_file ('browser_reporting.js' )
2476
2486
2477
2487
def btest_exit (self , filename , assert_returncode = 0 , * args , ** kwargs ):
2478
2488
"""Special case of `btest` that reports its result solely via exiting
0 commit comments