Eliminate remaining source-build poisons (#16631)

This commit is contained in:
Nikola Milosavljevic 2023-06-09 09:05:58 -07:00 committed by GitHub
parent 68f7361127
commit 2a878b909c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 63 deletions

View file

@ -230,14 +230,8 @@ jobs:
dockerVolumeArgs="-v $(sourcesPath):/vmr"
dockerEnvArgs="-e SMOKE_TESTS_EXCLUDE_OMNISHARP=${{ parameters.excludeOmniSharpTests }} -e SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS=true -e SMOKE_TESTS_RUNNING_IN_CI=true"
poisonArg=''
if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
poisonArg='--poison'
dockerEnvArgs+=" -e SMOKE_TESTS_WARN_POISON_DIFFS=true"
fi
docker run --rm $dockerVolumeArgs -w /vmr $dockerEnvArgs ${{ parameters.container }} ./build.sh $poisonArg --run-smoke-test $(additionalBuildArgs) -- -p:SmokeTestConsoleVerbosity=detailed
docker run --rm $dockerVolumeArgs -w /vmr $dockerEnvArgs ${{ parameters.container }} ./build.sh --run-smoke-test $(additionalBuildArgs) -- -p:SmokeTestConsoleVerbosity=detailed
displayName: Run Tests
# Don't use CopyFiles@2 as it encounters permissions issues because it indexes all files in the source directory graph.

View file

@ -70,7 +70,8 @@
HashCatalogFilePath="$(PoisonReportDataFile)"
MarkerFileName="$(PoisonMarkerFile)"
PoisonReportOutputFilePath="$(PoisonUsageReportFile)"
NonShippingPackagesListFiles="@(NonShippingPackagesList)" />
NonShippingPackagesListFiles="@(NonShippingPackagesList)"
FailOnPoisonFound="true" />
<WriteLinesToFile File="$(CompletedSemaphorePath)ReportPoisonUsage.complete" Overwrite="true" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done checking for poison." />
@ -93,7 +94,6 @@
</ItemGroup>
<PropertyGroup>
<CustomTestEnvVars Condition="'$(EnablePoison)' == 'true'">SMOKE_TESTS_POISON_REPORT_PATH=$(PoisonUsageReportFile);</CustomTestEnvVars>
<SdkTarballPath>%(SdkTarballItem.Identity)</SdkTarballPath>
<SourceBuiltArtifactsPath>%(SourceBuiltArtifactsItem.Identity)</SourceBuiltArtifactsPath>
<SmokeTestConsoleVerbosity Condition="'$(SmokeTestConsoleVerbosity)' == ''">normal</SmokeTestConsoleVerbosity>

View file

@ -160,11 +160,6 @@ namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
Log.LogWarning($"{poisons.Count()} marked files leaked to output. See complete report '{PoisonReportOutputFilePath}' for details.");
}
else
{
Log.LogError($"No leaked files found in output. Either something is broken or it is the future and we have fixed all leaks - please verify and remove this error if so (and default {nameof(FailOnPoisonFound)} to true).");
return false;
}
return !Log.HasLoggedErrors;
}

View file

@ -20,7 +20,6 @@
<RepositoryReference Include="command-line-api" />
<RepositoryReference Include="diagnostics" />
<RepositoryReference Include="emsdk" />
<RepositoryReference Include="razor" />
<RepositoryReference Include="xliff-tasks" />
<RepositoryReference Include="cecil" />
<RepositoryReference Include="symreader" />
@ -31,6 +30,7 @@
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="roslyn-analyzers" />
<RepositoryReference Include="aspnetcore" />
<RepositoryReference Include="razor" />
<RepositoryReference Include="deployment-tools" />
<RepositoryReference Include="format" />
<RepositoryReference Include="nuget-client" />

View file

@ -12,6 +12,8 @@
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="aspnetcore" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

View file

