From 8c6c1928068118edbc112f332d5925f3fffa1357 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 18 Apr 2016 15:28:01 -0700 Subject: [PATCH] Use runtime directory instead of compile directory when running tests --- .../commands/dotnet-test/AssemblyUnderTest.cs | 10 +--------- src/dotnet/commands/dotnet-test/Program.cs | 13 +++++++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/dotnet/commands/dotnet-test/AssemblyUnderTest.cs b/src/dotnet/commands/dotnet-test/AssemblyUnderTest.cs index 4bba9bb87..39820969f 100644 --- a/src/dotnet/commands/dotnet-test/AssemblyUnderTest.cs +++ b/src/dotnet/commands/dotnet-test/AssemblyUnderTest.cs @@ -26,15 +26,7 @@ namespace Microsoft.DotNet.Tools.Test _dotentTestParams.BuildBasePath, _dotentTestParams.Output); - var assemblyUnderTest = outputPaths.CompilationFiles.Assembly; - - if (!string.IsNullOrEmpty(_dotentTestParams.Output) || - !string.IsNullOrEmpty(_dotentTestParams.BuildBasePath)) - { - assemblyUnderTest = outputPaths.RuntimeFiles.Assembly; - } - - return assemblyUnderTest; + return outputPaths.RuntimeFiles.Assembly; } } } diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index d89fd6e9c..2816fb714 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -7,8 +7,9 @@ using System.Diagnostics; using System.IO; using System.Linq; using Microsoft.DotNet.Cli.Utils; -using Microsoft.Dnx.Runtime.Common.CommandLine; using Microsoft.DotNet.ProjectModel; +using Microsoft.Dnx.Runtime.Common.CommandLine; +using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.DotNet.Tools.Test { @@ -42,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Test RegisterForParentProcessExit(dotnetTestParams.ParentProcessId.Value); } - var projectContexts = CreateProjectContexts(dotnetTestParams.ProjectPath); + var projectContexts = CreateProjectContexts(dotnetTestParams.ProjectPath, dotnetTestParams.Runtime); var projectContext = projectContexts.First(); @@ -98,7 +99,7 @@ namespace Microsoft.DotNet.Tools.Test } } - private static IEnumerable CreateProjectContexts(string projectPath) + private static IEnumerable CreateProjectContexts(string projectPath, string runtime) { projectPath = projectPath ?? Directory.GetCurrentDirectory(); @@ -112,7 +113,11 @@ namespace Microsoft.DotNet.Tools.Test throw new InvalidOperationException($"{projectPath} does not exist."); } - return ProjectContext.CreateContextForEachFramework(projectPath); + var runtimeIdentifiers = !string.IsNullOrEmpty(runtime) ? + new[] { runtime } : + PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers(); + + return ProjectContext.CreateContextForEachFramework(projectPath).Select(context => context.CreateRuntimeContext(runtimeIdentifiers)); } } } \ No newline at end of file