Skip to content

Commit

Permalink
[test] Pass filename explicitly to compile_btest helper. NFC
Browse files Browse the repository at this point in the history
This allows us to use `compiler_for` to determine whether to run
`EMCC` or `EMXX` appropriately.
  • Loading branch information
sbc100 committed Jan 18, 2024
1 parent 946c850 commit 9fb31f7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 64 deletions.
11 changes: 7 additions & 4 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ def reftest(self, expected, manually_trigger=False):
setupRefTest();
''' % (reporting, basename, int(manually_trigger)))

def compile_btest(self, args, reporting=Reporting.FULL):
def compile_btest(self, filename, args, reporting=Reporting.FULL):
# Inject support code for reporting results. This adds an include a header so testcases can
# use REPORT_RESULT, and also adds a cpp file to be compiled alongside the testcase, which
# contains the implementation of REPORT_RESULT (we can't just include that implementation in
Expand All @@ -2120,10 +2120,13 @@ def compile_btest(self, args, reporting=Reporting.FULL):
# also compile in report_result.c and forice-include report_result.h
args += ['-I' + TEST_ROOT,
'-include', test_file('report_result.h'),
'-Wno-deprecated',
test_file('report_result.c')]
if EMTEST_BROWSER == 'node':
args.append('-DEMTEST_NODE')
self.run_process([EMCC] + self.get_emcc_args() + args)
if not os.path.exists(filename):
filename = test_file(filename)
self.run_process([compiler_for(filename), filename] + self.get_emcc_args() + args)

def btest_exit(self, filename, assert_returncode=0, *args, **kwargs):
"""Special case of btest that reports its result solely via exiting
Expand Down Expand Up @@ -2166,10 +2169,10 @@ def btest(self, filename, expected=None, reference=None,
# manual_reference only makes sense for reference tests
assert manual_reference is None
outfile = output_basename + '.html'
args += [filename, '-o', outfile]
args += ['-o', outfile]
# print('all args:', args)
utils.delete_file(outfile)
self.compile_btest(args, reporting=reporting)
self.compile_btest(filename, args, reporting=reporting)
self.assertExists(outfile)
if post_build:
post_build()
Expand Down

0 comments on commit 9fb31f7

Please sign in to comment.