Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Enable some previously failing WBT/AOT tests on windows #70595

Merged
merged 2 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/tests/BuildWasmApps/Wasm.Build.Tests/MainWithArgsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public MainWithArgsTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur
).WithRunHosts(host).UnwrapItemsAsArrays();

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ false, RunHost.All })]
[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ true, RunHost.All })]
public void AsyncMainWithArgs(BuildArgs buildArgs, string[] args, RunHost host, string id)
Expand All @@ -40,7 +39,6 @@ public static async System.Threading.Tasks.Task<int> Main(string[] args)
buildArgs, args, host, id);

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ false, RunHost.All })]
[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ true, RunHost.All })]
public void TopLevelWithArgs(BuildArgs buildArgs, string[] args, RunHost host, string id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public ReferenceNewAssemblyRebuildTest(ITestOutputHelper output, SharedBuildPerT
}

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(NativeBuildData))]
public void ReferenceNewAssembly(BuildArgs buildArgs, bool nativeRelink, bool invariant, RunHost host, string id)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@ public SatelliteAssembliesTests(ITestOutputHelper output, SharedBuildPerTestClas
public static IEnumerable<object?[]> SatelliteAssemblyTestData(bool aot, bool relinking, RunHost host)
=> ConfigWithAOTData(aot)
.Multiply(
new object?[] { relinking, "es-ES", "got: hola" },
new object?[] { relinking, null, "got: hello" },
new object?[] { relinking, "ja-JP", "got: \u3053\u3093\u306B\u3061\u306F" })
new object?[] { relinking, "es-ES" },
new object?[] { relinking, null },
new object?[] { relinking, "ja-JP" })
.WithRunHosts(host)
.UnwrapItemsAsArrays();

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ false, RunHost.All })]
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ true, RunHost.All })]
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ true, /*relinking*/ false, RunHost.All })]
public void ResourcesFromMainAssembly(BuildArgs buildArgs,
bool nativeRelink,
string? argCulture,
string expectedOutput,
RunHost host,
string id)
{
Expand All @@ -62,25 +60,21 @@ public void ResourcesFromMainAssembly(BuildArgs buildArgs,
},
DotnetWasmFromRuntimePack: dotnetWasmFromRuntimePack));

string output = RunAndTestWasmApp(
buildArgs, expectedExitCode: 42,
args: argCulture,
host: host, id: id,
// check that downloading assets doesn't have timing race conditions
extraXHarnessMonoArgs: "--fetch-random-delay=200");

Assert.Contains(expectedOutput, output);
RunAndTestWasmApp(
buildArgs, expectedExitCode: 42,
args: argCulture,
host: host, id: id,
// check that downloading assets doesn't have timing race conditions
extraXHarnessMonoArgs: "--fetch-random-delay=200");
}

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ false, RunHost.All })]
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ true, RunHost.All })]
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ true, /*relinking*/ false, RunHost.All })]
public void ResourcesFromProjectReference(BuildArgs buildArgs,
bool nativeRelink,
string? argCulture,
string expectedOutput,
RunHost host,
string id)
{
Expand All @@ -107,12 +101,10 @@ public void ResourcesFromProjectReference(BuildArgs buildArgs,
CreateProgramForCultureTest(_projectDir, "LibraryWithResources.resx.words", "LibraryWithResources.Class1");
}));

string output = RunAndTestWasmApp(buildArgs,
expectedExitCode: 42,
args: argCulture,
host: host, id: id);

Assert.Contains(expectedOutput, output);
RunAndTestWasmApp(buildArgs,
expectedExitCode: 42,
args: argCulture,
host: host, id: id);
}

#pragma warning disable xUnit1026
Expand Down Expand Up @@ -180,20 +172,31 @@ public class TestClass
{
public static int Main(string[] args)
{
string expected;
if (args.Length == 1)
{
string cultureToTest = args[0];
var newCulture = new CultureInfo(cultureToTest);
Thread.CurrentThread.CurrentCulture = newCulture;
Thread.CurrentThread.CurrentUICulture = newCulture;

if (cultureToTest == ""es-ES"")
expected = ""hola"";
else if (cultureToTest == ""ja-JP"")
expected = ""\u3053\u3093\u306B\u3061\u306F"";
else
throw new Exception(""Cannot determine the expected output for {cultureToTest}"");

} else {
expected = ""hello"";
}

var currentCultureName = Thread.CurrentThread.CurrentCulture.Name;

var rm = new ResourceManager(""##RESOURCE_NAME##"", typeof(##TYPE_NAME##).Assembly);
Console.WriteLine($""For '{currentCultureName}' got: {rm.GetString(""hello"")}"");

return 42;
return rm.GetString(""hello"") == expected ? 42 : -1;
}
}
}";
Expand Down
2 changes: 0 additions & 2 deletions src/tests/BuildWasmApps/Wasm.Build.Tests/WasmBuildAppTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public WasmBuildAppTest(ITestOutputHelper output, SharedBuildPerTestClassFixture
{}

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true, RunHost.All })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false, RunHost.All })]
public void TopLevelMain(BuildArgs buildArgs, RunHost host, string id)
Expand All @@ -25,7 +24,6 @@ public void TopLevelMain(BuildArgs buildArgs, RunHost host, string id)
buildArgs, host, id);

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true, RunHost.All })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false, RunHost.All })]
public void AsyncMain(BuildArgs buildArgs, RunHost host, string id)
Expand Down