Skip to content

Commit

Permalink
[wasm] Test runner improvements. (#37097)
Browse files Browse the repository at this point in the history
* Fix the test runner script.

* Add a ExtraFiles property to the wasm app builder.

* Add helper make targets.

* Bump sdk version to pick up wasm support.

* Fix make targets.

* Compile wasm runtime with --enable-minimal=threads.
  • Loading branch information
vargaz authored May 28, 2020
1 parent 35aa798 commit f95b2b2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eng/testing/WasmRunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ TARGET_ARCH=$2
echo "Test: $1 Arch: $2"

cd $EXECUTION_DIR
v8 --expose_wasm runtime.js -- --enable-gc --run WasmTestRunner.dll $TEST_NAME
v8 --expose_wasm runtime.js -- --enable-gc --run WasmTestRunner.dll $TEST_NAME.dll

exit 0
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"rollForward": "major"
},
"tools": {
"dotnet": "5.0.100-preview.5.20251.2"
"dotnet": "5.0.100-preview.6.20266.1"
},
"native-tools": {
"cmake": "3.14.2",
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@
<_MonoConfigureParams Include="--disable-icall-tables"/>
<_MonoConfigureParams Include="--disable-crash-reporting"/>
<_MonoConfigureParams Include="--with-bitcode=yes"/>
<_MonoConfigureParams Include="--enable-minimal=ssa,com,jit,reflection_emit_save,portability,assembly_remapping,attach,verifier,full_messages,appdomains,security,sgen_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,logging,remoting,shared_perfcounters,sgen_debug_helpers,soft_debug,interpreter,assert_messages,cleanup,mdb,gac"/>
<_MonoConfigureParams Include="--enable-minimal=ssa,com,jit,reflection_emit_save,portability,assembly_remapping,attach,verifier,full_messages,appdomains,security,sgen_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,logging,remoting,shared_perfcounters,sgen_debug_helpers,soft_debug,interpreter,assert_messages,cleanup,mdb,gac,threads"/>
<!-- FIXME: -Os -->
<_MonoCFLAGS Include="-fexceptions" />
<_MonoCXXFLAGS Include="-fexceptions -s DISABLE_EXCEPTION_CATCHING=0" />
Expand Down
20 changes: 19 additions & 1 deletion src/mono/wasm/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
TOP=$(realpath $(CURDIR)/../../..)
-include Make.config

DOTNET=$(TOP)/dotnet.sh
JSVU=$(HOME)/.jsvu

#
# These variables are set by wasm.targets
#
Expand Down Expand Up @@ -92,11 +95,26 @@ $(eval $(call InterpBuildTemplate,debug,,$(EMCC_DEBUG_FLAGS),$(MONO_LIBS)))
$(eval $(call InterpBuildTemplate,release,,$(EMCC_RELEASE_FLAGS),$(MONO_LIBS)))

build:
EMSDK_PATH=$(PWD)/wasm/emsdk ../../../.dotnet/dotnet build /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG)
EMSDK_PATH=$(PWD)/src/mono/wasm/emsdk $(DOTNET) build /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) $(TOP)/src/libraries/src.proj /t:NativeBinPlace

clean-emsdk:
$(RM) -rf $(EMSDK_LOCAL_PATH)

clean:
$(RM) -rf $(BUILDS_BIN_DIR) $(BUILDS_OBJ_DIR)
$(RM) emsdk_env.sh

# Helper targets
.PHONY: runtime

runtime:
EMSDK_PATH=$(TOP)/src/mono/wasm/emsdk $(TOP)/build.sh --subset mono --arch wasm --os Browser -c $(CONFIG)

test-runner:
$(DOTNET) build $(TOP)/src/libraries/Common/tests/WasmTestRunner /p:Configuration=$(CONFIG)

app-builder:
$(DOTNET) build $(TOP)/tools-local/tasks/mobile.tasks/WasmAppBuilder

run-tests-%:
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class WasmAppBuilder : Task
[Required]
public ITaskItem[]? AssemblySearchPaths { get; set; }
public ITaskItem[]? ExtraAssemblies { get; set; }
public ITaskItem[]? ExtraFiles { get; set; }

Dictionary<string, Assembly>? Assemblies;
Resolver? Resolver;
Expand Down Expand Up @@ -71,6 +72,11 @@ public override bool Execute () {
File.Copy (Path.Join (RuntimePackDir, "native", "wasm", "runtimes", "release", f), Path.Join (AppDir, f), true);
File.Copy (MainJS!, Path.Join (AppDir, "runtime.js"), true);

if (ExtraFiles != null) {
foreach (var item in ExtraFiles)
File.Copy (item.ItemSpec, Path.Join (AppDir, Path.GetFileName (item.ItemSpec)), true);
}

using (var sw = File.CreateText (Path.Join (AppDir, "mono-config.js"))) {
sw.WriteLine ("config = {");
sw.WriteLine ("\tvfs_prefix: \"managed\",");
Expand Down

0 comments on commit f95b2b2

Please sign in to comment.