From eae5a38799f6e925837f78df1916a557fc33b25d Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 22 Jan 2025 17:33:08 +0100 Subject: [PATCH 01/11] Test the failure on CI. --- .../scenarios/BuildWasmAppsJobsList.txt | 49 +------------------ .../Wasm.Build.Tests/Blazor/DllImportTests.cs | 13 ++--- 2 files changed, 5 insertions(+), 57 deletions(-) diff --git a/eng/testing/scenarios/BuildWasmAppsJobsList.txt b/eng/testing/scenarios/BuildWasmAppsJobsList.txt index 8df77ea901da48..8582f47b3bebf4 100644 --- a/eng/testing/scenarios/BuildWasmAppsJobsList.txt +++ b/eng/testing/scenarios/BuildWasmAppsJobsList.txt @@ -1,48 +1 @@ -Wasm.Build.NativeRebuild.Tests.FlagsChangeRebuildTests -Wasm.Build.NativeRebuild.Tests.NoopNativeRebuildTest -Wasm.Build.NativeRebuild.Tests.OptimizationFlagChangeTests -Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest -Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest -Wasm.Build.Tests.InterpPgoTests -Wasm.Build.Templates.Tests.NativeBuildTests -Wasm.Build.Tests.Blazor.AppsettingsTests -Wasm.Build.Tests.Blazor.BuildPublishTests -Wasm.Build.Tests.Blazor.SimpleRunTests -Wasm.Build.Tests.Blazor.CleanTests -Wasm.Build.Tests.Blazor.MiscTests -Wasm.Build.Tests.Blazor.DllImportTests -Wasm.Build.Tests.Blazor.NativeTests -Wasm.Build.Tests.Blazor.NoopNativeRebuildTest -Wasm.Build.Tests.Blazor.WorkloadRequiredTests -Wasm.Build.Tests.Blazor.SignalRClientTests -Wasm.Build.Tests.BuildPublishTests -Wasm.Build.Tests.ConfigSrcTests -Wasm.Build.Tests.DllImportTests -Wasm.Build.Tests.IcuShardingTests -Wasm.Build.Tests.IcuShardingTests2 -Wasm.Build.Tests.IcuTests -Wasm.Build.Tests.InvariantGlobalizationTests -Wasm.Build.Tests.InvariantTimezoneTests -Wasm.Build.Tests.MainWithArgsTests -Wasm.Build.Tests.NativeBuildTests -Wasm.Build.Tests.NativeLibraryTests -Wasm.Build.Tests.NonWasmTemplateBuildTests -Wasm.Build.Tests.PInvokeTableGeneratorTests -Wasm.Build.Tests.RebuildTests -Wasm.Build.Tests.SatelliteAssembliesTests -Wasm.Build.Tests.AppSettingsTests -Wasm.Build.Tests.DownloadThenInitTests -Wasm.Build.Tests.LazyLoadingTests -Wasm.Build.Tests.LibraryInitializerTests -Wasm.Build.Tests.SatelliteLoadingTests -Wasm.Build.Tests.ModuleConfigTests -Wasm.Build.Tests.MemoryTests -Wasm.Build.Tests.AspNetCore.SignalRClientTests -Wasm.Build.Tests.WasmBuildAppTest -Wasm.Build.Tests.WasmNativeDefaultsTests -Wasm.Build.Tests.WasmRunOutOfAppBundleTests -Wasm.Build.Tests.WasmSIMDTests -Wasm.Build.Tests.WasmTemplateTests -Wasm.Build.Tests.WorkloadTests -Wasm.Build.Tests.MT.Blazor.SimpleMultiThreadedTests -Wasm.Build.Tests.DebugLevelTests +Wasm.Build.Tests.Blazor.DllImportTests \ No newline at end of file diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index 48cb35d332c9a2..01ee798709520a 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -26,15 +26,10 @@ public DllImportTests(ITestOutputHelper output, SharedBuildPerTestClassFixture b public static TheoryData DllImportTheoryData() { var data = new TheoryData(); - data.Add(Configuration.Debug, /*build*/true, /*publish*/false); - data.Add(Configuration.Release, /*build*/true, /*publish*/false); - data.Add(Configuration.Release, /*build*/false, /*publish*/true); - - // ActiveIssue("https://github.com/dotnet/runtime/issues/110482") - if (!s_isWindows) - { - data.Add(Configuration.Release, /*build*/true, /*publish*/true); - } + // data.Add(Configuration.Debug, /*build*/true, /*publish*/false); + // data.Add(Configuration.Release, /*build*/true, /*publish*/false); + // data.Add(Configuration.Release, /*build*/false, /*publish*/true); + data.Add(Configuration.Release, /*build*/true, /*publish*/true); return data; } From 0bab206b15e18844a213a3b45d06d903196e1159 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 23 Jan 2025 10:50:03 +0100 Subject: [PATCH 02/11] Remove spaces, test only unicodes. --- src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs index 0b71e4d663015e..409d0275359c59 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs @@ -32,7 +32,7 @@ public class BuildEnvironment public static readonly string RelativeTestAssetsPath = @"..\testassets\"; public static readonly string TestAssetsPath = Path.Combine(AppContext.BaseDirectory, "testassets"); public static readonly string TestDataPath = Path.Combine(AppContext.BaseDirectory, "data"); - public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt artifacts"); + public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt-artifacts"); public static readonly string DefaultRuntimeIdentifier = #if TARGET_WASI From 3945c587c3b4c8beec08326ae27b24c30812eaa8 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 23 Jan 2025 12:14:06 +0100 Subject: [PATCH 03/11] Revert spaces. Log `LongPathEnabled`. --- .../Wasm.Build.Tests/Blazor/DllImportTests.cs | 27 +++++++++++++++++++ .../Common/BuildEnvironment.cs | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index 01ee798709520a..e4fde6c96032c6 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -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; using System.Collections.Generic; using System.IO; using System.Linq; @@ -10,6 +11,7 @@ using Xunit.Abstractions; using Xunit.Sdk; using Microsoft.Playwright; +using Microsoft.Win32; #nullable enable @@ -37,6 +39,11 @@ public static TheoryData DllImportTheoryData() [MemberData(nameof(DllImportTheoryData))] public async Task WithDllImportInMainAssembly(Configuration config, bool build, bool publish) { + if (s_isWindows) + { + bool isLongPathEnabled = IsLongPathEnabled(); + Console.WriteLine($"WINDOWS: long path enabled -> {isLongPathEnabled}"); + } // Based on https://github.com/dotnet/runtime/issues/59255 string prefix = $"blz_dllimp_{config}_{s_unicodeChars}"; if (build && publish) @@ -76,6 +83,26 @@ async Task TestDllImport(IPage page) } } + public static bool IsLongPathEnabled() + { + const string keyPath = @"SYSTEM\CurrentControlSet\Control\FileSystem"; + const string valueName = "LongPathsEnabled"; + + using (RegistryKey? key = Registry.LocalMachine.OpenSubKey(keyPath)) + { + if (key != null) + { + object? value = key?.GetValue(valueName); + if (value is int intValue) + { + return intValue == 1; + } + } + } + + return false; + } + private void BlazorAddRazorButton(string buttonText, string customCode, string methodName = "test") => UpdateFile(Path.Combine("Pages", "Counter.razor"), new Dictionary { { diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs index 409d0275359c59..0b71e4d663015e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs @@ -32,7 +32,7 @@ public class BuildEnvironment public static readonly string RelativeTestAssetsPath = @"..\testassets\"; public static readonly string TestAssetsPath = Path.Combine(AppContext.BaseDirectory, "testassets"); public static readonly string TestDataPath = Path.Combine(AppContext.BaseDirectory, "data"); - public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt-artifacts"); + public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt artifacts"); public static readonly string DefaultRuntimeIdentifier = #if TARGET_WASI From 76897d15c518d4228dfdb620af61d702a8984071 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 23 Jan 2025 12:41:41 +0100 Subject: [PATCH 04/11] Reduce tests run during investigation: remove WASI. --- eng/pipelines/common/platform-matrix.yml | 80 ++++++++++++------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 913b47c0cabb85..2413001a4059e7 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -459,46 +459,46 @@ jobs: crossBuild: true ${{ insert }}: ${{ parameters.jobParameters }} -# WASI WebAssembly - -- ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: wasi - archType: wasm - targetRid: wasi-wasm - platform: wasi_wasm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: wasi_wasm - jobParameters: - hostedOs: linux - runtimeFlavor: ${{ parameters.runtimeFlavor }} - stagedBuild: ${{ parameters.stagedBuild }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# WASI WebAssembly windows - -- ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: wasi - archType: wasm - targetRid: wasi-wasm - platform: wasi_wasm_win - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - hostedOs: windows - runtimeFlavor: ${{ parameters.runtimeFlavor }} - stagedBuild: ${{ parameters.stagedBuild }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} +# # WASI WebAssembly + +# - ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}: +# - template: xplat-setup.yml +# parameters: +# jobTemplate: ${{ parameters.jobTemplate }} +# helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} +# variables: ${{ parameters.variables }} +# osGroup: wasi +# archType: wasm +# targetRid: wasi-wasm +# platform: wasi_wasm +# shouldContinueOnError: ${{ parameters.shouldContinueOnError }} +# container: wasi_wasm +# jobParameters: +# hostedOs: linux +# runtimeFlavor: ${{ parameters.runtimeFlavor }} +# stagedBuild: ${{ parameters.stagedBuild }} +# buildConfig: ${{ parameters.buildConfig }} +# ${{ insert }}: ${{ parameters.jobParameters }} + +# # WASI WebAssembly windows + +# - ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: +# - template: xplat-setup.yml +# parameters: +# jobTemplate: ${{ parameters.jobTemplate }} +# helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} +# variables: ${{ parameters.variables }} +# osGroup: wasi +# archType: wasm +# targetRid: wasi-wasm +# platform: wasi_wasm_win +# shouldContinueOnError: ${{ parameters.shouldContinueOnError }} +# jobParameters: +# hostedOs: windows +# runtimeFlavor: ${{ parameters.runtimeFlavor }} +# stagedBuild: ${{ parameters.stagedBuild }} +# buildConfig: ${{ parameters.buildConfig }} +# ${{ insert }}: ${{ parameters.jobParameters }} # Browser WebAssembly From 3d2a2774f3a4c816b2f756e4bb59d47d415649a0 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 23 Jan 2025 15:55:04 +0100 Subject: [PATCH 05/11] Don't let the test fail to make the long path var visible, --- src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index e4fde6c96032c6..d81a127f375d84 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -39,10 +39,12 @@ public static TheoryData DllImportTheoryData() [MemberData(nameof(DllImportTheoryData))] public async Task WithDllImportInMainAssembly(Configuration config, bool build, bool publish) { + Console.WriteLine($"isWindows?: {s_isWindows}"); if (s_isWindows) { bool isLongPathEnabled = IsLongPathEnabled(); Console.WriteLine($"WINDOWS: long path enabled -> {isLongPathEnabled}"); + return; } // Based on https://github.com/dotnet/runtime/issues/59255 string prefix = $"blz_dllimp_{config}_{s_unicodeChars}"; From 10731aaef895ca4e56f4e6f27f6b2bc94e4ce2b4 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 24 Jan 2025 11:29:52 +0100 Subject: [PATCH 06/11] Console log is not visible either, change to exception. --- .../Wasm.Build.Tests/Blazor/DllImportTests.cs | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index d81a127f375d84..d2b2ee05f2526e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -37,52 +37,52 @@ public static TheoryData DllImportTheoryData() [Theory] [MemberData(nameof(DllImportTheoryData))] - public async Task WithDllImportInMainAssembly(Configuration config, bool build, bool publish) + public void WithDllImportInMainAssembly(Configuration config, bool build, bool publish) { - Console.WriteLine($"isWindows?: {s_isWindows}"); + string output = $"isWindows?: {s_isWindows}, config={config}, build={build}, publish={publish}"; if (s_isWindows) { bool isLongPathEnabled = IsLongPathEnabled(); - Console.WriteLine($"WINDOWS: long path enabled -> {isLongPathEnabled}"); - return; + output += $"long path enabled -> {isLongPathEnabled}"; } - // Based on https://github.com/dotnet/runtime/issues/59255 - string prefix = $"blz_dllimp_{config}_{s_unicodeChars}"; - if (build && publish) - prefix += "build_then_publish"; - else if (build) - prefix += "build"; - else - prefix += "publish"; - string extraItems = @""; - ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.BlazorBasicTestApp, prefix, extraItems: extraItems); - File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "MyDllImport.cs"), Path.Combine(_projectDir, "Pages", "MyDllImport.cs")); - File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "native-libs", "mylib.cpp"), Path.Combine(_projectDir, "mylib.cpp")); - UpdateFile(Path.Combine("Pages", "MyDllImport.cs"), new Dictionary { { "##NAMESPACE##", info.ProjectName } }); + throw new Exception(output); + // // Based on https://github.com/dotnet/runtime/issues/59255 + // string prefix = $"blz_dllimp_{config}_{s_unicodeChars}"; + // if (build && publish) + // prefix += "build_then_publish"; + // else if (build) + // prefix += "build"; + // else + // prefix += "publish"; + // string extraItems = @""; + // ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.BlazorBasicTestApp, prefix, extraItems: extraItems); + // File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "MyDllImport.cs"), Path.Combine(_projectDir, "Pages", "MyDllImport.cs")); + // File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "native-libs", "mylib.cpp"), Path.Combine(_projectDir, "mylib.cpp")); + // UpdateFile(Path.Combine("Pages", "MyDllImport.cs"), new Dictionary { { "##NAMESPACE##", info.ProjectName } }); - BlazorAddRazorButton("cpp_add", """ - var result = MyDllImports.cpp_add(10, 12); - outputText = $"{result}"; - """); + // BlazorAddRazorButton("cpp_add", """ + // var result = MyDllImports.cpp_add(10, 12); + // outputText = $"{result}"; + // """); - if (build) - BlazorBuild(info, config, isNativeBuild: true); + // if (build) + // BlazorBuild(info, config, isNativeBuild: true); - if (publish) - BlazorPublish(info, config, new PublishOptions(UseCache: false), isNativeBuild: true); + // if (publish) + // BlazorPublish(info, config, new PublishOptions(UseCache: false), isNativeBuild: true); - BlazorRunOptions runOptions = new(config, Test: TestDllImport); - if (publish) - await RunForPublishWithWebServer(runOptions); - else - await RunForBuildWithDotnetRun(runOptions); + // BlazorRunOptions runOptions = new(config, Test: TestDllImport); + // if (publish) + // await RunForPublishWithWebServer(runOptions); + // else + // await RunForBuildWithDotnetRun(runOptions); - async Task TestDllImport(IPage page) - { - await page.Locator("text=\"cpp_add\"").ClickAsync(); - var txt = await page.Locator("p[role='test']").InnerHTMLAsync(); - Assert.Equal("Output: 22", txt); - } + // async Task TestDllImport(IPage page) + // { + // await page.Locator("text=\"cpp_add\"").ClickAsync(); + // var txt = await page.Locator("p[role='test']").InnerHTMLAsync(); + // Assert.Equal("Output: 22", txt); + // } } public static bool IsLongPathEnabled() From d76497781e7bb2974f35e8d198ad4a6b9a6c21c3 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 24 Jan 2025 13:29:59 +0100 Subject: [PATCH 07/11] Revert investigative changes. Shorten the path by 4 chars. --- eng/pipelines/common/platform-matrix.yml | 80 +++++++++---------- .../scenarios/BuildWasmAppsJobsList.txt | 49 +++++++++++- .../Wasm.Build.Tests/Blazor/DllImportTests.cs | 77 ++++++++---------- 3 files changed, 123 insertions(+), 83 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 2413001a4059e7..913b47c0cabb85 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -459,46 +459,46 @@ jobs: crossBuild: true ${{ insert }}: ${{ parameters.jobParameters }} -# # WASI WebAssembly - -# - ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}: -# - template: xplat-setup.yml -# parameters: -# jobTemplate: ${{ parameters.jobTemplate }} -# helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} -# variables: ${{ parameters.variables }} -# osGroup: wasi -# archType: wasm -# targetRid: wasi-wasm -# platform: wasi_wasm -# shouldContinueOnError: ${{ parameters.shouldContinueOnError }} -# container: wasi_wasm -# jobParameters: -# hostedOs: linux -# runtimeFlavor: ${{ parameters.runtimeFlavor }} -# stagedBuild: ${{ parameters.stagedBuild }} -# buildConfig: ${{ parameters.buildConfig }} -# ${{ insert }}: ${{ parameters.jobParameters }} - -# # WASI WebAssembly windows - -# - ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: -# - template: xplat-setup.yml -# parameters: -# jobTemplate: ${{ parameters.jobTemplate }} -# helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} -# variables: ${{ parameters.variables }} -# osGroup: wasi -# archType: wasm -# targetRid: wasi-wasm -# platform: wasi_wasm_win -# shouldContinueOnError: ${{ parameters.shouldContinueOnError }} -# jobParameters: -# hostedOs: windows -# runtimeFlavor: ${{ parameters.runtimeFlavor }} -# stagedBuild: ${{ parameters.stagedBuild }} -# buildConfig: ${{ parameters.buildConfig }} -# ${{ insert }}: ${{ parameters.jobParameters }} +# WASI WebAssembly + +- ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + container: wasi_wasm + jobParameters: + hostedOs: linux + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} + +# WASI WebAssembly windows + +- ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} # Browser WebAssembly diff --git a/eng/testing/scenarios/BuildWasmAppsJobsList.txt b/eng/testing/scenarios/BuildWasmAppsJobsList.txt index 8582f47b3bebf4..b8b0429651605f 100644 --- a/eng/testing/scenarios/BuildWasmAppsJobsList.txt +++ b/eng/testing/scenarios/BuildWasmAppsJobsList.txt @@ -1 +1,48 @@ -Wasm.Build.Tests.Blazor.DllImportTests \ No newline at end of file +Wasm.Build.NativeRebuild.Tests.FlagsChangeRebuildTests +Wasm.Build.NativeRebuild.Tests.NoopNativeRebuildTest +Wasm.Build.NativeRebuild.Tests.OptimizationFlagChangeTests +Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest +Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest +Wasm.Build.Tests.InterpPgoTests +Wasm.Build.Templates.Tests.NativeBuildTests +Wasm.Build.Tests.Blazor.AppsettingsTests +Wasm.Build.Tests.Blazor.BuildPublishTests +Wasm.Build.Tests.Blazor.SimpleRunTests +Wasm.Build.Tests.Blazor.CleanTests +Wasm.Build.Tests.Blazor.MiscTests +Wasm.Build.Tests.Blazor.DllImportTests +Wasm.Build.Tests.Blazor.NativeTests +Wasm.Build.Tests.Blazor.NoopNativeRebuildTest +Wasm.Build.Tests.Blazor.WorkloadRequiredTests +Wasm.Build.Tests.Blazor.SignalRClientTests +Wasm.Build.Tests.BuildPublishTests +Wasm.Build.Tests.ConfigSrcTests +Wasm.Build.Tests.DllImportTests +Wasm.Build.Tests.IcuShardingTests +Wasm.Build.Tests.IcuShardingTests2 +Wasm.Build.Tests.IcuTests +Wasm.Build.Tests.InvariantGlobalizationTests +Wasm.Build.Tests.InvariantTimezoneTests +Wasm.Build.Tests.MainWithArgsTests +Wasm.Build.Tests.NativeBuildTests +Wasm.Build.Tests.NativeLibraryTests +Wasm.Build.Tests.NonWasmTemplateBuildTests +Wasm.Build.Tests.PInvokeTableGeneratorTests +Wasm.Build.Tests.RebuildTests +Wasm.Build.Tests.SatelliteAssembliesTests +Wasm.Build.Tests.AppSettingsTests +Wasm.Build.Tests.DownloadThenInitTests +Wasm.Build.Tests.LazyLoadingTests +Wasm.Build.Tests.LibraryInitializerTests +Wasm.Build.Tests.SatelliteLoadingTests +Wasm.Build.Tests.ModuleConfigTests +Wasm.Build.Tests.MemoryTests +Wasm.Build.Tests.AspNetCore.SignalRClientTests +Wasm.Build.Tests.WasmBuildAppTest +Wasm.Build.Tests.WasmNativeDefaultsTests +Wasm.Build.Tests.WasmRunOutOfAppBundleTests +Wasm.Build.Tests.WasmSIMDTests +Wasm.Build.Tests.WasmTemplateTests +Wasm.Build.Tests.WorkloadTests +Wasm.Build.Tests.MT.Blazor.SimpleMultiThreadedTests +Wasm.Build.Tests.DebugLevelTests \ No newline at end of file diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index d2b2ee05f2526e..c58a23f4c59248 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -28,9 +28,9 @@ public DllImportTests(ITestOutputHelper output, SharedBuildPerTestClassFixture b public static TheoryData DllImportTheoryData() { var data = new TheoryData(); - // data.Add(Configuration.Debug, /*build*/true, /*publish*/false); - // data.Add(Configuration.Release, /*build*/true, /*publish*/false); - // data.Add(Configuration.Release, /*build*/false, /*publish*/true); + data.Add(Configuration.Debug, /*build*/true, /*publish*/false); + data.Add(Configuration.Release, /*build*/true, /*publish*/false); + data.Add(Configuration.Release, /*build*/false, /*publish*/true); data.Add(Configuration.Release, /*build*/true, /*publish*/true); return data; } @@ -39,50 +39,43 @@ public static TheoryData DllImportTheoryData() [MemberData(nameof(DllImportTheoryData))] public void WithDllImportInMainAssembly(Configuration config, bool build, bool publish) { - string output = $"isWindows?: {s_isWindows}, config={config}, build={build}, publish={publish}"; - if (s_isWindows) - { - bool isLongPathEnabled = IsLongPathEnabled(); - output += $"long path enabled -> {isLongPathEnabled}"; - } - throw new Exception(output); - // // Based on https://github.com/dotnet/runtime/issues/59255 - // string prefix = $"blz_dllimp_{config}_{s_unicodeChars}"; - // if (build && publish) - // prefix += "build_then_publish"; - // else if (build) - // prefix += "build"; - // else - // prefix += "publish"; - // string extraItems = @""; - // ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.BlazorBasicTestApp, prefix, extraItems: extraItems); - // File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "MyDllImport.cs"), Path.Combine(_projectDir, "Pages", "MyDllImport.cs")); - // File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "native-libs", "mylib.cpp"), Path.Combine(_projectDir, "mylib.cpp")); - // UpdateFile(Path.Combine("Pages", "MyDllImport.cs"), new Dictionary { { "##NAMESPACE##", info.ProjectName } }); + // Based on https://github.com/dotnet/runtime/issues/59255 + string prefix = $"dllimp_{config}_{s_unicodeChars}"; + if (build && publish) + prefix += "build_then_publish"; + else if (build) + prefix += "build"; + else + prefix += "publish"; + string extraItems = @""; + ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.BlazorBasicTestApp, prefix, extraItems: extraItems); + File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "MyDllImport.cs"), Path.Combine(_projectDir, "Pages", "MyDllImport.cs")); + File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "native-libs", "mylib.cpp"), Path.Combine(_projectDir, "mylib.cpp")); + UpdateFile(Path.Combine("Pages", "MyDllImport.cs"), new Dictionary { { "##NAMESPACE##", info.ProjectName } }); - // BlazorAddRazorButton("cpp_add", """ - // var result = MyDllImports.cpp_add(10, 12); - // outputText = $"{result}"; - // """); + BlazorAddRazorButton("cpp_add", """ + var result = MyDllImports.cpp_add(10, 12); + outputText = $"{result}"; + """); - // if (build) - // BlazorBuild(info, config, isNativeBuild: true); + if (build) + BlazorBuild(info, config, isNativeBuild: true); - // if (publish) - // BlazorPublish(info, config, new PublishOptions(UseCache: false), isNativeBuild: true); + if (publish) + BlazorPublish(info, config, new PublishOptions(UseCache: false), isNativeBuild: true); - // BlazorRunOptions runOptions = new(config, Test: TestDllImport); - // if (publish) - // await RunForPublishWithWebServer(runOptions); - // else - // await RunForBuildWithDotnetRun(runOptions); + BlazorRunOptions runOptions = new(config, Test: TestDllImport); + if (publish) + await RunForPublishWithWebServer(runOptions); + else + await RunForBuildWithDotnetRun(runOptions); - // async Task TestDllImport(IPage page) - // { - // await page.Locator("text=\"cpp_add\"").ClickAsync(); - // var txt = await page.Locator("p[role='test']").InnerHTMLAsync(); - // Assert.Equal("Output: 22", txt); - // } + async Task TestDllImport(IPage page) + { + await page.Locator("text=\"cpp_add\"").ClickAsync(); + var txt = await page.Locator("p[role='test']").InnerHTMLAsync(); + Assert.Equal("Output: 22", txt); + } } public static bool IsLongPathEnabled() From 3ec3b98ccafadc2587c333141e938ac0be6756f7 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 24 Jan 2025 13:31:23 +0100 Subject: [PATCH 08/11] Space --- eng/testing/scenarios/BuildWasmAppsJobsList.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/testing/scenarios/BuildWasmAppsJobsList.txt b/eng/testing/scenarios/BuildWasmAppsJobsList.txt index b8b0429651605f..8df77ea901da48 100644 --- a/eng/testing/scenarios/BuildWasmAppsJobsList.txt +++ b/eng/testing/scenarios/BuildWasmAppsJobsList.txt @@ -45,4 +45,4 @@ Wasm.Build.Tests.WasmSIMDTests Wasm.Build.Tests.WasmTemplateTests Wasm.Build.Tests.WorkloadTests Wasm.Build.Tests.MT.Blazor.SimpleMultiThreadedTests -Wasm.Build.Tests.DebugLevelTests \ No newline at end of file +Wasm.Build.Tests.DebugLevelTests From 2ccc9368c81102b8528d5f971a578b037ae0decc Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 24 Jan 2025 13:31:46 +0100 Subject: [PATCH 09/11] Cleanup. --- src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index c58a23f4c59248..2f504a6aec54be 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -11,7 +10,6 @@ using Xunit.Abstractions; using Xunit.Sdk; using Microsoft.Playwright; -using Microsoft.Win32; #nullable enable From 089c677e1ff46eb1a517413a7402f952af95a693 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 24 Jan 2025 13:32:36 +0100 Subject: [PATCH 10/11] Cleanup --- .../Wasm.Build.Tests/Blazor/DllImportTests.cs | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index 2f504a6aec54be..caaac6104f18c3 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -35,7 +35,7 @@ public static TheoryData DllImportTheoryData() [Theory] [MemberData(nameof(DllImportTheoryData))] - public void WithDllImportInMainAssembly(Configuration config, bool build, bool publish) + public async Task WithDllImportInMainAssembly(Configuration config, bool build, bool publish) { // Based on https://github.com/dotnet/runtime/issues/59255 string prefix = $"dllimp_{config}_{s_unicodeChars}"; @@ -76,26 +76,6 @@ async Task TestDllImport(IPage page) } } - public static bool IsLongPathEnabled() - { - const string keyPath = @"SYSTEM\CurrentControlSet\Control\FileSystem"; - const string valueName = "LongPathsEnabled"; - - using (RegistryKey? key = Registry.LocalMachine.OpenSubKey(keyPath)) - { - if (key != null) - { - object? value = key?.GetValue(valueName); - if (value is int intValue) - { - return intValue == 1; - } - } - } - - return false; - } - private void BlazorAddRazorButton(string buttonText, string customCode, string methodName = "test") => UpdateFile(Path.Combine("Pages", "Counter.razor"), new Dictionary { { From 82d52da0409152405172772aa13a3acbdd977071 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:10:50 +0100 Subject: [PATCH 11/11] Revert path shortening. --- src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs index caaac6104f18c3..29df5cdc3aec7e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/DllImportTests.cs @@ -38,7 +38,7 @@ public static TheoryData DllImportTheoryData() public async Task WithDllImportInMainAssembly(Configuration config, bool build, bool publish) { // Based on https://github.com/dotnet/runtime/issues/59255 - string prefix = $"dllimp_{config}_{s_unicodeChars}"; + string prefix = $"blz_dllimp_{config}_{s_unicodeChars}"; if (build && publish) prefix += "build_then_publish"; else if (build)