diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/BasicScenarioTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/BasicScenarioTests.cs index f9fe8acd36df..336316f2fa50 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/BasicScenarioTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/BasicScenarioTests.cs @@ -19,7 +19,7 @@ public class BasicScenarioTests : SdkTests { public BasicScenarioTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - // [Theory(Skip="https://github.com/dotnet/sdk/issues/42920")] + [Theory] [MemberData(nameof(GetScenarioObjects))] public void VerifyScenario(TestScenario scenario) => scenario.Execute(DotNetHelper); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetFormatTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetFormatTests.cs index 0de57851de53..c35d2bb6892e 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetFormatTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetFormatTests.cs @@ -20,7 +20,8 @@ public DotNetFormatTests(ITestOutputHelper outputHelper) : base(outputHelper) { /// /// Format an unformatted project and verify that the output matches the pre-computed solution. /// - // [Fact(Skip="https://github.com/dotnet/sdk/issues/42920")] + // Disabled due to https://github.com/dotnet/roslyn/issues/76797 + // [Fact] public void FormatProject() { if (DotNetHelper.IsMonoRuntime) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetWatchTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetWatchTests.cs index e39c47507343..60f81c464add 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetWatchTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetWatchTests.cs @@ -13,7 +13,7 @@ public class DotNetWatchTests : SdkTests { public DotNetWatchTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - // [Fact(Skip="https://github.com/dotnet/sdk/issues/42920")] + [Fact] public void WatchTests() { if (DotNetHelper.IsMonoRuntime) @@ -36,7 +36,7 @@ public void WatchTests() void processConfigCallback(Process process) { - const string waitingString = "Waiting for changes"; + const string waitingString = "Waiting for a file to change"; const string expectedString = "Hello from dotnet watch!"; bool fileChanged = false; diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/SymbolsTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/SymbolsTests.cs index 75ffc708f345..912fa9b376f6 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/SymbolsTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/SymbolsTests.cs @@ -24,7 +24,7 @@ public SymbolsTests(ITestOutputHelper outputHelper) : base(outputHelper) { } /// /// Verifies that all symbols have valid sourcelinks. /// - // [Fact(Skip="https://github.com/dotnet/sdk/issues/42920")] + [Fact] public void VerifySdkSymbols() { try @@ -66,6 +66,10 @@ private IList VerifySdkFilesHaveMatchingSymbols(string symbolsRoot, stri { Assert.True(Directory.Exists(sdkRoot), $"Path, with SDK files to validate, does not exist: {sdkRoot}"); + // Normalize paths, to ensure proper string replacement + symbolsRoot = symbolsRoot.TrimEnd(Path.DirectorySeparatorChar); + sdkRoot = sdkRoot.TrimEnd(Path.DirectorySeparatorChar); + var failedFiles = new ConcurrentBag(); IEnumerable allFiles = Directory.GetFiles(sdkRoot, "*", SearchOption.AllDirectories); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/WebScenarioTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/WebScenarioTests.cs index 6f3cd28f5233..b2ce04a620cb 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/WebScenarioTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/WebScenarioTests.cs @@ -2,6 +2,7 @@ // 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.Collections.Generic; using System.IO; using System.Linq; @@ -20,7 +21,7 @@ public class WebScenarioTests : SdkTests { public WebScenarioTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - // [Theory(Skip="https://github.com/dotnet/sdk/issues/42920")] + [Theory] [MemberData(nameof(GetScenarioObjects))] public void VerifyScenario(TestScenario scenario) => scenario.Execute(DotNetHelper); @@ -37,8 +38,7 @@ private static IEnumerable GetScenarios() yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.Razor, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish); yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.BlazorWasm, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish); - // Disabled due to .NET 10.0 transition. See https://github.com/dotnet/sdk/pull/42969 - // yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.WebApp, DotNetActions.PublishSelfContained, VerifyRuntimePacksForSelfContained); + yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.WebApp, DotNetActions.PublishSelfContained, VerifyRuntimePacksForSelfContained); yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.Worker); } @@ -50,9 +50,30 @@ private static void VerifyRuntimePacksForSelfContained(string projectPath) string projNugetCachePath = Path.Combine(projectPath, "obj", "project.nuget.cache"); JsonNode? projNugetCache = JsonNode.Parse(File.ReadAllText(projNugetCachePath)); - string? restoredPackageFiles = projNugetCache?["expectedPackageFiles"]?.ToString(); + JsonArray? restoredPackageFiles = (JsonArray?)projNugetCache?["expectedPackageFiles"]; Assert.True(restoredPackageFiles is not null, "Failed to parse project.nuget.cache"); - Assert.True("[]" == restoredPackageFiles, "Runtime packs were retrieved from NuGet instead of the SDK"); + + string[] allowedPackages = [ + // Temporarily allowed due to https://github.com/dotnet/sdk/issues/46165 + // TODO: Remove this once the issue is resolved + "Microsoft.AspNetCore.App.Internal.Assets" + ]; + + string packagesDirectory = Path.Combine(Environment.CurrentDirectory, "packages"); + + IEnumerable packages = restoredPackageFiles + .Select(file => + { + string path = file.ToString(); + path = path.Substring(packagesDirectory.Length + 1); // trim the leading path up to the package name directory + return path.Substring(0, path.IndexOf('/')); // trim the rest of the path + }) + .Except(allowedPackages, StringComparer.OrdinalIgnoreCase); + + if (packages.Any()) + { + Assert.Fail($"The following runtime packs were retrieved from NuGet instead of the SDK: {string.Join(",", packages.ToArray())}"); + } } }