diff --git a/netci.groovy b/netci.groovy index 374eaa962..4f60f0db8 100644 --- a/netci.groovy +++ b/netci.groovy @@ -60,11 +60,7 @@ platformList.each { platform -> Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, 'latest-or-auto') Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") - // Remove this check once tests work for 2.0. Until that time Linux portable tests will fail so we - // don't run the tests and there won't be any .trx file. - if (os != 'Linux') { - Utilities.addMSTestResults(newJob, '**/*.trx') - } + Utilities.addMSTestResults(newJob, '**/*.trx') Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${architecture} ${configuration} Build") } diff --git a/run-build.sh b/run-build.sh index 11e4ff753..684fb8049 100755 --- a/run-build.sh +++ b/run-build.sh @@ -98,8 +98,7 @@ while [[ $# > 0 ]]; do ;; --linux-portable) LINUX_PORTABLE_INSTALL_ARGS="--runtime-id linux-x64" - # Until we get test support for 2.0 we need to pass in the targets without test. - CUSTOM_BUILD_ARGS="/p:Rid=\"linux-x64\" /p:OSName=\"linux\" /p:CLITargets=\"Prepare;Compile;Package;Publish\"" + CUSTOM_BUILD_ARGS="/p:Rid=\"linux-x64\" /p:OSName=\"linux\"" args=( "${args[@]/$1}" ) ;; --help) diff --git a/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs b/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs index d4212fb6a..3a5accdfb 100644 --- a/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs +++ b/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs @@ -25,16 +25,5 @@ namespace Microsoft.DotNet.Cli { get { return s_versionFileObject.Value; } } - - /// - /// Reads the version file and adds runtime specific information - /// - public static string ReadAndInterpretVersionFile() - { - var content = File.ReadAllText(DotnetFiles.VersionFile); - content += Environment.NewLine; - content += RuntimeEnvironment.GetRuntimeIdentifier(); - return content; - } } } diff --git a/src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs b/src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs deleted file mode 100644 index 747fa8901..000000000 --- a/src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Collections.Generic; - -namespace Microsoft.DotNet.Cli.Utils -{ - internal static class DotnetRuntimeIdentifiers - { - public static IEnumerable InferCurrentRuntimeIdentifiers(DotnetVersionFile versionFile) - { - IEnumerable fallbackIdentifiers = null; - - // If the machine's RID isn't supported by the shared framework (i.e. the CLI - // is being used on a newer version of an OS), add the RID that the CLI was built - // with as a fallback. The RID the CLI was built with will have the correct - // runtime.* NuGet packages available. - // For example, when a user is using osx.10.12, but we only support osx.10.10 and - // osx.10.11, the project.json "runtimes" section cannot contain osx.10.12, since - // that RID isn't contained in the runtime graph - users will get a restore error. - FrameworkDependencyFile fxDepsFile = new FrameworkDependencyFile(); - if (!fxDepsFile.SupportsCurrentRuntime()) - { - string buildRid = versionFile.BuildRid; - if (!string.IsNullOrEmpty(buildRid)) - { - fallbackIdentifiers = new string[] { buildRid }; - } - } - - return RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers(fallbackIdentifiers); - } - } -} diff --git a/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs index 1d695a5de..b758f047e 100644 --- a/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs @@ -29,59 +29,5 @@ namespace Microsoft.DotNet.Cli.Utils return "win7-" + arch; } } - - public static IEnumerable GetAllCandidateRuntimeIdentifiers() - { - return GetAllCandidateRuntimeIdentifiers(null); - } - - public static IEnumerable GetAllCandidateRuntimeIdentifiers(IEnumerable fallbackIdentifiers = null) - { - List result = new List(); - - if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows) - { - result.Add(RuntimeEnvironment.GetRuntimeIdentifier()); - } - else - { - var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant(); - if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.1", StringComparison.Ordinal)) - { - result.Add("win7-" + arch); - } - else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.2", StringComparison.Ordinal)) - { - result.Add("win8-" + arch); - result.Add("win7-" + arch); - } - else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.3", StringComparison.Ordinal)) - { - result.Add("win81-" + arch); - result.Add("win8-" + arch); - result.Add("win7-" + arch); - } - else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("10.0", StringComparison.Ordinal)) - { - result.Add("win10-" + arch); - result.Add("win81-" + arch); - result.Add("win8-" + arch); - result.Add("win7-" + arch); - } - } - - if (fallbackIdentifiers != null) - { - foreach (string fallbackIdentifier in fallbackIdentifiers) - { - if (!result.Contains(fallbackIdentifier)) - { - result.Add(fallbackIdentifier); - } - } - } - - return result; - } } } diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs index f51c2d82a..993115b10 100644 --- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs +++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs @@ -89,7 +89,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd .And.HaveStdOutContaining("Hello I prefer the cli runtime World!");; } - [Fact] + [RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087 public void ItCanRunAToolThatInvokesADependencyToolInACSProj() { var repoDirectoriesProvider = new RepoDirectoriesProvider(); diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs index 0ec85046c..b0b825e43 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs @@ -13,8 +13,6 @@ namespace StreamForwarderTests { public class StreamForwarderTests : TestBase { - private static readonly string s_rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); - public static IEnumerable ForwardingTheoryVariations { get diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs index a99c8ef60..2f50d2e4e 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs @@ -1,22 +1,30 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Microsoft.DotNet.PlatformAbstractions; - namespace Microsoft.DotNet.Tools.Test.Utilities { public static class EnvironmentInfo { public static bool HasSharedFramework(string framework) { + string rid = RepoDirectoriesProvider.BuildRid; + if (framework == "netcoreapp1.0") { - string rid = RuntimeEnvironment.GetRuntimeIdentifier(); switch (rid) { case "fedora.24-x64": case "opensuse.42.1-x64": case "ubuntu.16.10-x64": + case "linux-x64": + return false; + } + } + else if (framework == "netcoreapp1.1") + { + switch (rid) + { + case "linux-x64": return false; } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs index 0b634cd79..94586477f 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Linq; +using System.Xml.Linq; using Microsoft.DotNet.PlatformAbstractions; namespace Microsoft.DotNet.Tools.Test.Utilities @@ -11,6 +12,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities public class RepoDirectoriesProvider { private static string s_repoRoot; + private static string s_buildRid; private string _artifacts; private string _builtDotnet; @@ -49,6 +51,32 @@ namespace Microsoft.DotNet.Tools.Test.Utilities } } + public static string BuildRid + { + get + { + if (string.IsNullOrEmpty(s_buildRid)) + { + var buildInfoPath = Path.Combine(RepoRoot, "artifacts", "obj", "BuildInfo.props"); + var root = XDocument.Load(buildInfoPath).Root; + var ns = root.Name.Namespace; + + s_buildRid = root + .Elements(ns + "PropertyGroup") + .Elements(ns + "Rid") + .FirstOrDefault() + ?.Value; + + if (string.IsNullOrEmpty(s_buildRid)) + { + throw new InvalidOperationException($"Could not find a property named 'Rid' in {buildInfoPath}"); + } + } + + return s_buildRid; + } + } + public string Artifacts => _artifacts; public string BuiltDotnet => _builtDotnet; public string NugetPackages => _nugetPackages; @@ -64,9 +92,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities string corehostDummyPackages = null, string pjDotnet = null) { - var currentRid = RuntimeEnvironment.GetRuntimeIdentifier(); - - _artifacts = artifacts ?? Path.Combine(RepoRoot, "artifacts", currentRid); + _artifacts = artifacts ?? Path.Combine(RepoRoot, "artifacts", BuildRid); _builtDotnet = builtDotnet ?? Path.Combine(_artifacts, "intermediate", "sharedFrameworkPublish"); _nugetPackages = nugetPackages ?? Path.Combine(RepoRoot, ".nuget", "packages"); _pjDotnet = pjDotnet ?? GetPjDotnetPath(); diff --git a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs index e732bcbac..3859aa435 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs @@ -34,6 +34,13 @@ namespace Microsoft.DotNet.New.Tests string projectType, bool useNuGetConfigForAspNet) { + if (language == "F#" && !EnvironmentInfo.HasSharedFramework("netcoreapp1.0")) + { + // F# requires netcoreapp1.0 to be present in order to build + // https://github.com/dotnet/netcorecli-fsc/issues/76 + return; + } + string rootPath = TestAssets.CreateTestDirectory(identifier: $"{language}_{projectType}").FullName; new TestCommand("dotnet") { WorkingDirectory = rootPath } diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index b402f4e60..79e1604c5 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Tests .And.Pass(); } - [Fact] + [RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087 public void CanInvokeToolFromDirectDependenciesIfPackageNameDifferentFromToolName() { var testInstance = TestAssets.Get("AppWithDirectDepWithOutputName") @@ -242,7 +242,7 @@ namespace Microsoft.DotNet.Tests .Should().Fail(); } - [Fact] + [RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087 public void ToolsCanAccessDependencyContextProperly() { var testInstance = TestAssets.Get("DependencyContextFromTool")