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

All WasmBuildTests use static project from assets or dotnet new, unification of browser tests #109069

Merged
merged 109 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 106 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
8c91ed8
`ConfigSrcTests`, `BuildPublishTests` ready.
ilonatommy Oct 21, 2024
a451e4e
Fix WASI build errors - WASI is not prepared for making `BrowserStruc…
ilonatommy Oct 21, 2024
afd4d5c
Non-invariatn globalization WBT: done.
ilonatommy Oct 21, 2024
f2bb8ab
Missing change to previous commit.
ilonatommy Oct 21, 2024
cd4f94d
`InvariantGlobalizationTests` done
ilonatommy Oct 21, 2024
531a197
Missing change to icu tests.
ilonatommy Oct 21, 2024
d762fb6
`InvariantTimezoneTests` done
ilonatommy Oct 21, 2024
84d1df2
Draft of `MainWithArgsTests` - does not work.
ilonatommy Oct 22, 2024
43fbb6e
Consolidate Blazor and Browser app run methods.
ilonatommy Oct 22, 2024
58d2e43
`NativeBuildTests`: done.
ilonatommy Oct 22, 2024
2f03ff1
HybridGlobalization should be disabled till removal.
ilonatommy Oct 22, 2024
31b3239
`NativeLibraryTests`: done.
ilonatommy Oct 22, 2024
1d94cf9
Blocked `SkiaSharp` test has to get refactored as well to remove buil…
ilonatommy Oct 23, 2024
1e7bf92
Fix build errors in WASI - refactor of WASI in a future PR.
ilonatommy Oct 23, 2024
970468a
Project lib extension depends on `UseWebcil` value.
ilonatommy Oct 23, 2024
8ea5538
`NoopNativeRebuildTest`: done.
ilonatommy Oct 23, 2024
df091e7
Assert test run exit code.
ilonatommy Oct 23, 2024
2500064
ToDo: `NativeRebuildTests` that still require work.
ilonatommy Oct 23, 2024
0f502df
Merge `AppTestBase` with `WasmTemplateTestBase`.
ilonatommy Oct 24, 2024
f7f0041
NativeRelink cannot be false when it's forced by other property values.
ilonatommy Oct 25, 2024
309bd9a
Fix minor mistakes in refactoring.
ilonatommy Oct 25, 2024
fe7b988
`WasmBuildAppBase`: done but reading from config fails.
ilonatommy Oct 25, 2024
bb96e7d
`WorkloadTests`, `WasmTemplateTestsBase`, `WasmSIMDTests`, `WasmRunOu…
ilonatommy Oct 25, 2024
902f6d0
Correct typo in assets path + shorten.
ilonatommy Nov 1, 2024
c1dbde6
Fix binlog location.
ilonatommy Nov 1, 2024
e05d2aa
Fix `WasmNativeDefaultsTests`
ilonatommy Nov 1, 2024
7cbec74
Merge remote-tracking branch 'origin/main' into refactor-test-main-ba…
ilonatommy Nov 1, 2024
15860cf
Block tests that should get fixed later.
ilonatommy Nov 4, 2024
a0974c7
Correct a typo.
ilonatommy Nov 4, 2024
1f74ee2
Avoid AOT long path issues in scenario-based tests on Windows.
ilonatommy Nov 4, 2024
5cf34db
Missing file in arg rename.
ilonatommy Nov 4, 2024
b3b82c1
Workaround for interpreter issues.
ilonatommy Nov 4, 2024
1a0ea6e
Improve workaround.
ilonatommy Nov 5, 2024
10dd1ab
Avoid timeouts on Windows.
ilonatommy Nov 6, 2024
c8ef33d
Missing change for the previous commit.
ilonatommy Nov 6, 2024
bc444bf
`PInvokeTableGeneratorTests`: done (with two issues).
ilonatommy Nov 8, 2024
ce03481
Merge remote-tracking branch 'origin/main' into refactor-test-main-ba…
ilonatommy Nov 8, 2024
9a1fcfb
Merge branch 'main' into refactor-test-main-based-wbt
ilonatommy Nov 8, 2024
e63800e
`NonWasmTemplateBuildTests`: done
ilonatommy Nov 8, 2024
0279b78
`SatelliteAssembliesTests`: done
ilonatommy Nov 11, 2024
79c6963
`RebuildTests`: done. `TestMainJsTestBase` is not used anymore.
ilonatommy Nov 11, 2024
42aae42
`WasmTemplateTests`: done.
ilonatommy Nov 11, 2024
2f1fd89
`NativeBuildTests`: done
ilonatommy Nov 11, 2024
58d3563
Started unifying blazor methods. `AppsettingsTests`: done.
ilonatommy Nov 11, 2024
a1ccf58
Added blazor equivalent of `WasmBasicTestApp`. `Blazor.BuildPublishTe…
ilonatommy Nov 11, 2024
902030f
Some tests should stay disabled.
ilonatommy Nov 11, 2024
a52e09b
`Blazor.CleanTests`: done
ilonatommy Nov 12, 2024
ee9c355
`Blazor.MiscTests`: done
ilonatommy Nov 12, 2024
4684136
`Blazor.MiscTests2`" done.
ilonatommy Nov 12, 2024
96b0cff
`MiscTests3`: done. Debug with aot is not supported. Added library to…
ilonatommy Nov 12, 2024
ab894fe
`NativeTests`: done
ilonatommy Nov 12, 2024
d8762cc
`NativeTests`: uncomment.
ilonatommy Nov 12, 2024
f40cf8a
`NoopNativeRebuildTest`: done
ilonatommy Nov 12, 2024
5505603
`SimpleRunTests`: done
ilonatommy Nov 12, 2024
0af3355
`Blazor.WorkloadRequiredTests`: done
ilonatommy Nov 12, 2024
262ff89
`Blazor.SimpleMultiThreadedTests`: has issues with running after build.
ilonatommy Nov 12, 2024
ffab6a3
Update README.
ilonatommy Nov 14, 2024
4380a4a
Speedup NativeRebuild tests - they don't have to use dotnet new.
ilonatommy Nov 14, 2024
1c81cfe
Speed up BuildPublishTests.
ilonatommy Nov 14, 2024
04d395d
Remove methods that are not used anymore.
ilonatommy Nov 15, 2024
62f0f8c
Nit review changes.
ilonatommy Nov 15, 2024
99a6315
`BasicTestApp` for blazor and wasm.
ilonatommy Nov 15, 2024
9812930
Remove WASI build errors
ilonatommy Nov 15, 2024
75adae8
Fix: too many replacements.
ilonatommy Nov 18, 2024
18eb807
WIP with feedback - not building correctly yet
ilonatommy Nov 18, 2024
99d14a4
Follow up for feedback - fix the WIP commit.
ilonatommy Nov 28, 2024
54a3d82
Merge branch 'main' into refactor-test-main-based-wbt
ilonatommy Nov 28, 2024
565ad73
Feedback: non-nullable _projectDir.
ilonatommy Nov 28, 2024
e5abb4a
Fix wasi build.
ilonatommy Nov 28, 2024
f875a23
Feedback: cleanup `RunOptions`.
ilonatommy Nov 28, 2024
3360519
Fix `SimpleRunTests`.
ilonatommy Nov 29, 2024
53104ba
Fix `WasmTemplateTests`
ilonatommy Nov 29, 2024
456a6c9
Fix `InvariantGlobalizationTests`
ilonatommy Nov 29, 2024
5cdf29b
Fix `PInvokeTableGeneratorTests`
ilonatommy Nov 29, 2024
d26c17c
Fix `SatelliteAssembliesTests` and other test that require 3 states o…
ilonatommy Nov 29, 2024
160797b
Fix `SatelliteLoadingTests`
ilonatommy Nov 29, 2024
bd66cf1
`RebuildTests` fix after introducing figerprinting.
ilonatommy Nov 29, 2024
7d8690c
AOT: true fails. More investigation needed.
ilonatommy Nov 29, 2024
786ece3
`ReferenceNewAssemblyRebuildTest` fix. AOT: rue, more investigation n…
ilonatommy Nov 29, 2024
b479336
Fix no-worklod tests: 1) do not double-assert `AssertRuntimePackPath`…
ilonatommy Dec 2, 2024
188a274
Fix `NativeBuildTests` - AppBundle was not asserted here originally.
ilonatommy Dec 2, 2024
6a3e770
Fix `DefaultTemplate_AOT_InProjectFile`: AOT arg was missing.
ilonatommy Dec 2, 2024
46e83e7
Avoid double asserts.
ilonatommy Dec 2, 2024
c23f523
Fix expected file order.
ilonatommy Dec 2, 2024
c969abd
Revert 7d8690c72495e10323511bf27e0ca7dec0f0a94e#diff-39b3592b9f7579ad…
ilonatommy Dec 2, 2024
68c9299
Fix cases that keep NativeBuild undefined.
ilonatommy Dec 2, 2024
f90eb74
Fix `SatelliteAssembliesTests`: correct order of `ExpectedFileType`
ilonatommy Dec 2, 2024
2f945fd
`WasmGenerateAppBundle=false` when workloads used (set in workload ma…
ilonatommy Dec 2, 2024
333d8ce
Feedback: store all assets in `testAsset` class.
ilonatommy Dec 2, 2024
8914f9b
Fix `MainWithArgsTests`. Url query can have arg key duplicates -> is …
ilonatommy Dec 2, 2024
6de35c1
Fix `WasmBuildAppTest`
ilonatommy Dec 3, 2024
fafdfc0
AppBundle was never asserted for size in `OptimizationFlagChangeTests…
ilonatommy Dec 3, 2024
10a50ab
Reading from config is a known issue.
ilonatommy Dec 5, 2024
a3f19ad
Fix `SimpleSourceChangeRebuildTest`: pass AOT arg to build methods.
ilonatommy Dec 5, 2024
f86ed8d
Fix `OptimizationFlagChangeTests`: log when requested in the query.
ilonatommy Dec 5, 2024
410141a
Fix `FlagsChangeRebuildTests`.
ilonatommy Dec 6, 2024
f9503c7
Fix `ReferenceNewAssemblyRebuildTest`: Json lib was already reference…
ilonatommy Dec 6, 2024
9d153d6
Missing change to the previous commit.
ilonatommy Dec 6, 2024
25a614f
Keep blazor workload tests together.
ilonatommy Dec 6, 2024
61890b9
Fix: `PInvokeTableGeneratorTests` on Windows.
ilonatommy Dec 6, 2024
52c12b3
Move all no-workload blazor tests to one class.
ilonatommy Dec 6, 2024
b72048a
Use more meaningful name for `MiscTests3`.
ilonatommy Dec 6, 2024
6267705
`PInvokeTableGeneratorTests` takes 2-3 times more time than average W…
ilonatommy Dec 6, 2024
8307308
Disable test failing on Windows.
ilonatommy Dec 6, 2024
651aa6f
Block the timeouting test with exisiting issue.
ilonatommy Dec 9, 2024
3268520
Try avoiding port collisions in blazor tests run on kestrel.
ilonatommy Dec 9, 2024
c94e7dd
Feedback.
ilonatommy Dec 12, 2024
81d1dff
Merge remote-tracking branch 'origin/main' into refactor-test-main-ba…
ilonatommy Dec 12, 2024
2f6c3b9
Removal of files and comments that were supposed to be deleted after …
ilonatommy Dec 12, 2024
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
4 changes: 2 additions & 2 deletions eng/testing/scenarios/BuildWasmAppsJobsList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ Wasm.Build.Tests.Blazor.BuildPublishTests
Wasm.Build.Tests.Blazor.SimpleRunTests
Wasm.Build.Tests.Blazor.CleanTests
Wasm.Build.Tests.Blazor.MiscTests
Wasm.Build.Tests.Blazor.MiscTests2
Wasm.Build.Tests.Blazor.MiscTests3
Wasm.Build.Tests.Blazor.DllImportTests
Wasm.Build.Tests.Blazor.NativeTests
Wasm.Build.Tests.Blazor.NoopNativeRebuildTest
Wasm.Build.Tests.Blazor.WorkloadRequiredTests
Expand All @@ -20,6 +19,7 @@ Wasm.Build.Tests.Blazor.IcuShardingTests
Wasm.Build.Tests.Blazor.SignalRClientTests
Wasm.Build.Tests.BuildPublishTests
Wasm.Build.Tests.ConfigSrcTests
Wasm.Build.Tests.DllImportTests
Wasm.Build.Tests.HybridGlobalizationTests
Wasm.Build.Tests.IcuShardingTests
Wasm.Build.Tests.IcuShardingTests2
Expand Down
7 changes: 7 additions & 0 deletions src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,13 @@ public record BuildProjectOptions
string? TargetFramework = null,
IDictionary<string, string>? ExtraBuildEnvironmentVariables = null
);

