@@ -2106,24 +2106,27 @@ def reftest(self, expected, manually_trigger=False):
2106
2106
setupRefTest();
2107
2107
''' % (reporting , basename , int (manually_trigger )))
2108
2108
2109
- def compile_btest (self , args , reporting = Reporting .FULL ):
2109
+ def compile_btest (self , filename , args , reporting = Reporting .FULL ):
2110
2110
# Inject support code for reporting results. This adds an include a header so testcases can
2111
2111
# use REPORT_RESULT, and also adds a cpp file to be compiled alongside the testcase, which
2112
2112
# contains the implementation of REPORT_RESULT (we can't just include that implementation in
2113
2113
# the header as there may be multiple files being compiled here).
2114
2114
if reporting != Reporting .NONE :
2115
2115
# For basic reporting we inject JS helper funtions to report result back to server.
2116
- args += ['-DEMTEST_PORT_NUMBER=%d' % self . port ,
2117
- '--pre-js ' , test_file ('browser_reporting.js ' )]
2116
+ args += ['--pre-js' , test_file ( 'browser_reporting.js' ) ,
2117
+ '-include ' , test_file ('report_result.h ' )]
2118
2118
if reporting == Reporting .FULL :
2119
2119
# If C reporting (i.e. REPORT_RESULT macro) is required
2120
2120
# also compile in report_result.c and forice-include report_result.h
2121
- args += ['-I' + TEST_ROOT ,
2122
- '-include' , test_file ('report_result.h' ),
2123
- test_file ('report_result.c' )]
2121
+ self .run_process ([EMCC , '-c' , '-I' + TEST_ROOT ,
2122
+ '-DEMTEST_PORT_NUMBER=%d' % self .port ,
2123
+ test_file ('report_result.c' )] + self .get_emcc_args ())
2124
+ args .append ('report_result.o' )
2124
2125
if EMTEST_BROWSER == 'node' :
2125
2126
args .append ('-DEMTEST_NODE' )
2126
- self .run_process ([EMCC ] + self .get_emcc_args () + args )
2127
+ if not os .path .exists (filename ):
2128
+ filename = test_file (filename )
2129
+ self .run_process ([compiler_for (filename ), filename ] + self .get_emcc_args () + args )
2127
2130
2128
2131
def btest_exit (self , filename , assert_returncode = 0 , * args , ** kwargs ):
2129
2132
"""Special case of btest that reports its result solely via exiting
@@ -2166,10 +2169,10 @@ def btest(self, filename, expected=None, reference=None,
2166
2169
# manual_reference only makes sense for reference tests
2167
2170
assert manual_reference is None
2168
2171
outfile = output_basename + '.html'
2169
- args += [filename , '-o' , outfile ]
2172
+ args += ['-o' , outfile ]
2170
2173
# print('all args:', args)
2171
2174
utils .delete_file (outfile )
2172
- self .compile_btest (args , reporting = reporting )
2175
+ self .compile_btest (filename , args , reporting = reporting )
2173
2176
self .assertExists (outfile )
2174
2177
if post_build :
2175
2178
post_build ()
0 commit comments