(self, *extra_args)
| 3482 | 'dyncalls': ['-sDYNCALLS=1'], |
| 3483 | }) |
| 3484 | def test_embind(self, *extra_args): |
| 3485 | # This test is actually a large set of smaller JS unittest. |
| 3486 | # |
| 3487 | # See test/embind/embind.test.js. |
| 3488 | # |
| 3489 | # By default all of them are run. If you are debugging and want to run just a subset of the |
| 3490 | # JS tests you can use `EMBIND_TESTS=myregex` to run just the matching tests. |
| 3491 | if '-m64' in extra_args: |
| 3492 | self.require_wasm64() |
| 3493 | self.cflags += [ |
| 3494 | '--no-entry', |
| 3495 | # This test explicitly creates std::string from unsigned char pointers |
| 3496 | # which is deprecated in upstream LLVM. |
| 3497 | '-Wno-deprecated-declarations', |
| 3498 | '-lembind', |
| 3499 | '-sRETAIN_COMPILER_SETTINGS', |
| 3500 | '-sEXPORTED_RUNTIME_METHODS=getCompilerSetting,setDelayFunction,flushPendingDeletes,PureVirtualError,HEAP8,InternalError,BindingError,count_emval_handles', |
| 3501 | '-sWASM_ASYNC_COMPILATION=0', |
| 3502 | # This test uses a `CustomSmartPtr` class which has 1MB of data embedded in |
| 3503 | # it which means we need more stack space than normal. |
| 3504 | '-sSTACK_SIZE=2MB', |
| 3505 | '--pre-js', test_file('embind/test.pre.js'), |
| 3506 | '--post-js', test_file('embind/test.post.js'), |
| 3507 | ] |
| 3508 | self.cflags += extra_args |
| 3509 | |
| 3510 | js_file = self.build('embind/embind_test.cpp') |
| 3511 | |
| 3512 | testFiles = [ |
| 3513 | test_file('embind/underscore-1.4.2.js'), |
| 3514 | test_file('embind/imvu_test_adapter.js'), |
| 3515 | test_file('embind/embind.test.js'), |
| 3516 | ] |
| 3517 | |
| 3518 | if '-sDYNAMIC_EXECUTION=0' in extra_args: |
| 3519 | js_binary_str = read_file(js_file) |
| 3520 | self.assertNotContained('new Function(', js_binary_str) |
| 3521 | self.assertNotContained('eval(', js_binary_str) |
| 3522 | |
| 3523 | with open(js_file, 'ab') as f: |
| 3524 | for tf in testFiles: |
| 3525 | f.write(read_binary(tf)) |
| 3526 | |
| 3527 | output = self.run_js(js_file) |
| 3528 | self.assertNotContained('FAIL', output) |
| 3529 | |
| 3530 | def test_embind_cxx11(self): |
| 3531 | self.assert_fail([EMXX, '-c', '-std=c++11', test_file('embind/test_unsigned.cpp')], '#error "embind requires -std=c++17 or newer"') |
nothing calls this directly
no test coverage detected