From f4036a9e82d73bcba05aeae3edd22b6c583b2629 Mon Sep 17 00:00:00 2001 From: Ella Hathaway Date: Mon, 8 Jul 2024 17:11:34 +0000 Subject: [PATCH] Remove RIDS in CompareMsftToSbAssemblyVersions test --- .../BaselineHelper.cs | 14 ++++++++++---- .../SdkContentTests.cs | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs index 8f6671a297e9..ea83fcccfaf7 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs @@ -20,6 +20,10 @@ internal class BaselineHelper private const string SemanticVersionPlaceholderMatchingPattern = "*.*.*"; // wildcard pattern used to match on the version represented by the placeholder private const string NonSemanticVersionPlaceholder = "x.y"; private const string NonSemanticVersionPlaceholderMatchingPattern = "*.*"; // wildcard pattern used to match on the version represented by the placeholder + private const string TargetRidPlaceholder = "banana-rid"; + private const string TargetRidPlaceholderMatchingPattern = "*-*"; // wildcard pattern used to match on the rid represented by the placeholder + private const string PortableRidPlaceholder = "portable-rid"; + private const string PortableRidPlaceholderMatchingPattern = "*-*"; // wildcard pattern used to match on the rid represented by the placeholder public static void CompareEntries(string baselineFileName, IOrderedEnumerable actualEntries) { @@ -91,7 +95,7 @@ public static string GetBaselineFilePath(string baselineFileName, string baselin Path.Combine(GetAssetsDirectory(), baselineSubDir, baselineFileName); public static string RemoveRids(string diff, bool isPortable = false) => - isPortable ? diff.Replace(Config.PortableRid, "portable-rid") : diff.Replace(Config.TargetRid, "banana-rid"); + isPortable ? diff.Replace(Config.PortableRid, PortableRidPlaceholder) : diff.Replace(Config.TargetRid, TargetRidPlaceholder); public static string RemoveVersions(string source) { @@ -119,14 +123,16 @@ public static string RemoveVersions(string source) } /// - /// This returns a that can be used to match on a path whose versions have been removed via - /// . + /// This returns a that can be used to match on a path whose versions and RID have been removed via + /// and /// public static Matcher GetFileMatcherFromPath(string path) { path = path .Replace(SemanticVersionPlaceholder, SemanticVersionPlaceholderMatchingPattern) - .Replace(NonSemanticVersionPlaceholder, NonSemanticVersionPlaceholderMatchingPattern); + .Replace(NonSemanticVersionPlaceholder, NonSemanticVersionPlaceholderMatchingPattern) + .Replace(TargetRidPlaceholder, TargetRidPlaceholderMatchingPattern) + .Replace(PortableRidPlaceholder, PortableRidPlaceholderMatchingPattern); Matcher matcher = new(); matcher.AddInclude(path); return matcher; diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs index ee6ba87f69c6..6b685f63d423 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs @@ -185,7 +185,8 @@ private string FindMatchingFilePath(string rootDir, Matcher matcher, string repr { AssemblyName assemblyName = AssemblyName.GetAssemblyName(file); string relativePath = Path.GetRelativePath(sbSdkPath, file); - string normalizedPath = BaselineHelper.RemoveVersions(relativePath); + string normalizedPath = BaselineHelper.RemoveRids(relativePath, isPortable: false); + normalizedPath = BaselineHelper.RemoveVersions(normalizedPath); if(!exclusionsHelper.IsFileExcluded(normalizedPath, SourceBuildSdkType)) {