Skip to content

Commit 4962071

Browse files
committed
[test] Pass filename explicitly to compile_btest helper. NFC
This allows us to use `compiler_for` to determine whether to run `EMCC` or `EMXX` appropriately.
1 parent 946c850 commit 4962071

File tree

3 files changed

+60
-62
lines changed

3 files changed

+60
-62
lines changed

test/common.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ def reftest(self, expected, manually_trigger=False):
21062106
setupRefTest();
21072107
''' % (reporting, basename, int(manually_trigger)))
21082108

2109-
def compile_btest(self, args, reporting=Reporting.FULL):
2109+
def compile_btest(self, filename, args, reporting=Reporting.FULL):
21102110
# Inject support code for reporting results. This adds an include a header so testcases can
21112111
# use REPORT_RESULT, and also adds a cpp file to be compiled alongside the testcase, which
21122112
# contains the implementation of REPORT_RESULT (we can't just include that implementation in
@@ -2123,7 +2123,9 @@ def compile_btest(self, args, reporting=Reporting.FULL):
21232123
test_file('report_result.c')]
21242124
if EMTEST_BROWSER == 'node':
21252125
args.append('-DEMTEST_NODE')
2126-
self.run_process([EMCC] + self.get_emcc_args() + args)
2126+
if not os.path.exists(filename):
2127+
filename = test_file(filename)
2128+
self.run_process([compiler_for(filename), filename] + self.get_emcc_args() + args)
21272129

21282130
def btest_exit(self, filename, assert_returncode=0, *args, **kwargs):
21292131
"""Special case of btest that reports its result solely via exiting
@@ -2166,10 +2168,10 @@ def btest(self, filename, expected=None, reference=None,
21662168
# manual_reference only makes sense for reference tests
21672169
assert manual_reference is None
21682170
outfile = output_basename + '.html'
2169-
args += [filename, '-o', outfile]
2171+
args += ['-o', outfile]
21702172
# print('all args:', args)
21712173
utils.delete_file(outfile)
2172-
self.compile_btest(args, reporting=reporting)
2174+
self.compile_btest(filename, args, reporting=reporting)
21732175
self.assertExists(outfile)
21742176
if post_build:
21752177
post_build()

0 commit comments

Comments
 (0)