From 15101143b3ea8c09c113ed491157634d6443607e Mon Sep 17 00:00:00 2001 From: Saurabh Gautam <106561208+SaurabhMSFT@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:07:04 +0000 Subject: [PATCH] Remove unnecessary aot tests (#3045) --- Wilson.sln | 7 -- .../AotCompatibilityTests.cs | 76 ------------------- .../IgnoreOnAzureDevopsFactAttribute.cs | 28 ------- ...dentityModel.AotCompatibility.Tests.csproj | 17 ----- 4 files changed, 128 deletions(-) delete mode 100644 test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs delete mode 100644 test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs delete mode 100644 test/Microsoft.IdentityModel.AotCompatibility.Tests/Microsoft.IdentityModel.AotCompatibility.Tests.csproj diff --git a/Wilson.sln b/Wilson.sln index 8d3bd81589..5d49f422d7 100644 --- a/Wilson.sln +++ b/Wilson.sln @@ -92,8 +92,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.Abs EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.AotCompatibility.TestApp", "test\Microsoft.IdentityModel.AotCompatibility.TestApp\Microsoft.IdentityModel.AotCompatibility.TestApp.csproj", "{8105289F-3D54-4054-9738-5985F3B6CF2C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.AotCompatibility.Tests", "test\Microsoft.IdentityModel.AotCompatibility.Tests\Microsoft.IdentityModel.AotCompatibility.Tests.csproj", "{CD0EEF56-7221-4420-8181-48EE82E91306}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.Benchmarks", "benchmark\Microsoft.IdentityModel.Benchmarks\Microsoft.IdentityModel.Benchmarks.csproj", "{F1BB31E4-8865-4425-8BD4-94F1815C16E0}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{BC99A01F-1C6E-4994-8991-4919A9B096E1}" @@ -225,10 +223,6 @@ Global {8105289F-3D54-4054-9738-5985F3B6CF2C}.Debug|Any CPU.Build.0 = Debug|Any CPU {8105289F-3D54-4054-9738-5985F3B6CF2C}.Release|Any CPU.ActiveCfg = Release|Any CPU {8105289F-3D54-4054-9738-5985F3B6CF2C}.Release|Any CPU.Build.0 = Release|Any CPU - {CD0EEF56-7221-4420-8181-48EE82E91306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD0EEF56-7221-4420-8181-48EE82E91306}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD0EEF56-7221-4420-8181-48EE82E91306}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD0EEF56-7221-4420-8181-48EE82E91306}.Release|Any CPU.Build.0 = Release|Any CPU {F1BB31E4-8865-4425-8BD4-94F1815C16E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F1BB31E4-8865-4425-8BD4-94F1815C16E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1BB31E4-8865-4425-8BD4-94F1815C16E0}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -267,7 +261,6 @@ Global {C1F5A997-FAA9-45E5-8D28-D4E92D4A034D} = {EB14B99B-2255-45BC-BF14-E488DCD4A4BA} {EF9A4431-6D2C-4DD1-BF6B-6F2CC619DEE1} = {8905D2E3-4499-4A86-BF3E-F098F228DD59} {8105289F-3D54-4054-9738-5985F3B6CF2C} = {8905D2E3-4499-4A86-BF3E-F098F228DD59} - {CD0EEF56-7221-4420-8181-48EE82E91306} = {8905D2E3-4499-4A86-BF3E-F098F228DD59} {F1BB31E4-8865-4425-8BD4-94F1815C16E0} = {2F79F3C4-F4E3-46DD-8B34-8EF403A6F7F5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs b/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs deleted file mode 100644 index 1c5af61ae1..0000000000 --- a/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Diagnostics; -using System.IO; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.IdentityModel.AotCompatibility.Tests -{ - public class AotCompatibilityTests - { - private ITestOutputHelper _testOutputHelper; - - public AotCompatibilityTests(ITestOutputHelper testOutputHelper) - { - _testOutputHelper = testOutputHelper; - } - - /// - /// This test ensures that the intended APIs of the Microsoft.IdentityModel libraries are - /// trimming and NativeAOT compatible. - /// - /// This test follows the instructions in https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming#show-all-warnings-with-sample-application - /// - /// If this test fails, it is due to adding trimming and/or AOT incompatible changes - /// to code that is supposed to be compatible. - /// - /// To diagnose the problem, inspect the test output which will contain the trimming and AOT errors. For example: - /// - /// error IL2091: 'T' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' - /// - /// You can also 'dotnet publish' the 'Microsoft.IdentityModel.AotCompatibility.TestApp.csproj' as well to get the errors. - /// - [IgnoreOnAzureDevopsFact] - public void EnsureAotCompatibility() - { - string testAppPath = Path.Combine("..", "..", "..", "..", "Microsoft.IdentityModel.AotCompatibility.TestApp"); - string testAppProject = "Microsoft.IdentityModel.AotCompatibility.TestApp.csproj"; - -#if NET9_0_OR_GREATER - string framework = "net9.0"; -#else - string framework = "net8.0"; -#endif - - // ensure we run a clean publish every time - DirectoryInfo testObjDir = new DirectoryInfo(Path.Combine(testAppPath, "obj")); - if (testObjDir.Exists) - { - testObjDir.Delete(recursive: true); - } - - var process = new Process(); - // set '-nodereuse:false /p:UseSharedCompilation=false' so the MSBuild and Roslyn server processes don't hang around, which may hang the test in CI - process.StartInfo = new ProcessStartInfo("dotnet", $"publish {testAppProject} --self-contained --framework {framework} -nodereuse:false /p:UseSharedCompilation=false") - { - RedirectStandardOutput = true, - UseShellExecute = false, - CreateNoWindow = true, - WorkingDirectory = testAppPath - }; - process.OutputDataReceived += (sender, eventArgs) => - { - if (eventArgs.Data is not null) - _testOutputHelper.WriteLine(eventArgs.Data); - }; - process.Start(); - process.BeginOutputReadLine(); - - Assert.True(process.WaitForExit(milliseconds: 180_000), "dotnet publish command timed out after 3 minutes."); - - Assert.True(process.ExitCode == 0, "Publishing the AotCompatibility app failed. See test output for more details."); - } - } -} diff --git a/test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs b/test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs deleted file mode 100644 index cc3c994837..0000000000 --- a/test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using Xunit; - -namespace Microsoft.IdentityModel.AotCompatibility.Tests -{ - public sealed class IgnoreOnAzureDevopsFactAttribute : FactAttribute - { - public IgnoreOnAzureDevopsFactAttribute() - { - if (!IsRunningOnAzureDevOps()) - { - return; - } - - Skip = "Ignored on Azure DevOps"; - } - - /// Determine if runtime is Azure DevOps. - /// True if being executed in Azure DevOps, false otherwise. - public static bool IsRunningOnAzureDevOps() - { - return Environment.GetEnvironmentVariable("SYSTEM_DEFINITIONID") != null; - } - } -} diff --git a/test/Microsoft.IdentityModel.AotCompatibility.Tests/Microsoft.IdentityModel.AotCompatibility.Tests.csproj b/test/Microsoft.IdentityModel.AotCompatibility.Tests/Microsoft.IdentityModel.AotCompatibility.Tests.csproj deleted file mode 100644 index c72cdd01e8..0000000000 --- a/test/Microsoft.IdentityModel.AotCompatibility.Tests/Microsoft.IdentityModel.AotCompatibility.Tests.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - net8.0;net9.0 - $(TargetFrameworks); - 12 - 1.0.0-preview - - - - - - -