Skip to content

Fix warnings in tsgen tests. NFC #20870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,14 +895,14 @@ def setUp(self):
if EMTEST_SAVE_DIR == 2:
print('Not clearing existing test directory')
else:
print('Clearing existing test directory')
logger.debug('Clearing existing test directory: %s', self.working_dir)
# Even when --save-dir is used we still try to start with an empty directory as many tests
# expect this. --no-clean can be used to keep the old contents for the new test
# run. This can be useful when iterating on a given test with extra files you want to keep
# around in the output directory.
force_delete_contents(self.working_dir)
else:
print('Creating new test output directory')
logger.debug('Creating new test output directory: %s', self.working_dir)
ensure_dir(self.working_dir)
utils.write_file(LAST_TEST, self.id() + '\n')
os.chdir(self.working_dir)
Expand Down
19 changes: 12 additions & 7 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3032,9 +3032,11 @@ def test_embind_tsgen(self):

def test_embind_tsgen_ignore(self):
create_file('fail.js', 'assert(false);')
self.emcc_args += ['-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts']
# These extra arguments are not related to TS binding generation but we want to
# verify that they do not interfere with it.
extra_args = ['-sALLOW_MEMORY_GROWTH=1',
'-Wno-pthreads-mem-growth',
'-sMAXIMUM_MEMORY=4GB',
'--pre-js', 'fail.js',
'--post-js', 'fail.js',
Expand All @@ -3045,28 +3047,30 @@ def test_embind_tsgen_ignore(self):
'--preload-file', 'fail.js',
'-O3',
'-msimd128',
'-sUSE_PTHREADS',
'-pthread',
'-sPROXY_TO_PTHREAD',
'-sPTHREAD_POOL_SIZE=1',
'-sSINGLE_FILE',
'-lembind', # Test duplicated link option.
]
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'] + extra_args)
self.emcc(test_file('other/embind_tsgen.cpp'), extra_args)
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))
# Test these args separately since they conflict with arguments in the first test.
extra_args = ['-sMODULARIZE',
'--embed-file', 'fail.js',
'-sMINIMAL_RUNTIME=2',
'-sEXPORT_ES6=1']
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'] + extra_args)
self.emcc(test_file('other/embind_tsgen.cpp'), extra_args)
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))

def test_embind_tsgen_test_embind(self):
self.run_process([EMCC, test_file('embind/embind_test.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen_test_embind.d.ts',
'-DSKIP_UNBOUND_TYPES']) # TypeScript generation requires all type to be bound.
# This test explicitly creates std::string from unsigned char pointers
# which is deprecated in upstream LLVM.
'-Wno-deprecated-declarations',
# TypeScript generation requires all type to be bound.
'-DSKIP_UNBOUND_TYPES'] + self.get_emcc_args())
self.assertExists('embind_tsgen_test_embind.d.ts')

def test_embind_tsgen_val(self):
Expand All @@ -3087,7 +3091,8 @@ def test_embind_tsgen_bigint(self):
def test_embind_tsgen_memory64(self):
# Check that when memory64 is enabled longs & unsigned longs are mapped to bigint in the generated TS bindings
self.run_process([EMCC, test_file('other/embind_tsgen_memory64.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen_memory64.d.ts', '-sMEMORY64'])
'-lembind', '--embind-emit-tsd', 'embind_tsgen_memory64.d.ts', '-sMEMORY64', '-Wno-experimental'] +
self.get_emcc_args())
self.assertFileContents(test_file('other/embind_tsgen_memory64.d.ts'), read_file('embind_tsgen_memory64.d.ts'))

def test_emconfig(self):
Expand Down