Skip to content

Commit dabbde6

Browse files
authored
Fix warnings in tsgen tests. NFC (#20870)
Also don't report clearing of out/test between each test, which makes the test runner less chatty by default.
1 parent f9c0d0e commit dabbde6

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

test/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,14 +895,14 @@ def setUp(self):
895895
if EMTEST_SAVE_DIR == 2:
896896
print('Not clearing existing test directory')
897897
else:
898-
print('Clearing existing test directory')
898+
logger.debug('Clearing existing test directory: %s', self.working_dir)
899899
# Even when --save-dir is used we still try to start with an empty directory as many tests
900900
# expect this. --no-clean can be used to keep the old contents for the new test
901901
# run. This can be useful when iterating on a given test with extra files you want to keep
902902
# around in the output directory.
903903
force_delete_contents(self.working_dir)
904904
else:
905-
print('Creating new test output directory')
905+
logger.debug('Creating new test output directory: %s', self.working_dir)
906906
ensure_dir(self.working_dir)
907907
utils.write_file(LAST_TEST, self.id() + '\n')
908908
os.chdir(self.working_dir)

test/test_other.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,9 +3032,11 @@ def test_embind_tsgen(self):
30323032

30333033
def test_embind_tsgen_ignore(self):
30343034
create_file('fail.js', 'assert(false);')
3035+
self.emcc_args += ['-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts']
30353036
# These extra arguments are not related to TS binding generation but we want to
30363037
# verify that they do not interfere with it.
30373038
extra_args = ['-sALLOW_MEMORY_GROWTH=1',
3039+
'-Wno-pthreads-mem-growth',
30383040
'-sMAXIMUM_MEMORY=4GB',
30393041
'--pre-js', 'fail.js',
30403042
'--post-js', 'fail.js',
@@ -3045,28 +3047,30 @@ def test_embind_tsgen_ignore(self):
30453047
'--preload-file', 'fail.js',
30463048
'-O3',
30473049
'-msimd128',
3048-
'-sUSE_PTHREADS',
3050+
'-pthread',
30493051
'-sPROXY_TO_PTHREAD',
30503052
'-sPTHREAD_POOL_SIZE=1',
30513053
'-sSINGLE_FILE',
30523054
'-lembind', # Test duplicated link option.
30533055
]
3054-
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
3055-
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'] + extra_args)
3056+
self.emcc(test_file('other/embind_tsgen.cpp'), extra_args)
30563057
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))
30573058
# Test these args separately since they conflict with arguments in the first test.
30583059
extra_args = ['-sMODULARIZE',
30593060
'--embed-file', 'fail.js',
30603061
'-sMINIMAL_RUNTIME=2',
30613062
'-sEXPORT_ES6=1']
3062-
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
3063-
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'] + extra_args)
3063+
self.emcc(test_file('other/embind_tsgen.cpp'), extra_args)
30643064
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))
30653065

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

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

30933098
def test_emconfig(self):

0 commit comments

Comments
 (0)