Skip to content

Commit

Permalink
Bump to updated WebAssembly runner from xharness (#37178)
Browse files Browse the repository at this point in the history
  • Loading branch information
akoeplinger authored May 30, 2020
1 parent 3d80025 commit 2ef008e
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "1.0.0-prerelease.20271.3",
"version": "1.0.0-prerelease.20279.2",
"commands": [
"xharness"
]
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@
<Uri>https://github.com/mono/linker</Uri>
<Sha>d51be363c75855fb19d7c30c2600cd627d7e359d</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.Tests.Runners" Version="1.0.0-prerelease.20277.1">
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.20279.2">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>8f6cc04f53cb6759758ffc97c9c8ca3ab4802f7f</Sha>
<Sha>94251a8d989891191b5dd915eec82de36d8404a1</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<SystemDataSqlClientVersion>4.8.0</SystemDataSqlClientVersion>
<!-- Testing -->
<MicrosoftNETTestSdkVersion>16.7.0-preview-20200521-01</MicrosoftNETTestSdkVersion>
<MicrosoftDotNetXHarnessTestsRunnersVersion>1.0.0-prerelease.20277.1</MicrosoftDotNetXHarnessTestsRunnersVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>1.0.0-prerelease.20279.2</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<XUnitVersion>2.4.1</XUnitVersion>
<CoverletCollectorVersion>1.2.1</CoverletCollectorVersion>
<TraceEventVersion>2.0.5</TraceEventVersion>
Expand Down
6 changes: 2 additions & 4 deletions eng/testing/WasmRunnerTemplate.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
set -ev

EXECUTION_DIR=$(dirname $0)
TEST_NAME=$1
TARGET_ARCH=$2

echo "Test: $1 Arch: $2"
echo "Test: $1"

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

exit 0
1 change: 1 addition & 0 deletions eng/testing/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<RunTestsCommand>"$(RunScriptOutputPath)" --runtime-path "$(TestHostRootPath.TrimEnd('\/'))"</RunTestsCommand>
<RunTestsCommand Condition="'$(TestRspFile)' != '' and '$(RuntimeFlavor)' != 'Mono'">$(RunTestsCommand) --rsp-file "$(TestRspFile)"</RunTestsCommand>
<RunTestsCommand Condition="'$(TargetsMobile)' == 'true'">"$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture)</RunTestsCommand>
<RunTestsCommand Condition="'$(TargetOS)' == 'Browser'">"$(RunScriptOutputPath)" $(AssemblyName).dll $(_withoutCategories.Replace(';', ' -notrait category='))</RunTestsCommand>
</PropertyGroup>

<!-- Invoke the run script with the test host as the runtime path. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using Microsoft.DotNet.XHarness.Tests.Runners;
using Microsoft.DotNet.XHarness.Tests.Runners.Core;
using Microsoft.DotNet.XHarness.TestRunners.Common;
using Microsoft.DotNet.XHarness.TestRunners.Xunit;

public class SimpleAndroidTestRunner : AndroidApplicationEntryPoint, IDevice
{
Expand Down Expand Up @@ -72,8 +72,6 @@ protected override void TerminateWithSuccess() {}

protected override IDevice Device => this;

protected override TestRunnerType TestRunner => TestRunnerType.Xunit;

protected override string? IgnoreFilesDirectory => null;

protected override string IgnoredTraitsFilePath => "xunit-excludes.txt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="AndroidTestRunner.cs" />
<PackageReference Include="Microsoft.DotNet.XHarness.Tests.Runners" Version="$(MicrosoftDotNetXHarnessTestsRunnersVersion)" />
<PackageReference Include="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="$(MicrosoftDotNetXHarnessTestRunnersXunitVersion)" />
</ItemGroup>
</Project>
6 changes: 2 additions & 4 deletions src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using Microsoft.DotNet.XHarness.Tests.Runners;
using Microsoft.DotNet.XHarness.Tests.Runners.Core;
using Microsoft.DotNet.XHarness.TestRunners.Common;
using Microsoft.DotNet.XHarness.TestRunners.Xunit;

public class SimpleTestRunner : iOSApplicationEntryPoint, IDevice
{
Expand Down Expand Up @@ -128,8 +128,6 @@ protected override void TerminateWithSuccess()

protected override IDevice Device => this;

protected override TestRunnerType TestRunner => TestRunnerType.Xunit;

protected override string? IgnoreFilesDirectory => null;

protected override string IgnoredTraitsFilePath => "xunit-excludes.txt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="AppleTestRunner.cs" />
<PackageReference Include="Microsoft.DotNet.XHarness.Tests.Runners" Version="$(MicrosoftDotNetXHarnessTestsRunnersVersion)" />
<PackageReference Include="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="$(MicrosoftDotNetXHarnessTestRunnersXunitVersion)" />
</ItemGroup>
</Project>
41 changes: 27 additions & 14 deletions src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,40 @@
// 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
using Microsoft.DotNet.XHarness.TestRunners.Xunit;

public class SimpleWasmTestRunner : WasmApplicationEntryPoint
{
protected override string TestAssembly { get; set; } = "";
protected override IEnumerable<string> ExcludedTraits { get; set; } = new List<string>();

public static int Main(string[] args)
{
Console.Write("Args: ");
foreach (string arg in args)
var testAssembly = args[0];
var excludedTraits = new List<string>();

for (int i = 1; i < args.Length; i++)
{
Console.Write(arg);
var option = args[i];
switch (option)
{
case "-notrait":
excludedTraits.Add (args[i + 1]);
i++;
break;
default:
throw new ArgumentException($"Invalid argument '{option}'.");
}
}
Console.WriteLine(".");

return 0;
var runner = new SimpleWasmTestRunner()
{
TestAssembly = testAssembly,
ExcludedTraits = excludedTraits
};

return runner.Run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="WasmTestRunner.cs" />
<PackageReference Include="Microsoft.DotNet.XHarness.Tests.Runners" Version="$(MicrosoftDotNetXHarnessTestsRunnersVersion)" />
<PackageReference Include="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="$(MicrosoftDotNetXHarnessTestRunnersXunitVersion)" />
</ItemGroup>
</Project>

0 comments on commit 2ef008e

Please sign in to comment.