diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 83e847e..23635bc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -36,9 +36,6 @@ latest AllEnabledByDefault - - - diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs index 37bbe4a..2404f62 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs @@ -1,10 +1,11 @@ -#if !UNO_RUNTIMETESTS_DISABLE_UI && (__SKIA__ || IS_SECONDARY_APP_SUPPORTED) +#if !UNO_RUNTIMETESTS_DISABLE_UI && HAS_UNO_WINUI // HAS_UNO_WINUI: exclude non net7 platforms #nullable enable #if !IS_UNO_RUNTIMETEST_PROJECT #pragma warning disable #endif #pragma warning disable CA1848 // Log perf +#pragma warning disable CS1998 // No await namespace Uno.UI.RuntimeTests.Internal.Helpers; /// @@ -14,6 +15,9 @@ namespace Uno.UI.RuntimeTests.Internal.Helpers; /// This class is intended to be used only by the the test engine itself and should not be used by applications. /// API contract is not guaranteed and might change in future releases. /// +[global::System.Runtime.Versioning.SupportedOSPlatform("windows")] +[global::System.Runtime.Versioning.SupportedOSPlatform("linux")] +[global::System.Runtime.Versioning.SupportedOSPlatform("freeBSD")] internal sealed partial class DevServer : global::System.IAsyncDisposable { private static readonly global::Microsoft.Extensions.Logging.ILogger _log = global::Uno.Extensions.LogExtensionPoint.Log(typeof(DevServer)); @@ -28,7 +32,7 @@ internal sealed partial class DevServer : global::System.IAsyncDisposable public static async global::System.Threading.Tasks.Task Start(global::System.Threading.CancellationToken ct) { #if !HAS_UNO_DEVSERVER - throw new NotSupportedException("Dev server has not been referenced."); + throw new global::System.NotSupportedException("Dev server has not been referenced."); #else var path = await GetDevServer(ct); var port = GetTcpPort(); diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs index d5656f6..759dbd1 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs @@ -1,4 +1,4 @@ -#if !UNO_RUNTIMETESTS_DISABLE_UI && (__SKIA__ || IS_SECONDARY_APP_SUPPORTED) +#if !UNO_RUNTIMETESTS_DISABLE_UI && HAS_UNO_WINUI // HAS_UNO_WINUI: exclude non net7 platforms #nullable enable #if !IS_UNO_RUNTIMETEST_PROJECT @@ -24,6 +24,9 @@ namespace Uno.UI.RuntimeTests.Internal.Helpers; /// This class is intended to be used only by the the test engine itself and should not be used by applications. /// API contract is not guaranteed and might change in future releases. /// +[global::System.Runtime.Versioning.SupportedOSPlatform("windows")] +[global::System.Runtime.Versioning.SupportedOSPlatform("linux")] +[global::System.Runtime.Versioning.SupportedOSPlatform("freeBSD")] internal static partial class ProcessHelper { public static async Task ExecuteAsync( diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs index 1c3d225..c0ce19b 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs @@ -1,14 +1,12 @@ -#if !UNO_RUNTIMETESTS_DISABLE_UI +using System; + +#if !UNO_RUNTIMETESTS_DISABLE_UI #nullable enable #if !IS_UNO_RUNTIMETEST_PROJECT #pragma warning disable #endif -#if __SKIA__ -#define IS_SECONDARY_APP_SUPPORTED -#endif - namespace Uno.UI.RuntimeTests.Internal.Helpers; /// @@ -23,9 +21,9 @@ internal static partial class SecondaryApp /// /// Gets a boolean indicating if the current platform supports running tests in a secondary app. /// - public static bool IsSupported => // Note: not as const to avoid "CS0162 unreachable code" warning -#if IS_SECONDARY_APP_SUPPORTED - true; + public static bool IsSupported => +#if HAS_UNO_WINUI // HAS_UNO_WINUI: exclude non net7 platforms + global::System.OperatingSystem.IsWindows() || global::System.OperatingSystem.IsLinux() || global::System.OperatingSystem.IsFreeBSD(); #else false; #endif @@ -39,9 +37,17 @@ internal static partial class SecondaryApp /// The test results. internal static async global::System.Threading.Tasks.Task RunTest(UnitTestEngineConfig config, global::System.Threading.CancellationToken ct, bool isAppVisible = false) { -#if !IS_SECONDARY_APP_SUPPORTED - throw new global::System.NotSupportedException("Secondary app is not supported on this platform."); + if (!IsSupported) + { + throw new global::System.NotSupportedException("Secondary app is not supported on this platform."); + } + +#if !HAS_UNO_WINUI // HAS_UNO_WINUI: exclude non net7 platforms +#pragma warning disable CA1825 // Array.Empty not available on UWP + return new TestCaseResult[0]; // Non reachable code. +#pragma warning restore CA1825 #else +#pragma warning disable CA1416 // Validate platform compatibility => This is checked by the IsSupported property. // First we fetch and start the dev-server (needed to HR tests for instance) await using var devServer = await DevServer.Start(ct); @@ -98,6 +104,7 @@ internal static partial class SecondaryApp await childProcess.ExecuteAndLogAsync(typeof(SecondaryApp).CreateScopedLog($"CHILD_TEST_APP_{(global::System.Threading.Interlocked.Increment(ref _instance)):D2}"), ct); return testOutput; +#pragma warning restore CA1416 // Validate platform compatibility #endif } }