Skip to content

Commit 367193d

Browse files
authored
[wasm] Enable some previously failing WBT/AOT tests on windows (#70595)
* [wasm] Enable some previously failing WBT/AOT tests on windows Fixes #61725 . * [wasm] WBT: Fix a failing satellite assembly test The test fails because it is trying to find the string `got: こんにちは` in the app output, but it sees `?????`. This is due to xharness not setting the console output to UTF8, and then the tests not doing the same. Instead of that, we can move the check to be in the app itself, thus removing the need for any of this. Fixes #58709 .
1 parent 731c262 commit 367193d

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

src/tests/BuildWasmApps/Wasm.Build.Tests/MainWithArgsTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public MainWithArgsTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur
2525
).WithRunHosts(host).UnwrapItemsAsArrays();
2626

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

4241
[Theory]
43-
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
4442
[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ false, RunHost.All })]
4543
[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ true, RunHost.All })]
4644
public void TopLevelWithArgs(BuildArgs buildArgs, string[] args, RunHost host, string id)

src/tests/BuildWasmApps/Wasm.Build.Tests/NativeRebuildTests/ReferenceNewAssemblyRebuildTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public ReferenceNewAssemblyRebuildTest(ITestOutputHelper output, SharedBuildPerT
2020
}
2121

2222
[Theory]
23-
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
2423
[MemberData(nameof(NativeBuildData))]
2524
public void ReferenceNewAssembly(BuildArgs buildArgs, bool nativeRelink, bool invariant, RunHost host, string id)
2625
{

src/tests/BuildWasmApps/Wasm.Build.Tests/SatelliteAssembliesTests.cs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,19 @@ public SatelliteAssembliesTests(ITestOutputHelper output, SharedBuildPerTestClas
2222
public static IEnumerable<object?[]> SatelliteAssemblyTestData(bool aot, bool relinking, RunHost host)
2323
=> ConfigWithAOTData(aot)
2424
.Multiply(
25-
new object?[] { relinking, "es-ES", "got: hola" },
26-
new object?[] { relinking, null, "got: hello" },
27-
new object?[] { relinking, "ja-JP", "got: \u3053\u3093\u306B\u3061\u306F" })
25+
new object?[] { relinking, "es-ES" },
26+
new object?[] { relinking, null },
27+
new object?[] { relinking, "ja-JP" })
2828
.WithRunHosts(host)
2929
.UnwrapItemsAsArrays();
3030

3131
[Theory]
32-
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
3332
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ false, RunHost.All })]
3433
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ true, RunHost.All })]
3534
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ true, /*relinking*/ false, RunHost.All })]
3635
public void ResourcesFromMainAssembly(BuildArgs buildArgs,
3736
bool nativeRelink,
3837
string? argCulture,
39-
string expectedOutput,
4038
RunHost host,
4139
string id)
4240
{
@@ -62,25 +60,21 @@ public void ResourcesFromMainAssembly(BuildArgs buildArgs,
6260
},
6361
DotnetWasmFromRuntimePack: dotnetWasmFromRuntimePack));
6462

65-
string output = RunAndTestWasmApp(
66-
buildArgs, expectedExitCode: 42,
67-
args: argCulture,
68-
host: host, id: id,
69-
// check that downloading assets doesn't have timing race conditions
70-
extraXHarnessMonoArgs: "--fetch-random-delay=200");
71-
72-
Assert.Contains(expectedOutput, output);
63+
RunAndTestWasmApp(
64+
buildArgs, expectedExitCode: 42,
65+
args: argCulture,
66+
host: host, id: id,
67+
// check that downloading assets doesn't have timing race conditions
68+
extraXHarnessMonoArgs: "--fetch-random-delay=200");
7369
}
7470

7571
[Theory]
76-
[ActiveIssue("https://github.com/dotnet/runtime/issues/61725", TestPlatforms.Windows)]
7772
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ false, RunHost.All })]
7873
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ true, RunHost.All })]
7974
[MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ true, /*relinking*/ false, RunHost.All })]
8075
public void ResourcesFromProjectReference(BuildArgs buildArgs,
8176
bool nativeRelink,
8277
string? argCulture,
83-
string expectedOutput,
8478
RunHost host,
8579
string id)
8680
{
@@ -107,12 +101,10 @@ public void ResourcesFromProjectReference(BuildArgs buildArgs,
107101
CreateProgramForCultureTest(_projectDir, "LibraryWithResources.resx.words", "LibraryWithResources.Class1");
108102
}));
109103

110-
string output = RunAndTestWasmApp(buildArgs,
111-
expectedExitCode: 42,
112-
args: argCulture,
113-
host: host, id: id);
114-
115-
Assert.Contains(expectedOutput, output);
104+
RunAndTestWasmApp(buildArgs,
105+
expectedExitCode: 42,
106+
args: argCulture,
107+
host: host, id: id);
116108
}
117109

118110
#pragma warning disable xUnit1026
@@ -180,20 +172,31 @@ public class TestClass
180172
{
181173
public static int Main(string[] args)
182174
{
175+
string expected;
183176
if (args.Length == 1)
184177
{
185178
string cultureToTest = args[0];
186179
var newCulture = new CultureInfo(cultureToTest);
187180
Thread.CurrentThread.CurrentCulture = newCulture;
188181
Thread.CurrentThread.CurrentUICulture = newCulture;
182+
183+
if (cultureToTest == ""es-ES"")
184+
expected = ""hola"";
185+
else if (cultureToTest == ""ja-JP"")
186+
expected = ""\u3053\u3093\u306B\u3061\u306F"";
187+
else
188+
throw new Exception(""Cannot determine the expected output for {cultureToTest}"");
189+
190+
} else {
191+
expected = ""hello"";
189192
}
190193
191194
var currentCultureName = Thread.CurrentThread.CurrentCulture.Name;
192195
193196
var rm = new ResourceManager(""##RESOURCE_NAME##"", typeof(##TYPE_NAME##).Assembly);
194197
Console.WriteLine($""For '{currentCultureName}' got: {rm.GetString(""hello"")}"");
195198
196-
return 42;
199+
return rm.GetString(""hello"") == expected ? 42 : -1;
197200
}
198201
}
199202
}";

src/tests/BuildWasmApps/Wasm.Build.Tests/WasmBuildAppTest.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public WasmBuildAppTest(ITestOutputHelper output, SharedBuildPerTestClassFixture
1616
{}
1717

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

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

0 commit comments

Comments
 (0)