Skip to content

Commit ebe3d25

Browse files
authored
[test] Remove unnecessary use of noExitRuntime in tests. NFC (#20319)
Also simplify `test_module_exports_with_closure`.
1 parent 48d01d3 commit ebe3d25

File tree

6 files changed

+10
-48
lines changed

6 files changed

+10
-48
lines changed

test/Module-exports/setup.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/Module-exports/main.js renamed to test/module_exports/main.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,3 @@ console.log("\nbufferTest finished\n");
2828

2929
// free the heap buffer
3030
Module._free(ptr);
31-
32-
33-
34-
File renamed without changes.

test/return64bit/testbind.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
// returned in the normal return value, but the most significant 32 bits are
44
// returned via the accessor method getTempRet0()
55

6-
var Module = {
7-
'noExitRuntime' : true
8-
};
9-
106
Module['runtest'] = function() {
117
var low = _test_return64(0x11223344, 0xaabbccdd);
128
var high = getTempRet0();

test/return64bit/testbind_bigint.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
// returned in the normal return value, but the most significant 32 bits are
44
// returned via the accessor method getTempRet0()
55

6-
var Module = {
7-
'noExitRuntime' : true
8-
};
9-
106
Module['runtest'] = function() {
117
// Use eval to create BigInt, as no support for Xn notation yet in JS
128
// optimizer.

test/test_other.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,45 +3298,34 @@ def test_module_exports_with_closure(self):
32983298
# This is important as if module.export is not present the Module
32993299
# object will not be visible to node.js
33003300

3301-
# compile with -O2 --closure 0
3302-
self.run_process([EMCC, test_file('Module-exports/test.c'),
3303-
'-o', 'test.js', '-O2', '--closure', '0',
3304-
'--pre-js', test_file('Module-exports/setup.js'),
3301+
# compile without --closure=1
3302+
self.run_process([EMCC, test_file('module_exports/test.c'),
3303+
'-o', 'test.js', '-O2',
33053304
'-sEXPORTED_FUNCTIONS=_bufferTest,_malloc,_free',
33063305
'-sEXPORTED_RUNTIME_METHODS=ccall,cwrap',
33073306
'-sWASM_ASYNC_COMPILATION=0'])
33083307

3309-
# Check that compilation was successful
3310-
self.assertExists('test.js')
3311-
test_js_closure_0 = read_file('test.js')
3312-
3313-
# Check that test.js compiled with --closure 0 contains "module['exports'] = Module;"
3314-
assert ("module['exports'] = Module;" in test_js_closure_0) or ('module["exports"]=Module' in test_js_closure_0) or ('module["exports"] = Module;' in test_js_closure_0)
3308+
# Check that test.js compiled without --closure=1 contains "module['exports'] = Module;"
3309+
self.assertContained('module["exports"]=Module', read_file('test.js'))
33153310

33163311
# Check that main.js (which requires test.js) completes successfully when run in node.js
33173312
# in order to check that the exports are indeed functioning correctly.
3318-
shutil.copyfile(test_file('Module-exports/main.js'), 'main.js')
3313+
shutil.copyfile(test_file('module_exports/main.js'), 'main.js')
33193314
self.assertContained('bufferTest finished', self.run_js('main.js'))
33203315

33213316
# Delete test.js again and check it's gone.
33223317
delete_file('test.js')
3323-
self.assertNotExists('test.js')
33243318

3325-
# compile with -O2 --closure 1
3326-
self.run_process([EMCC, test_file('Module-exports/test.c'),
3319+
# compile with --closure=1
3320+
self.run_process([EMCC, test_file('module_exports/test.c'),
33273321
'-o', 'test.js', '-O2', '--closure=1',
3328-
'--pre-js', test_file('Module-exports/setup.js'),
33293322
'-sEXPORTED_FUNCTIONS=_bufferTest,_malloc,_free',
33303323
'-sEXPORTED_RUNTIME_METHODS=ccall,cwrap',
33313324
'-sWASM_ASYNC_COMPILATION=0'])
33323325

3333-
# Check that compilation was successful
3334-
self.assertExists('test.js')
3335-
test_js_closure_1 = read_file('test.js')
3336-
33373326
# Check that test.js compiled with --closure 1 contains "module.exports", we want to verify that
33383327
# "module['exports']" got minified to "module.exports" when compiling with --closure 1
3339-
self.assertContained("module.exports", test_js_closure_1)
3328+
self.assertContained('module.exports=', read_file('test.js'))
33403329

33413330
# Check that main.js (which requires test.js) completes successfully when run in node.js
33423331
# in order to check that the exports are indeed functioning correctly.
@@ -3591,7 +3580,6 @@ def test_proxyfs(self):
35913580

35923581
create_file('proxyfs_pre.js', r'''
35933582
Module["noInitialRun"]=true;
3594-
Module["noExitRuntime"]=true;
35953583
''')
35963584

35973585
create_file('proxyfs_embed.txt', 'test\n')
@@ -7406,7 +7394,7 @@ def test(page_diff):
74067394
self.assertEqual(less, none)
74077395

74087396
@parameterized({
7409-
'normal': (['-sWASM_BIGINT=0'], 'testbind.js'),
7397+
'': ([], 'testbind.js'),
74107398
'bigint': (['-sWASM_BIGINT'], 'testbind_bigint.js'),
74117399
})
74127400
@requires_node

0 commit comments

Comments
 (0)