@ -12,21 +12,18 @@ internal static class Config
public const string DotNetDirectoryEnv = "SMOKE_TESTS_DOTNET_DIR";
public const string ExcludeOmniSharpEnv = "SMOKE_TESTS_EXCLUDE_OMNISHARP";
public const string MsftSdkTarballPathEnv = "SMOKE_TESTS_MSFT_SDK_TARBALL_PATH";
public const string PoisonReportPathEnv = "SMOKE_TESTS_POISON_REPORT_PATH";
public const string PortableRidEnv = "SMOKE_TESTS_PORTABLE_RID";
public const string PrereqsPathEnv = "SMOKE_TESTS_PREREQS_PATH";
public const string CustomPackagesPathEnv = "SMOKE_TESTS_CUSTOM_PACKAGES_PATH";
public const string SdkTarballPathEnv = "SMOKE_TESTS_SDK_TARBALL_PATH";
public const string SourceBuiltArtifactsPathEnv = "SMOKE_TESTS_SOURCEBUILT_ARTIFACTS_PATH";
public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID";
public const string WarnPoisonDiffsEnv = "SMOKE_TESTS_WARN_POISON_DIFFS";
public const string WarnSdkContentDiffsEnv = "SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS";
public const string RunningInCIEnv = "SMOKE_TESTS_RUNNING_IN_CI";
public static string DotNetDirectory { get; } =
Environment.GetEnvironmentVariable(DotNetDirectoryEnv) ?? Path.Combine(Directory.GetCurrentDirectory(), ".dotnet");
public static string? MsftSdkTarballPath { get; } = Environment.GetEnvironmentVariable(MsftSdkTarballPathEnv);
public static string? PoisonReportPath { get; } = Environment.GetEnvironmentVariable(PoisonReportPathEnv);
public static string PortableRid { get; } = Environment.GetEnvironmentVariable(PortableRidEnv) ??
throw new InvalidOperationException($"'{Config.PortableRidEnv}' must be specified");
public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv);
@ -37,8 +34,6 @@ internal static class Config
public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ??
throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified");
public static string TargetArchitecture { get; } = TargetRid.Split('-')[1];
public static bool WarnOnPoisonDiffs { get; } =
bool.TryParse(Environment.GetEnvironmentVariable(WarnPoisonDiffsEnv), out bool excludeOnlineTests) && excludeOnlineTests;
public static bool WarnOnSdkContentDiffs { get; } =
bool.TryParse(Environment.GetEnvironmentVariable(WarnSdkContentDiffsEnv), out bool excludeOnlineTests) && excludeOnlineTests;

View file

@ -1,35 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Text.RegularExpressions;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests
{
public class PoisonTests : SmokeTests
{
public PoisonTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
[SkippableFact(Config.PoisonReportPathEnv, skipOnNullOrWhiteSpace: true)]
public void VerifyUsage()
{
if (!File.Exists(Config.PoisonReportPath))
{
throw new InvalidOperationException($"Poison report '{Config.PoisonReportPath}' does not exist.");
}
string currentPoisonReport = File.ReadAllText(Config.PoisonReportPath);
currentPoisonReport = RemoveHashes(currentPoisonReport);
currentPoisonReport = BaselineHelper.RemoveRids(currentPoisonReport);
currentPoisonReport = BaselineHelper.RemoveRids(currentPoisonReport, true);
currentPoisonReport = BaselineHelper.RemoveVersions(currentPoisonReport);
BaselineHelper.CompareContents("PoisonUsage.txt", currentPoisonReport, OutputHelper, Config.WarnOnPoisonDiffs);
}
private static string RemoveHashes(string source) => Regex.Replace(source, "^\\s*<Hash>.*</Hash>(\r\n?|\n)", string.Empty, RegexOptions.Multiline);
}
}

View file

@ -1,8 +0,0 @@
<PrebuiltLeakReport>
<File Path="dotnet-sdk-x.y.z-banana-rid.tar/sdk/x.y.z/Sdks/Microsoft.NET.Sdk.Razor/source-generators/Microsoft.Extensions.ObjectPool.dll">
<Type>AssemblyAttribute</Type>
</File>
<File Path="dotnet-sdk-x.y.z-banana-rid.tar/sdk/x.y.z/Sdks/Microsoft.NET.Sdk.Razor/source-generators/System.Collections.Immutable.dll">
<Type>AssemblyAttribute</Type>
</File>
</PrebuiltLeakReport>

View file

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nikola Milosavljevic <nikolam@microsoft.com>
Date: Thu, 8 Jun 2023 18:39:26 +0000
Subject: [PATCH] Add System.Collections.Immutable package dependency
Backport: https://github.com/dotnet/razor/pull/8817
---
eng/Version.Details.xml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 3d75f97f3..c52b0a554 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -105,12 +105,16 @@
<Sha>9e7fbcab4e5275f63c0cd37553ba426de9194309</Sha>
<SourceBuild RepoName="xliff-tasks" ManagedOnly="true" />
</Dependency>
- <!-- Necessary for source-build. This allows the package to be retrieved from previously-source-built artifacts
- and flow in as dependencies of the packages produced by razor. Without this entry an SBRP version of the
- dependency would be bundled together with the produced package, causing issues for the consumer. -->
+ <!-- Necessary for source-build. This allows Microsoft.Extensions.ObjectPool and System.Collections.Immutable packages
+ to be retrieved from live source-build and their content consumed by packages produced by razor.
+ Without these entries, due to PVP flow work, SBRP packages would be consumed causing runtime issue. -->
<Dependency Name="Microsoft.Extensions.ObjectPool" Version="6.0.0">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>ae1a6cbe225b99c0bf38b7e31bf60cb653b73a52</Sha>
</Dependency>
+ <Dependency Name="System.Collections.Immutable" Version="6.0.0">
+ <Uri>https://github.com/dotnet/runtime</Uri>
+ <Sha>4822e3c3aa77eb82b2fb33c9321f923cf11ddde6</Sha>
+ </Dependency>
</ToolsetDependencies>
</Dependencies>