| 921 | print('(moving on..)') |
| 922 | |
| 923 | def compile_btest(self, filename, cflags, reporting=Reporting.FULL): |
| 924 | # Inject support code for reporting results. This adds an include a header so testcases can |
| 925 | # use REPORT_RESULT, and also adds a cpp file to be compiled alongside the testcase, which |
| 926 | # contains the implementation of REPORT_RESULT (we can't just include that implementation in |
| 927 | # the header as there may be multiple files being compiled here). |
| 928 | if reporting != Reporting.NONE: |
| 929 | # For basic reporting we inject JS helper functions to report result back to server. |
| 930 | self.add_browser_reporting() |
| 931 | cflags += ['--pre-js', 'browser_reporting.js'] |
| 932 | if reporting == Reporting.FULL: |
| 933 | # If C reporting (i.e. the REPORT_RESULT macro) is required we |
| 934 | # also include report_result.c and force-include report_result.h |
| 935 | self.run_process([EMCC, '-c', '-I' + TEST_ROOT, |
| 936 | test_file('report_result.c')] + self.get_cflags(compile_only=True) + (['-fPIC'] if '-fPIC' in cflags else [])) |
| 937 | cflags += ['report_result.o', '-include', test_file('report_result.h')] |
| 938 | if EMTEST_BROWSER == 'node': |
| 939 | cflags.append('-DEMTEST_NODE') |
| 940 | filename = maybe_test_file(filename) |
| 941 | self.run_process([compiler_for(filename), filename] + self.get_cflags() + cflags) |
| 942 | # Remove the file since some tests have assertions for how many files are in |
| 943 | # the output directory. |
| 944 | utils.delete_file('browser_reporting.js') |
| 945 | |
| 946 | def btest_exit(self, filename, assert_returncode=0, *args, **kwargs): |
| 947 | """Special case of `btest` that reports its result solely via exiting with a given result code. |