Remove SBRP from baselines, update RemoveVersions regex

This commit is contained in:
Ella Hathaway 2023-08-25 20:32:16 +00:00
parent 70cac71160
commit de0b323118
7 changed files with 4750 additions and 6601 deletions

View file

@ -48,8 +48,12 @@ public class ArtifactsSizeTest : SmokeTests
Assert.NotNull(Config.SdkTarballPath); Assert.NotNull(Config.SdkTarballPath);
Assert.NotNull(Config.TargetRid); Assert.NotNull(Config.TargetRid);
IEnumerable<TarEntry> artifactsTarEntries = Utilities.GetTarballContent(Config.SourceBuiltArtifactsPath).Where(entry => entry.EntryType == TarEntryType.RegularFile); IEnumerable<TarEntry> artifactsTarEntries = Utilities.GetTarballContent(Config.SourceBuiltArtifactsPath)
IEnumerable<TarEntry> sdkTarEntries = Utilities.GetTarballContent(Config.SdkTarballPath).Where(entry => entry.EntryType == TarEntryType.RegularFile); .Where(entry => entry.EntryType == TarEntryType.RegularFile)
.Where(entry => !entry.Name.Contains("SourceBuildReferencePackages"));
IEnumerable<TarEntry> sdkTarEntries = Utilities.GetTarballContent(Config.SdkTarballPath)
.Where(entry => entry.EntryType == TarEntryType.RegularFile)
.Where(entry => !entry.Name.Contains("SourceBuildReferencePackages"));
Dictionary<string, int> fileNameCountMap = new Dictionary<string, int>(); Dictionary<string, int> fileNameCountMap = new Dictionary<string, int>();
(string FilePath, long Bytes)[] tarEntries = sdkTarEntries.Concat(artifactsTarEntries) (string FilePath, long Bytes)[] tarEntries = sdkTarEntries.Concat(artifactsTarEntries)
@ -122,4 +126,4 @@ public class ArtifactsSizeTest : SmokeTests
OutputHelper.LogWarningMessage($"'{filePath}' increased in size by more than {SizeThresholdPercentage}%. It was originally {baselineSize} bytes and is now {fileSize} bytes"); OutputHelper.LogWarningMessage($"'{filePath}' increased in size by more than {SizeThresholdPercentage}%. It was originally {baselineSize} bytes and is now {fileSize} bytes");
} }
} }
} }

View file

@ -102,18 +102,23 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests
public static string RemoveVersions(string source) public static string RemoveVersions(string source)
{ {
string result = RemoveNetTfmPaths(source);
// Remove build versions
// The semantic version regex incorectly parses through build versions such as "8.1.00-beta.final"
// so the build version regex is used to capture matches that the semantic version does not.
Regex BuildVersionPattern = new(@"\d+(\.\d+)+([@-](\w+)*\d*([\.+-](alpha|preview|rc|rtm|beta|final|servicing|bundled))*(\.\d+)*)*");
result = BuildVersionPattern.Replace(result, VersionPlaceholder);
// Remove semantic versions // Remove semantic versions
// Regex source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string // Regex source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
Regex BuildVersionPattern = new(@"\d+(\.\d+)+([@-](alpha|preview|rc|rtm)(\.\d+)*)*");
string result = BuildVersionPattern.Replace(source, VersionPlaceholder);
Regex semanticVersionRegex = new( Regex semanticVersionRegex = new(
$"(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)" $"(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)"
+ $"(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))" + $"(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))"
+ $"?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"); + $"?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?");
result = semanticVersionRegex.Replace(result, VersionPlaceholder); result = semanticVersionRegex.Replace(result, VersionPlaceholder);
return RemoveNetTfmPaths(result); return result;
} }
/// <summary> /// <summary>