public PackageTests(ITestOutputHelper output) { // In official builds, only run this test on Helix. The test will work locally so long as you're building w/ // shipping versions (i.e., include `/p:DotNetUseShippingVersions=true` on a full build command), and you do not // have binaries built locally from another major version. if (!TestData.VerifyPackageAssemblyVersions() && !SkipOnCIAttribute.OnCI()) { return; } _output = output; _packageLayoutRoot = SkipOnHelixAttribute.OnHelix() ? Path.Combine( Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), "Packages.Layout") : TestData.GetPackageLayoutRoot(); var packageRoot = SkipOnHelixAttribute.OnHelix() ? Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT") : TestData.GetPackagesFolder(); var packages = Directory .GetFiles(packageRoot, "*.nupkg", SearchOption.AllDirectories) .Where(file => !file.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase)); if (Directory.Exists(_packageLayoutRoot)) { Directory.Delete(_packageLayoutRoot, true); } foreach (var package in packages) { var outputPath = Path.Combine(_packageLayoutRoot, Path.GetFileNameWithoutExtension(package)); ZipFile.ExtractToDirectory(package, outputPath); } }
private static string GetProjectDirectory() { // On helix we use the published test files if (SkipOnHelixAttribute.OnHelix()) { return(AppContext.BaseDirectory); } var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc"); var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Analyzers", "test"); return(projectDirectory); }
private static string GetProjectDirectory() { // On helix we use the published test files if (SkipOnHelixAttribute.OnHelix()) { return(AppContext.BaseDirectory); } // https://github.com/dotnet/aspnetcore/issues/9431 #pragma warning disable 0618 var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc"); #pragma warning restore 0618 var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Api.Analyzers", "test"); return(projectDirectory); }
private static string GetProjectDirectory() { // On helix we use the published test files if (SkipOnHelixAttribute.OnHelix()) { return(AppContext.BaseDirectory); } // This test code needs to be updated to support distributed testing. // See https://github.com/aspnet/AspNetCore/issues/10422 #pragma warning disable 0618 var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Components"); #pragma warning restore 0618 var projectDirectory = Path.Combine(solutionDirectory, "Analyzers", "test"); return(projectDirectory); }
private static string GetSolutionDir() { var dir = new DirectoryInfo(AppContext.BaseDirectory); // On helix we use the published copy if (!SkipOnHelixAttribute.OnHelix()) { while (dir != null) { if (File.Exists(Path.Combine(dir.FullName, "Identity.sln"))) { break; } dir = dir.Parent; } } return(dir.FullName); }
public void RuntimeListContainsCorrectPaths() { var runtimeListPath = "RuntimeList.xml"; AssertEx.FileExists(runtimeListPath); var runtimeListDoc = XDocument.Load(runtimeListPath); var runtimeListEntries = runtimeListDoc.Root.Descendants(); var packageFolder = SkipOnHelixAttribute.OnHelix() ? Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT") : TestData.GetPackagesFolder(); var sharedFxPath = Path.Combine( packageFolder, "Microsoft.AspNetCore.App.Runtime.win-x64." + TestData.GetSharedFxVersion() + ".nupkg"); AssertEx.FileExists(sharedFxPath); ZipArchive archive = ZipFile.OpenRead(sharedFxPath); var actualPaths = archive.Entries .Where(i => i.FullName.EndsWith(".dll", StringComparison.Ordinal)) .Select(i => i.FullName).ToHashSet(); var expectedPaths = runtimeListEntries.Select(i => i.Attribute("Path").Value).ToHashSet(); _output.WriteLine("==== package contents ===="); _output.WriteLine(string.Join('\n', actualPaths.OrderBy(i => i))); _output.WriteLine("==== expected assemblies ===="); _output.WriteLine(string.Join('\n', expectedPaths.OrderBy(i => i))); var missing = expectedPaths.Except(actualPaths); var unexpected = actualPaths.Except(expectedPaths); _output.WriteLine("==== missing assemblies from the runtime list ===="); _output.WriteLine(string.Join('\n', missing)); _output.WriteLine("==== unexpected assemblies in the runtime list ===="); _output.WriteLine(string.Join('\n', unexpected)); Assert.Empty(missing); Assert.Empty(unexpected); }