Skip to content

Commit 3257e01

Browse files
committed
[MODULARIZE=instance] Mark MINIMAL_RUNTIME as not supported
Also disable a bunch of unsupported tests. Now we can run the entire core test in MODULARIZE=instance mode! I'm adding a new test running here, which we might not want to keep around forever, but its very useful while working on ESM integration.
1 parent 117686e commit 3257e01

12 files changed

+73
-50
lines changed

.circleci/config.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,14 @@ jobs:
651651
wasmfs.test_fs_llseek_rawfs
652652
wasmfs.test_freetype
653653
minimal0.test_utf
654-
instance.test_async_hello_v8
655-
instance.test_environment
656654
"
655+
test-modularize-instance:
656+
executor: focal
657+
environment:
658+
EMTEST_SKIP_NODE_CANARY: "1"
659+
steps:
660+
- run-tests-linux:
661+
test_targets: "instance"
657662
test-wasm2js1:
658663
environment:
659664
EMTEST_SKIP_NODE_CANARY: "1"
@@ -806,26 +811,6 @@ jobs:
806811
core0.test_pthread_join_and_asyncify
807812
core0.test_async_ccall_promise_jspi*
808813
core0.test_cubescript_jspi
809-
instance.test_hello_world
810-
instance.test_dylink_basics
811-
instance.test_cube2hash*
812-
instance.test_exceptions_3*
813-
instance.test_memorygrowth
814-
instance.test_stat
815-
instance.test_iostream_and_determinism
816-
instance.test_fannkuch
817-
instance.test_fasta
818-
instance.test_EXPORTED_RUNTIME_METHODS
819-
instance.test_abort_on_exceptions*
820-
instance.test_ccall
821-
instance.test_dylink_basics*
822-
instance.test_Module_dynamicLibraries*
823-
instance.test_dylink_argv_argc
824-
instance.test_dlmalloc*
825-
instance.test_dyncall*
826-
instance.test_em_asm*
827-
instance.test_embind*
828-
instance.test_module_wasm_memory
829814
esm_integration.test_fs_js_api*
830815
esm_integration.test_inlinejs3
831816
esm_integration.test_embind_val_basics
@@ -1154,6 +1139,9 @@ workflows:
11541139
- test-other:
11551140
requires:
11561141
- build-linux
1142+
- test-modularize-instance:
1143+
requires:
1144+
- build-linux
11571145
- test-browser-chrome
11581146
- test-browser-chrome-2gb:
11591147
requires:

site/source/docs/compiling/Modularized-Output.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ fix in future releses. Current limitations include:
133133
* :ref:`asyncify_lazy_load_code` is not supported (depends on ``wasmExports``
134134
global)
135135

136+
* :ref:`minimal_runtime` is not supported.
137+
136138
* The output of file_packager is not compatible so :ref:`emcc-preload-file` and
137139
:ref:`emcc-embed-file` do not work.
138140

src/lib/libccall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
addToLibrary({
88
// Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
9-
#if MODULARIZE == 'instance'
9+
#if MODULARIZE == 'instance' && !INCLUDE_FULL_LIBRARY
1010
$getCFunc__deps: [() => error('ccall is not yet compatible with MODULARIZE=instance')],
1111
#endif
1212
$getCFunc__internal: true,

test/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ def metafunc(self, with_minimal_runtime, *args, **kwargs):
522522
print('parameterize:minimal_runtime=%s' % with_minimal_runtime)
523523
assert self.get_setting('MINIMAL_RUNTIME') is None
524524
if with_minimal_runtime:
525+
if self.get_setting('MODULARIZE') == 'instance':
526+
self.skipTest('MODULARIZE=instance is not compatible with MINIMAL_RUNTIME')
525527
self.set_setting('MINIMAL_RUNTIME', 1)
526528
# This extra helper code is needed to cleanly handle calls to exit() which throw
527529
# an ExitCode exception.

test/core/pthread/test_pthread_exit_runtime.pre.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var address = 0;
22

33
Module.onRuntimeInitialized = function() {
4-
address = Module['_join_returned_address']();
4+
address = _join_returned_address();
55
assert(address);
66
assert(HEAP8[address] == 0);
77
}

test/core/test_env.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PATH=/
55
PWD=/
66
HOME=/home/web_user
77
LANG=(C|en_US).UTF-8
8-
_=.*(/test_env.js|./this.program)
8+
_=.*(/test_env.m?js|./this.program)
99

1010
getenv\(PATH\): /
1111
getenv\(NONEXISTENT\): \(null\)

test/core/test_environ.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ PATH=/
44
PWD=/
55
HOME=/home/web_user
66
LANG=(C|en_US).UTF-8
7-
_=.*(/test_environ.js|/this.program)
7+
_=.*(/test_environ.m?js|/this.program)

test/core/test_main_reads_args.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
argc: 1
2-
argv\[0\]: (test_main_reads_args\.js|this\.program)
2+
argv\[0\]: (test_main_reads_args\.m?js|this\.program)

test/core/test_utf.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@
66
*/
77

88
#include <stdio.h>
9-
#include <emscripten.h>
109
#include <stdlib.h>
1110

11+
#include <emscripten/emscripten.h>
12+
#include <emscripten/em_js.h>
13+
14+
EM_JS_DEPS(deps, "$stringToUTF8OnStack,$getValue");
15+
1216
int main() {
1317
char *c = "μ†ℱ ╋ℯ╳╋ 😇";
1418
printf("%hhu %hhu %hhu %hhu %s\n", c[0], c[1], c[2], c[3], c);
15-
emscripten_run_script(
16-
"var cheez = Module.stringToUTF8OnStack(\"μ†ℱ ╋ℯ╳╋ 😇\");"
17-
"out(UTF8ToString(cheez), Module.getValue(cheez+0, 'i8')&0xff, "
18-
" Module.getValue(cheez+1, 'i8')&0xff, "
19-
" Module.getValue(cheez+2, 'i8')&0xff, "
20-
" Module.getValue(cheez+3, 'i8')&0xff);");
19+
EM_ASM({
20+
var cheez = stringToUTF8OnStack("μ†ℱ ╋ℯ╳╋ 😇");
21+
out(UTF8ToString(cheez), getValue(cheez+0, 'i8')&0xff,
22+
getValue(cheez+1, 'i8')&0xff,
23+
getValue(cheez+2, 'i8')&0xff,
24+
getValue(cheez+3, 'i8')&0xff);
25+
});
2126
}

0 commit comments

Comments
 (0)