Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sdks
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@users.noreply.github.com>2018-09-19 19:16:01 +0300
committerLudovic Henry <luhenry@microsoft.com>2018-09-19 19:16:01 +0300
commit9cb832ff2a3c09058b8c220bbd021f1177c2b7aa (patch)
tree7deb5cc2b8f767c7fde5704b25842a863aa34686 /sdks
parent7c7dcdb5a9fc5874269fbdf09f3440201384442c (diff)
[wasm] Enable the mini test suite under AOT. (#10670)
* [wasm] Enable the mini test suite under AOT. * [wasm] Remove aot-driver.js as it's not needed anymore.
Diffstat (limited to 'sdks')
-rw-r--r--sdks/wasm/Makefile9
-rw-r--r--sdks/wasm/aot-driver.js126
2 files changed, 3 insertions, 132 deletions
diff --git a/sdks/wasm/Makefile b/sdks/wasm/Makefile
index ebc47078685..13698640683 100644
--- a/sdks/wasm/Makefile
+++ b/sdks/wasm/Makefile
@@ -155,15 +155,12 @@ MINI_BASIC_TEST_FILES= \
MINI_BASIC_TEST_SOURCES= $(patsubst %,$(MINI_PATH)/%,$(MINI_BASIC_TEST_FILES))
-mini_tests_basic.dll: $(MINI_BASIC_TEST_SOURCES)
- $(CSC) $(CSC_FLAGS) /unsafe -target:library -out:$@ -define:__MOBILE__,ARCH_32,NO_BITCODE /r:$(WASM_BCL_DIR)/mscorlib.dll $(MINI_BASIC_TEST_SOURCES)
-
-aot-sample: $(DRIVER_CONF)/.stamp-build packager.exe mini_tests_basic.dll runtime.g.js
- mono packager.exe --emscripten-sdkdir=$(EMSCRIPTEN_SDKDIR) --mono-sdkdir=$(PWD)/../out --appdir=bin/aot-sample --builddir=obj/aot-sample --aot --nobinding --asset=aot-driver.js mini_tests_basic.dll
+aot-sample: $(DRIVER_CONF)/.stamp-build packager.exe mini_tests.dll main.exe runtime.g.js
+ mono packager.exe --emscripten-sdkdir=$(EMSCRIPTEN_SDKDIR) --mono-sdkdir=$(PWD)/../out -appdir=bin/aot-sample --builddir=obj/aot-sample --aot --template=runtime-tests.g.js mini_tests.dll main.exe
ninja -v -C obj/aot-sample
do-aot-sample: aot-sample
- (cd bin/aot-sample && $(SM) aot-driver.js)
+ (cd bin/aot-sample && $(SM) runtime.js mini)
build-debug-sample: .stamp-build-debug-sample
diff --git a/sdks/wasm/aot-driver.js b/sdks/wasm/aot-driver.js
deleted file mode 100644
index 8f0385f083f..00000000000
--- a/sdks/wasm/aot-driver.js
+++ /dev/null
@@ -1,126 +0,0 @@
-//glue code to deal with the differences between ch, d8, jsc and sm.
-if (print == undefined)
- print = console.log;
-
-
-if (console != undefined) {
- var has_console_warn = false;
- try {
- if (console.warn != undefined)
- has_console_warn = true;
- } catch(e) {}
-
- if (!has_console_warn)
- console.warn = console.log;
-}
-
-fail_exec = function(reason) {
- print (reason);
- throw "FAIL";
-}
-
-try {
- arguments = WScript.Arguments;
- load = WScript.LoadScriptFile;
- read = WScript.LoadBinaryFile;
- fail_exec = function(reason) {
- print (reason);
- WScript.Quit(1);
- }
-} catch(e) {}
-
-try {
- if (scriptArgs !== undefined)
- arguments = scriptArgs;
-} catch(e) {}
-
-
-// load("runtime.js")
-
-var App = {
- init: function () { print ("runtime init finished"); }
-};
-
-function ResolveEagerPromise(value) {
- this.then = function(cb) {
- var res = cb (value);
- return new ResolveEagerPromise(res);
- }
-}
-
-var Module = {
- onRuntimeInitialized: function () {
- print("initing the runtime");
- MONO.mono_load_runtime_and_bcl (
- "managed",
- "managed",
- 0,
- [ "mscorlib.dll", "mini_tests_basic.dll", ],
- function () { App.init (); },
- function (file) {
- // print("loading " + file)
- return new ResolveEagerPromise ({
- ok: true,
- url: file,
- arrayBuffer: function() { return read (file, 'binary') }
- })
- });
- },
-
- print: function(x) { print ("WASM: " + x) },
- printErr: function(x) { print ("WASM-ERR: " + x) },
-
- totalDependencies: 0,
- monitorRunDependencies: function(left) {
- this.totalDependencies = Math.max(this.totalDependencies, left);
- print("STATUS: "+ (left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'));
- },
-
- instantiateWasm: function (env, receiveInstance) {
- //merge Module's env with emcc's env
- env.env = Object.assign({}, env.env, this.env);
- var module = new WebAssembly.Module (read ('mono.wasm', 'binary'))
- this.wasm_instance = new WebAssembly.Instance (module, env);
- this.em_cb = receiveInstance;
- return this
- },
-
- finish_loading: function () {
- this.em_cb (this.wasm_instance);
- },
-
- env: {
- },
-
-};
-
-
-load("mono.js")
-Module.finish_loading ();
-
-function not_null(value) {
- if (!value)
- throw "error";
- return value;
-}
-
-var assembly_load = Module.cwrap ('mono_wasm_assembly_load', 'number', ['string'])
-var find_class = Module.cwrap ('mono_wasm_assembly_find_class', 'number', ['number', 'string', 'string'])
-var find_method = Module.cwrap ('mono_wasm_assembly_find_method', 'number', ['number', 'string', 'number'])
-var mono_runtime_invoke = Module.cwrap ('mono_wasm_invoke_method', 'number', ['number', 'number', 'number', 'number']);
-var mono_unbox_int = Module.cwrap ('mono_unbox_int', 'number', ['number']);
-const IGNORE_PARAM_COUNT = -1;
-
-var test_suite = not_null (assembly_load("mini_tests_basic"))
-var basic_tests = not_null (find_class (test_suite, "", "BasicTests"))
-var test_0_return = not_null (find_method (basic_tests, "test_0_return", IGNORE_PARAM_COUNT))
-
-var eh_throw = Module._malloc (4);
-Module.setValue (eh_throw, 0, "i32");
-var res = mono_unbox_int (mono_runtime_invoke (test_0_return, 0, 0, eh_throw));
-var eh_res = Module.getValue (eh_throw, "i32");
-print ("res is " + res + " eh is " + eh_res);
-
-
-
-