Skip to content

Commit

Permalink
test all RunHost
Browse files Browse the repository at this point in the history
The project format changes depending on the host, so projects with the same id cannot be used interchangeably.
Therefore, the project is re-created so that the test id changes, and the cache is also discarded.
  • Loading branch information
yamachu committed Jun 27, 2022
1 parent f41fd42 commit bac891e
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ public WasmRunOutOfAppBundleTests(ITestOutputHelper output, SharedBuildPerTestCl
.UnwrapItemsAsArrays();

[Theory]
// NOTE: V8 and Chrome now fail
// Ref: https://github.com/dotnet/runtime/issues/69259
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true, RunHost.NodeJS })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false, RunHost.V8 })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false, RunHost.Chrome })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false, RunHost.NodeJS })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true, RunHost.V8 })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true, RunHost.Chrome })]
[MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true, RunHost.NodeJS })]
public void RunOutOfAppBundle(BuildArgs buildArgs, RunHost host, string id)
{
buildArgs = buildArgs with { ProjectName = $"outofappbundle_{buildArgs.Config}_{buildArgs.AOT}" };
Expand All @@ -34,7 +36,8 @@ public void RunOutOfAppBundle(BuildArgs buildArgs, RunHost host, string id)
id: id,
new BuildProjectOptions(
InitProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), s_mainReturns42),
DotnetWasmFromRuntimePack: !(buildArgs.AOT || buildArgs.Config == "Release")));
DotnetWasmFromRuntimePack: !(buildArgs.AOT || buildArgs.Config == "Release"),
UseCache: false));

string binDir = GetBinDir(baseDir: _projectDir!, config: buildArgs.Config);
string baseBundleDir = Path.Combine(binDir, "AppBundle");
Expand All @@ -52,7 +55,7 @@ public void RunOutOfAppBundle(BuildArgs buildArgs, RunHost host, string id)
string indexHtmlPath = Path.Combine(baseBundleDir, "index.html");
if (!File.Exists(indexHtmlPath))
{
var html = @"<html><body><script type=""text/javascript"" src=""AppBundle/test-main.js""></script></body></html>";
var html = @"<html><body><script type=""module"" src=""AppBundle/test-main.js""></script></body></html>";
File.WriteAllText(indexHtmlPath, html);
}
}
Expand Down

0 comments on commit bac891e

Please sign in to comment.