public record AssertBundleOptions(
BuildProjectOptions BuildOptions,
bool ExpectSymbolsFile = true,
bool AssertIcuAssets = true,
bool AssertSymbolsFile = true
);

public enum NativeFilesType { FromRuntimePack, Relinked, AOT };
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#nullable enable

// ToDo: should be common with Wasm.Build.Tests, copied here after Wasm.Build.Tests refactoring
namespace Wasm.Build.Tests
{
public class SharedBuildPerTestClassFixture : IDisposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public SignalRClientTests(ITestOutputHelper output, SharedBuildPerTestClassFixtu

[ActiveIssue("https://github.com/dotnet/runtime/issues/106807")]
[ConditionalTheory(typeof(BuildTestBase), nameof(IsWorkloadWithMultiThreadingForDefaultFramework))]
[InlineData("Debug", "LongPolling")]
[InlineData("Release", "LongPolling")]
[InlineData("Debug", "WebSockets")]
[InlineData("Release", "WebSockets")]
public async Task SignalRPassMessageWasmBrowser(string config, string transport) =>
[InlineData(Configuration.Debug, "LongPolling")]
[InlineData(Configuration.Release, "LongPolling")]
[InlineData(Configuration.Debug, "WebSockets")]
[InlineData(Configuration.Release, "WebSockets")]
public async Task SignalRPassMessageWasmBrowser(Configuration config, string transport) =>
await SignalRPassMessage("wasmclient", config, transport);
}
52 changes: 24 additions & 28 deletions src/mono/wasm/Wasm.Build.Tests/Blazor/AppsettingsTests.cs
ilonatommy marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;
Expand All @@ -21,39 +22,34 @@ public AppsettingsTests(ITestOutputHelper output, SharedBuildPerTestClassFixture
[Fact]
public async Task FileInVfs()
{
string id = $"blazor_{GetRandomId()}";
string projectFile = CreateWasmTemplateProject(id, "blazorwasm");

string projectDirectory = Path.GetDirectoryName(projectFile)!;

File.WriteAllText(Path.Combine(projectDirectory, "wwwroot", "appsettings.json"), $"{{ \"Id\": \"{id}\" }}");

string programPath = Path.Combine(projectDirectory, "Program.cs");
string programContent = File.ReadAllText(programPath);
programContent = programContent.Replace("var builder",
"""
System.Console.WriteLine($"appSettings Exists '{File.Exists("/appsettings.json")}'");
System.Console.WriteLine($"appSettings Content '{File.ReadAllText("/appsettings.json")}'");
var builder
""");
File.WriteAllText(programPath, programContent);

BlazorBuild(new BlazorBuildOptions(id, "debug", NativeFilesType.FromRuntimePack));
Configuration config = Configuration.Debug;
ProjectInfo info = CreateWasmTemplateProject(Template.BlazorWasm, config, aot: false, "blazor");
UpdateHomePage();
string projectDirectory = Path.GetDirectoryName(info.ProjectFilePath)!;
File.WriteAllText(Path.Combine(projectDirectory, "wwwroot", "appsettings.json"), $"{{ \"Id\": \"{info.ProjectName}\" }}");
UpdateFile("Program.cs", new Dictionary<string, string>
{
{
"var builder",
"""
System.Console.WriteLine($"appSettings Exists '{File.Exists("/appsettings.json")}'");
System.Console.WriteLine($"appSettings Content '{File.ReadAllText("/appsettings.json")}'");
var builder
"""
}
});

(string _, string buildOutput) = BlazorBuild(info, config);
bool existsChecked = false;
bool contentChecked = false;

await BlazorRunForBuildWithDotnetRun(new BlazorRunOptions()
{
Config = "debug",
OnConsoleMessage = (_, msg) =>
{
if (msg.Text.Contains("appSettings Exists 'True'"))
await RunForBuildWithDotnetRun(new BlazorRunOptions(
config,
OnConsoleMessage: (_, msg) => {
if (msg.Contains("appSettings Exists 'True'"))
existsChecked = true;
else if (msg.Text.Contains($"appSettings Content '{{ \"Id\": \"{id}\" }}'"))
else if (msg.Contains($"appSettings Content '{{ \"Id\": \"{info.ProjectName}\" }}'"))
contentChecked = true;
}
});
}));

Assert.True(existsChecked, "File '/appsettings.json' wasn't found");
Assert.True(contentChecked, "Content of '/appsettings.json' is not matched");
Expand Down
25 changes: 0 additions & 25 deletions src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorBuildOptions.cs

This file was deleted.

64 changes: 47 additions & 17 deletions src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorRunOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,56 @@

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Microsoft.Playwright;

#nullable enable

namespace Wasm.Build.Tests.Blazor;
public record BlazorRunOptions
(
BlazorRunHost Host = BlazorRunHost.DotnetRun,
bool DetectRuntimeFailures = true,
bool CheckCounter = true,
Dictionary<string, string>? ServerEnvironment = null,
Func<IPage, Task>? Test = null,
Action<IPage, IConsoleMessage>? OnConsoleMessage = null,
Action<string>? OnServerMessage = null,
Action<string>? OnErrorMessage = null,
string Config = "Debug",
string? ExtraArgs = null,
string BrowserPath = "",
string QueryString = ""
);
namespace Wasm.Build.Tests;
public record BlazorRunOptions : RunOptions
{
public bool CheckCounter { get; init; }
public Func<IPage, Task>? Test { get; init; }

public BlazorRunOptions(
Configuration Configuration,
bool AOT = false,
RunHost Host = RunHost.DotnetRun,
bool DetectRuntimeFailures = true,
Dictionary<string, string>? ServerEnvironment = null,
NameValueCollection? BrowserQueryString = null,
Action<string, string>? OnConsoleMessage = null,
Action<string>? OnServerMessage = null,
Action<string>? OnErrorMessage = null,
string ExtraArgs = "",
string BrowserPath = "",
string Locale = "en-US",
int? ExpectedExitCode = 0,
string CustomBundleDir = "",
bool CheckCounter = true,
Func<IPage, Task>? Test = null,
Func<RunOptions, IPage, Task>? ExecuteAfterLoaded = null
) : base(
Configuration,
AOT,
Host,
DetectRuntimeFailures,
ServerEnvironment,
BrowserQueryString,
OnConsoleMessage,
OnServerMessage,
OnErrorMessage,
ExtraArgs,
BrowserPath,
Locale,
ExpectedExitCode,
CustomBundleDir,
ExecuteAfterLoaded
)
{
this.CheckCounter = CheckCounter;
this.Test = Test;
}
}

public enum BlazorRunHost { DotnetRun, WebServer };

This file was deleted.

Loading
Loading