diff --git a/Directory.Build.props b/Directory.Build.props index 0415a94c763505..70d6c03f17741a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -50,10 +50,12 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppCurrent)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppCurrent)', 'publish')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppCurrent)')) $([MSBuild]::NormalizePath('$(AppleAppBuilderDir)', 'AppleAppBuilder.dll')) $([MSBuild]::NormalizePath('$(AndroidAppBuilderDir)', 'AndroidAppBuilder.dll')) + $([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll')) $([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll')) diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh new file mode 100644 index 00000000000000..2d4b8f95d4f491 --- /dev/null +++ b/eng/testing/WasmRunnerTemplate.sh @@ -0,0 +1,12 @@ +set -ev + +EXECUTION_DIR=$(dirname $0) +TEST_NAME=$1 +TARGET_ARCH=$2 + +echo "Test: $1 Arch: $2" + +cd $EXECUTION_DIR +v8 --expose_wasm runtime.js -- --enable-gc --run WasmTestRunner.dll $TEST_NAME + +exit 0 diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 4728c595d981f9..3fd1594b73bd55 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -106,11 +106,29 @@ + + + + + + + + + + <_runnerFilesToPublish Include="$(AndroidTestRunnerDir)*" Condition="'$(TargetOS)' == 'Android'" /> <_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'" /> + <_runnerFilesToPublish Include="$(WasmTestRunnerDir)*" Condition="'$(TargetOS)' == 'Browser'" /> @@ -132,5 +150,5 @@ + DependsOnTargets="UpdateRuntimePack;Publish;BundleTestAppleApp;BundleTestAndroidApp;BundleTestWasmApp" /> diff --git a/eng/testing/tests.props b/eng/testing/tests.props index 9b7bc1d270ee7e..cccce13b1c4546 100644 --- a/eng/testing/tests.props +++ b/eng/testing/tests.props @@ -25,6 +25,7 @@ $(NetCoreAppCurrent)-$(Configuration) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleTestRunner', '$(MobileRunnersDirSuffix)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidTestRunner', '$(MobileRunnersDirSuffix)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmTestRunner', '$(MobileRunnersDirSuffix)')) $(PackageRID) true diff --git a/eng/testing/tests.targets b/eng/testing/tests.targets index 8abd2532274d09..c84fec867d31c6 100644 --- a/eng/testing/tests.targets +++ b/eng/testing/tests.targets @@ -4,6 +4,7 @@ RunnerTemplate.sh AppleRunnerTemplate.sh AndroidRunnerTemplate.sh + WasmRunnerTemplate.sh $(MSBuildThisFileDirectory)$(RunScriptInputName) diff --git a/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs b/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs new file mode 100644 index 00000000000000..0ee51166fbf294 --- /dev/null +++ b/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; +using System.Text; +using System.IO; +using System.Collections.Generic; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +public class WasmTestRunner +{ + public static int Main(string[] args) + { + Console.Write("Args: "); + foreach (string arg in args) + { + Console.Write(arg); + } + Console.WriteLine("."); + + return 0; + } +} diff --git a/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.csproj b/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.csproj new file mode 100644 index 00000000000000..7d68c49a196a31 --- /dev/null +++ b/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.csproj @@ -0,0 +1,11 @@ + + + Exe + enable + $(NetCoreAppCurrent) + + + + + + diff --git a/src/libraries/pretest.proj b/src/libraries/pretest.proj index 94141031b8b855..7b8e5f9f9f38b1 100644 --- a/src/libraries/pretest.proj +++ b/src/libraries/pretest.proj @@ -18,6 +18,7 @@ + diff --git a/src/mono/netcore/sample/wasm/runtime.js b/src/mono/wasm/runtime-test.js similarity index 100% rename from src/mono/netcore/sample/wasm/runtime.js rename to src/mono/wasm/runtime-test.js diff --git a/tools-local/tasks/mobile.tasks/WasmAppBuilder/WasmAppBuilder.cs b/tools-local/tasks/mobile.tasks/WasmAppBuilder/WasmAppBuilder.cs index 5261f4c08b276a..ce6839f4f62758 100644 --- a/tools-local/tasks/mobile.tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/tools-local/tasks/mobile.tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -69,7 +69,7 @@ public override bool Execute () { File.Copy (assembly.Location, Path.Join (AppDir, "managed", Path.GetFileName (assembly.Location)), true); foreach (var f in new string [] { "dotnet.wasm", "dotnet.js" }) File.Copy (Path.Join (RuntimePackDir, "native", "wasm", "runtimes", "release", f), Path.Join (AppDir, f), true); - File.Copy (MainJS!, Path.Join (AppDir, Path.GetFileName (MainJS!)), true); + File.Copy (MainJS!, Path.Join (AppDir, "runtime.js"), true); using (var sw = File.CreateText (Path.Join (AppDir, "mono-config.js"))) { sw.WriteLine ("config = {");