t Convert Test Assets to Microsoft.NETCore.App

fix dotnet-compile-fsc failures

fix test failures
This commit is contained in:
Bryan Thornbury 2016-04-12 17:29:07 -07:00
parent b682ab1d4f
commit 83d78129db
125 changed files with 483 additions and 492 deletions

View file

@ -31,9 +31,9 @@ namespace Microsoft.DotNet.Kestrel.Tests
var outputBase = new DirectoryInfo(Path.Combine(testRoot, "bin", "Debug"));
var netstandardappOutput = outputBase.Sub("netstandard1.5");
var netcoreAppOutput = outputBase.Sub("netcoreapp1.0");
netstandardappOutput.Should()
netcoreAppOutput.Should()
.Exist().And
.OnlyHaveFiles(new[]
{

View file

@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = new string[] {""},
ProjectDirectory = "/some/directory",
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -55,7 +55,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = new string[] {""},
ProjectDirectory = null,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -93,7 +93,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = new string[] {""},
ProjectDirectory = s_liveProjectDirectory,
Configuration = null,
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = null,
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -131,7 +131,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = null,
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -156,7 +156,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = new [] { "arg with space"},
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -176,7 +176,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = null,
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -196,13 +196,13 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = null,
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
OutputPath = AppContext.BaseDirectory
};
var projectContext = ProjectContext.Create(
s_liveProjectDirectory,
FrameworkConstants.CommonFrameworks.NetStandardApp15,
FrameworkConstants.CommonFrameworks.NetCoreApp10,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
var depsFilePath =
@ -225,13 +225,13 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = null,
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
BuildBasePath = AppContext.BaseDirectory
};
var projectContext = ProjectContext.Create(
s_liveProjectDirectory,
FrameworkConstants.CommonFrameworks.NetStandardApp15,
FrameworkConstants.CommonFrameworks.NetCoreApp10,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
var depsFilePath =
@ -254,7 +254,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandArguments = null,
ProjectDirectory = s_liveProjectDirectory,
Configuration = "Debug",
Framework = FrameworkConstants.CommonFrameworks.NetStandardApp15
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);

View file

@ -139,7 +139,7 @@ namespace StreamForwarderTests
buildCommand.Execute();
var buildOutputExe = "OutputStandardOutputAndError" + Constants.ExeSuffix;
var buildOutputPath = Path.Combine(binTestProjectPath, "bin/Debug/netstandardapp1.5", buildOutputExe);
var buildOutputPath = Path.Combine(binTestProjectPath, "bin/Debug/netcoreapp1.0", buildOutputExe);
return buildOutputPath;
}

View file

@ -29,8 +29,8 @@ namespace Microsoft.DotNet.ProjectModel.Tests
target.CompileTimeAssemblies.Add("lib/dotnet/_._");
target.NativeLibraries.Add("runtimes/any/native/Microsoft.CSharp.CurrentVersion.targets");
var p1 = provider.GetDescription(NuGetFramework.Parse("netstandardapp1.5"), package, target);
var p2 = provider.GetDescription(NuGetFramework.Parse("netstandardapp1.5"), package, target);
var p1 = provider.GetDescription(NuGetFramework.Parse("netcoreapp1.0"), package, target);
var p2 = provider.GetDescription(NuGetFramework.Parse("netcoreapp1.0"), package, target);
Assert.True(p1.Compatible);
Assert.True(p2.Compatible);

View file

@ -112,16 +112,16 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
$"StdErr:{Environment.NewLine}{_commandResult.StdErr}{Environment.NewLine}"; ;
}
public AndConstraint<CommandResultAssertions> HaveSkippedProjectCompilation(string skippedProject)
public AndConstraint<CommandResultAssertions> HaveSkippedProjectCompilation(string skippedProject, string frameworkFullName)
{
_commandResult.StdOut.Should().Contain($"Project {skippedProject} (.NETStandardApp,Version=v1.5) was previously compiled. Skipping compilation.");
_commandResult.StdOut.Should().Contain($"Project {skippedProject} ({frameworkFullName}) was previously compiled. Skipping compilation.");
return new AndConstraint<CommandResultAssertions>(this);
}
public AndConstraint<CommandResultAssertions> HaveCompiledProject(string compiledProject)
public AndConstraint<CommandResultAssertions> HaveCompiledProject(string compiledProject, string frameworkFullName)
{
_commandResult.StdOut.Should().Contain($"Project {compiledProject} (.NETStandardApp,Version=v1.5) will be compiled");
_commandResult.StdOut.Should().Contain($"Project {compiledProject} ({frameworkFullName}) will be compiled");
return new AndConstraint<CommandResultAssertions>(this);
}

View file

@ -69,6 +69,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
string config = string.IsNullOrEmpty(_config) ? "Debug" : _config;
string framework = string.IsNullOrEmpty(_framework) ?
_project.GetTargetFrameworks().First().FrameworkName.GetShortFolderName() : _framework;
if (!portable)
{
var runtime = string.IsNullOrEmpty(_runtime) ? PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier() : _runtime;

View file

@ -18,7 +18,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
/// </summary>
public abstract class TestBase : IDisposable
{
protected const string DefaultFramework = "netstandardapp1.5";
protected const string DefaultFramework = "netcoreapp1.0";
protected const string DefaultLibraryFramework = "netstandard1.5";
private TempRoot _temp;
private static TestAssetsManager s_testsAssetsMgr;
private static string s_repoRoot;

View file

@ -26,14 +26,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""runtimeTarget"": {
""name"":"".NETStandardApp,Version=v1.5/osx.10.10-x64""
""name"":"".NETCoreApp,Version=v1.0/osx.10.10-x64""
},
""targets"": {
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
"".NETCoreApp,Version=v1.0/osx.10.10-x64"": {},
}
}");
context.Target.IsPortable.Should().BeFalse();
context.Target.Framework.Should().Be(".NETStandardApp,Version=v1.5");
context.Target.Framework.Should().Be(".NETCoreApp,Version=v1.0");
context.Target.Runtime.Should().Be("osx.10.10-x64");
}
@ -78,7 +78,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""targets"": {
"".NETStandardApp,Version=v1.5"": {}
"".NETCoreApp,Version=v1.0"": {}
}
}");
context.Target.IsPortable.Should().BeTrue();
@ -90,10 +90,10 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""runtimeTarget"": {
""name"": "".NETStandardApp,Version=v1.5/osx.10.10-x64""
""name"": "".NETCoreApp,Version=v1.0/osx.10.10-x64""
},
""targets"": {
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {}
"".NETCoreApp,Version=v1.0/osx.10.10-x64"": {}
}
}");
context.Target.IsPortable.Should().BeFalse();
@ -105,10 +105,10 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""targets"": {
"".NETStandardApp,Version=v1.5"": {}
"".NETCoreApp,Version=v1.0"": {}
}
}");
context.Target.Framework.Should().Be(".NETStandardApp,Version=v1.5");
context.Target.Framework.Should().Be(".NETCoreApp,Version=v1.0");
}
[Fact]
@ -117,7 +117,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""targets"": {
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
"".NETCoreApp,Version=v1.0/osx.10.10-x64"": {},
},
""runtimes"": {
""osx.10.10-x64"": [ ],
@ -141,7 +141,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""targets"": {
"".NETStandardApp,Version=v1.5"": {
"".NETCoreApp,Version=v1.0"": {
""MyApp/1.0.1"": {
""dependencies"": {
""AspNet.Mvc"": ""1.0.0""
@ -192,10 +192,10 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var context = Read(
@"{
""runtimeTarget"": {
""name"": "".NETStandardApp,Version=v1.5""
""name"": "".NETCoreApp,Version=v1.0""
},
""targets"": {
"".NETStandardApp,Version=v1.5"": {
"".NETCoreApp,Version=v1.0"": {
""MyApp/1.0.1"": {
""dependencies"": {
""AspNet.Mvc"": ""1.0.0""
@ -257,9 +257,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
{
var context = Read(
@"{
""runtimeTarget"": "".NETStandardApp,Version=v1.5"",
""runtimeTarget"": "".NETCoreApp,Version=v1.0"",
""targets"": {
"".NETStandardApp,Version=v1.5"": {
"".NETCoreApp,Version=v1.0"": {
""System.Banana/1.0.0"": {
""runtimeTargets"": {
""runtime/win7-x64/lib/_._"": { ""assetType"": ""runtime"", ""rid"": ""win7-x64""},
@ -305,7 +305,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
""optimize"": true
},
""targets"": {
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
"".NETCoreApp,Version=v1.0/osx.10.10-x64"": {},
}
}");
context.CompilationOptions.AllowUnsafe.Should().Be(true);

View file

@ -33,7 +33,7 @@ namespace Microsoft.Extensions.DependencyModel
var runCommand = new RunCommand(testProject);
var result = runCommand.ExecuteWithCapturedOutput();
result.Should().Pass();
ValidateRuntimeLibrarites(result, appname);
ValidateRuntimeLibraries(result, appname);
if (checkCompilation)
{
ValidateCompilationLibraries(result, appname);
@ -56,7 +56,7 @@ namespace Microsoft.Extensions.DependencyModel
var exeName = portable ? publishCommand.GetPortableOutputName() : publishCommand.GetOutputExecutable();
var result = TestExecutable(publishCommand.GetOutputDirectory(portable).FullName, exeName, string.Empty);
ValidateRuntimeLibrarites(result, appname);
ValidateRuntimeLibraries(result, appname);
if (checkCompilation)
{
ValidateCompilationLibraries(result, appname);
@ -72,7 +72,7 @@ namespace Microsoft.Extensions.DependencyModel
var runCommand = new RunCommand(testProject);
var result = runCommand.ExecuteWithCapturedOutput();
result.Should().Pass();
ValidateRuntimeLibraritesFullClr(result, "TestAppFullClr");
ValidateRuntimeLibrariesFullClr(result, "TestAppFullClr");
ValidateCompilationLibrariesFullClr(result, "TestAppFullClr");
}
@ -86,11 +86,11 @@ namespace Microsoft.Extensions.DependencyModel
publishCommand.Execute().Should().Pass();
var result = TestExecutable(publishCommand.GetOutputDirectory().FullName, publishCommand.GetOutputExecutable(), string.Empty);
ValidateRuntimeLibraritesFullClr(result, "TestAppFullClr");
ValidateRuntimeLibrariesFullClr(result, "TestAppFullClr");
ValidateCompilationLibrariesFullClr(result, "TestAppFullClr");
}
private void ValidateRuntimeLibraritesFullClr(CommandResult result, string appname)
private void ValidateRuntimeLibrariesFullClr(CommandResult result, string appname)
{
// entry assembly
result.Should().HaveStdOutContaining($"Runtime {appname}:{appname}");
@ -109,7 +109,7 @@ namespace Microsoft.Extensions.DependencyModel
}
private void ValidateRuntimeLibrarites(CommandResult result, string appname)
private void ValidateRuntimeLibraries(CommandResult result, string appname)
{
// entry assembly
result.Should().HaveStdOutContaining($"Runtime {appname}:{appname}");

View file

@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli.Utils.ScriptExecutorTests
var sourceTestProjectPath = Path.Combine(s_testProjectRoot, "TestApp");
binTestProjectPath = _root.CopyDirectory(sourceTestProjectPath).Path;
project = ProjectContext.Create(binTestProjectPath, NuGetFramework.Parse("netstandardapp1.5")).ProjectFile;
project = ProjectContext.Create(binTestProjectPath, NuGetFramework.Parse("netcoreapp1.0")).ProjectFile;
}
[Fact]

View file

@ -101,7 +101,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
framework: DefaultFramework)
.ExecuteWithCapturedOutput().Should().Pass();
var libdebug = _rootDirInfo.Sub(FormatPath(expectedLibCompile, DefaultFramework, _runtime));
var libdebug = _rootDirInfo.Sub(FormatPath(expectedLibCompile, DefaultLibraryFramework, _runtime));
var appdebug = _rootDirInfo.Sub(FormatPath(expectedAppCompile, DefaultFramework, _runtime));
var appruntime = _rootDirInfo.Sub(FormatPath(expectedAppRuntime, DefaultFramework, _runtime));
@ -128,10 +128,10 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
new BuildCommand(GetProjectPath(_testLibDirInfo),
output: outputValue != null ? Path.Combine(_testProjectsRoot, outputValue) : string.Empty,
buildBasePath: baseValue != null ? Path.Combine(_testProjectsRoot, baseValue) : string.Empty,
framework: DefaultFramework)
framework: DefaultLibraryFramework)
.ExecuteWithCapturedOutput().Should().Pass();
var libdebug = _rootDirInfo.Sub(FormatPath(expectedLibCompile, DefaultFramework, _runtime));
var libdebug = _rootDirInfo.Sub(FormatPath(expectedLibCompile, DefaultLibraryFramework, _runtime));
libdebug.Should().Exist()
.And.HaveFiles(_libCompileFiles)
@ -144,12 +144,12 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var testInstance = TestAssetsManager.CreateTestInstance("TestLibraryWithConfiguration")
.WithLockFiles();
var cmd = new BuildCommand(Path.Combine(testInstance.TestRoot, Project.FileName), framework: DefaultFramework);
var cmd = new BuildCommand(Path.Combine(testInstance.TestRoot, Project.FileName), framework: DefaultLibraryFramework);
cmd.Environment["DOTNET_BUILD_VERSION"] = "85";
cmd.Environment["DOTNET_ASSEMBLY_FILE_VERSION"] = "345";
cmd.ExecuteWithCapturedOutput().Should().Pass();
var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, "TestLibraryWithConfiguration.dll");
var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultLibraryFramework, "TestLibraryWithConfiguration.dll");
var informationalVersion = PeReaderUtils.GetAssemblyAttributeValue(output, "AssemblyInformationalVersionAttribute");
var fileVersion = PeReaderUtils.GetAssemblyAttributeValue(output, "AssemblyFileVersionAttribute");
@ -166,10 +166,10 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var testInstance = TestAssetsManager.CreateTestInstance("TestLibraryWithConfiguration")
.WithLockFiles();
var cmd = new BuildCommand(Path.Combine(testInstance.TestRoot, Project.FileName), framework: DefaultFramework, versionSuffix: "85");
var cmd = new BuildCommand(Path.Combine(testInstance.TestRoot, Project.FileName), framework: DefaultLibraryFramework, versionSuffix: "85");
cmd.ExecuteWithCapturedOutput().Should().Pass();
var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, "TestLibraryWithConfiguration.dll");
var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultLibraryFramework, "TestLibraryWithConfiguration.dll");
var informationalVersion = PeReaderUtils.GetAssemblyAttributeValue(output, "AssemblyInformationalVersionAttribute");
informationalVersion.Should().NotBeNull();
@ -180,7 +180,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
// [InlineData("net20", false, true)]
// [InlineData("net40", true, true)]
// [InlineData("net461", true, true)]
[InlineData("netstandardapp1.5", true, false)]
[InlineData("netstandard1.5", true, false)]
public void MultipleFrameworks_ShouldHaveValidTargetFrameworkAttribute(string frameworkName, bool shouldHaveTargetFrameworkAttribute, bool windowsOnly)
{
var framework = NuGetFramework.Parse(frameworkName);
@ -274,7 +274,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
new BuildCommand(GetProjectPath(_testAppDirDirInfo), framework: DefaultFramework)
.ExecuteWithCapturedOutput().Should().Pass();
var libdebug = _testLibDirInfo.Sub("bin/Debug").Sub(DefaultFramework);
var libdebug = _testLibDirInfo.Sub("bin/Debug").Sub(DefaultLibraryFramework);
var appdebug = _testAppDirDirInfo.Sub("bin/Debug").Sub(DefaultFramework);
var appruntime = appdebug.Sub(_runtime);

View file

@ -14,9 +14,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
var netstandardappOutput = Build(testInstance);
var netcoreAppOutput = Build(testInstance);
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.deps.json");
netcoreAppOutput.Should().Exist().And.HaveFile("PortableApp.deps.json");
}
[Fact]
@ -24,9 +24,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
var netstandardappOutput = Build(testInstance);
var netcoreAppOutput = Build(testInstance);
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.dll");
netcoreAppOutput.Should().Exist().And.HaveFile("PortableApp.dll");
}
[Fact]
@ -34,9 +34,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
var netstandardappOutput = Build(testInstance);
var netcoreAppOutput = Build(testInstance);
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.pdb");
netcoreAppOutput.Should().Exist().And.HaveFile("PortableApp.pdb");
}
[Fact]
@ -44,9 +44,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
var netstandardappOutput = Build(testInstance);
var netcoreAppOutput = Build(testInstance);
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.runtimeconfig.json");
netcoreAppOutput.Should().Exist().And.HaveFile("PortableApp.runtimeconfig.json");
}
[Fact]
@ -55,9 +55,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests")
.WithLockFiles();
var netstandardappOutput = Build(testInstance);
var netcoreAppOutput = Build(testInstance);
var runtimeConfigJsonPath = Path.Combine(netstandardappOutput.FullName, "PortableApp.runtimeconfig.json");
var runtimeConfigJsonPath = Path.Combine(netcoreAppOutput.FullName, "PortableApp.runtimeconfig.json");
using (var stream = new FileStream(runtimeConfigJsonPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
@ -78,9 +78,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
var netstandardappOutput = Build(testInstance);
var netcoreAppOutput = Build(testInstance);
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.runtimeconfig.dev.json");
netcoreAppOutput.Should().Exist().And.HaveFile("PortableApp.runtimeconfig.dev.json");
}
private DirectoryInfo Build(TestInstance testInstance)
@ -93,7 +93,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var outputBase = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "PortableApp", "bin", "Debug"));
return outputBase.Sub("netstandard1.5");
return outputBase.Sub("netcoreapp1.0");
}
}
}

View file

@ -16,7 +16,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
public class ProjectToProjectDependenciesIncrementalTest : IncrementalTestBase
{
private readonly string[] _projects = new[] { "L0", "L11", "L12", "L21", "L22" };
private readonly string _appProject = "L0";
private string MainProjectExe
{
get
@ -32,13 +34,12 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
}
[Theory,
InlineData("1", "L0", new[] { "L0" }),
InlineData("2", "L11", new[] { "L0", "L11" }),
InlineData("3", "L12", new[] { "L0", "L11", "L12" }),
InlineData("4", "L22", new[] { "L0", "L11", "L12", "L22" }),
InlineData("5", "L21", new[] { "L0", "L11", "L21" })
]
[Theory]
[InlineData("1", "L0", new[] { "L0" })]
[InlineData("2", "L11", new[] { "L0", "L11" })]
[InlineData("3", "L12", new[] { "L0", "L11", "L12" })]
[InlineData("4", "L22", new[] { "L0", "L11", "L12", "L22" })]
[InlineData("5", "L21", new[] { "L0", "L11", "L21" })]
public void TestIncrementalBuildOfDependencyGraph(string testIdentifer, string projectToTouch, string[] expectedRebuiltProjects)
{
var testInstance = TestAssetsManager.CreateTestInstance("TestProjectToProjectDependencies", identifier: testIdentifer)
@ -81,7 +82,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
// third build with no dependencies but incremental; nothing rebuilds
var result3 = BuildProject(noDependencies: true);
result3.Should().HaveSkippedProjectCompilation("L0");
result3.Should().HaveSkippedProjectCompilation("L0", _appFrameworkFullName);
AssertResultDoesNotContainStrings(result3, dependencies);
}
@ -105,15 +106,40 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
foreach (var rebuiltProject in expectedRebuilt)
{
buildResult.Should().HaveCompiledProject(rebuiltProject);
string frameworkFullName = null;
if (TestProjectIsApp(rebuiltProject))
{
buildResult
.Should()
.HaveCompiledProject(rebuiltProject, frameworkFullName: _appFrameworkFullName);
}
else
{
buildResult
.Should()
.HaveCompiledProject(rebuiltProject, _libraryFrameworkFullName);
}
}
foreach (var skippedProject in SetDifference(_projects, expectedRebuilt))
{
buildResult.Should().HaveSkippedProjectCompilation(skippedProject);
if (TestProjectIsApp(skippedProject))
{
buildResult.Should().HaveSkippedProjectCompilation(skippedProject, _appFrameworkFullName);
}
else
{
buildResult.Should().HaveSkippedProjectCompilation(skippedProject, _libraryFrameworkFullName);
}
}
}
private bool TestProjectIsApp(string testproject)
{
return testproject.Equals(_appProject, StringComparison.OrdinalIgnoreCase);
}
protected override string GetProjectDirectory(string projectName)
{
return Path.Combine(TestProjectRoot, "src", projectName);

View file

@ -79,7 +79,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
result.Should().Pass();
var outputBase = new DirectoryInfo(
Path.Combine(testInstance.TestRoot, "StandaloneApp", "bin", "Debug", "netstandardapp1.5"));
Path.Combine(testInstance.TestRoot, "StandaloneApp", "bin", "Debug", "netcoreapp1.0"));
return outputBase.Sub(runtime);
}

View file

@ -12,6 +12,9 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
public class IncrementalTestBase : TestBase
{
protected readonly string _libraryFrameworkFullName = ".NETStandard,Version=v1.5";
protected readonly string _appFrameworkFullName = ".NETCoreApp,Version=v1.0";
protected virtual string MainProject
{
get; set;
@ -66,7 +69,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
protected CommandResult BuildProject(string projectFile, bool noDependencies = false, bool noIncremental = false, bool expectBuildFailure = false)
{
var buildCommand = new BuildCommand(projectFile, output: GetOutputDir(), framework: "netstandardapp1.5", noIncremental: noIncremental, noDependencies : noDependencies);
var buildCommand = new BuildCommand(projectFile, output: GetOutputDir(), framework: "netcoreapp1.0", noIncremental: noIncremental, noDependencies : noDependencies);
var result = buildCommand.ExecuteWithCapturedOutput();
if (!expectBuildFailure)
@ -120,14 +123,14 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
protected string GetCompilationOutputPath()
{
var executablePath = Path.Combine(GetBinRoot(), "Debug", "netstandardapp1.5");
var executablePath = Path.Combine(GetBinRoot(), "Debug", "netcoreapp1.0");
return executablePath;
}
protected string GetIntermediaryOutputPath()
{
var executablePath = Path.Combine(TestProjectRoot, "obj", "Debug", "netstandardapp1.5");
var executablePath = Path.Combine(TestProjectRoot, "obj", "Debug", "netcoreapp1.0");
return executablePath;
}

View file

@ -14,7 +14,6 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
public class IncrementalTests : IncrementalTestBase
{
public IncrementalTests()
{
MainProject = "TestSimpleIncrementalApp";
@ -36,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
CreateTestInstance();
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
buildResult = BuildProject(noIncremental: true);
Assert.Contains("[Forced Unsafe]", buildResult.StdOut);
@ -68,7 +67,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
CreateTestInstance();
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
var lockFile = Path.Combine(TestProjectRoot, "project.lock.json");
Assert.True(File.Exists(lockFile));
@ -84,7 +83,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
public void TestModifiedVersionFile()
{
CreateTestInstance();
BuildProject().Should().HaveCompiledProject(MainProject);
BuildProject().Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
//change version file
var versionFile = Path.Combine(GetIntermediaryOutputPath(), ".SDKVersion");
@ -92,14 +91,14 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
File.AppendAllText(versionFile, "text");
//assert rebuilt
BuildProject().Should().HaveCompiledProject(MainProject);
BuildProject().Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
}
[Fact]
public void TestNoVersionFile()
{
CreateTestInstance();
BuildProject().Should().HaveCompiledProject(MainProject);
BuildProject().Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
//delete version file
var versionFile = Path.Combine(GetIntermediaryOutputPath(), ".SDKVersion");
@ -108,7 +107,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
File.Exists(versionFile).Should().BeFalse();
//assert build skipped due to no version file
BuildProject().Should().HaveSkippedProjectCompilation(MainProject);
BuildProject().Should().HaveSkippedProjectCompilation(MainProject, _appFrameworkFullName);
//the version file should have been regenerated during the build, even if compilation got skipped
File.Exists(versionFile).Should().BeTrue();
@ -119,13 +118,13 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
CreateTestInstance();
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
var lockFile = Path.Combine(TestProjectRoot, "project.lock.json");
TouchFile(lockFile);
buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
}
[Fact]
@ -133,12 +132,12 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
CreateTestInstance();
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
TouchFile(GetProjectFile(MainProject));
buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
}
// regression for https://github.com/dotnet/cli/issues/965
@ -147,7 +146,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
CreateTestInstance();
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
var outputTimestamp = SetAllOutputItemsToSameTime();
@ -157,7 +156,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
File.SetLastWriteTime(GetProjectFile(MainProject), outputTimestamp);
buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
}
private DateTime SetAllOutputItemsToSameTime()
@ -174,7 +173,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
{
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
Reporter.Verbose.WriteLine($"Files in {GetBinRoot()}");
foreach (var file in Directory.EnumerateFiles(GetBinRoot()))
@ -198,7 +197,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
// second build; should get rebuilt since we deleted an output item
buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
}
}
}

View file

@ -26,11 +26,11 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
TestProjectRoot = testInstance.TestRoot;
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
buildResult = BuildProject();
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
buildResult.Should().HaveSkippedProjectCompilation(MainProject, _appFrameworkFullName);
}
}
}

View file

@ -25,10 +25,10 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
TestProjectRoot = testInstance.TestRoot;
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
buildResult = BuildProject();
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
buildResult.Should().HaveSkippedProjectCompilation(MainProject, _appFrameworkFullName);
}
}
}

View file

@ -27,17 +27,17 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
.WithLockFiles();
TestProjectRoot = testInstance.TestRoot;
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult.Should().HaveCompiledProject(TestLibraryWithAppDependency);
buildResult.Should().HaveCompiledProject(AppProject);
buildResult.Should().HaveCompiledProject(LibraryProject);
buildResult.Should().HaveCompiledProject(MainProject, _appFrameworkFullName);
buildResult.Should().HaveCompiledProject(TestLibraryWithAppDependency, _appFrameworkFullName);
buildResult.Should().HaveCompiledProject(AppProject, _appFrameworkFullName);
buildResult.Should().HaveCompiledProject(LibraryProject, _appFrameworkFullName);
buildResult = BuildProject();
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
buildResult.Should().HaveSkippedProjectCompilation(TestLibraryWithAppDependency);
buildResult.Should().HaveSkippedProjectCompilation(AppProject);
buildResult.Should().HaveSkippedProjectCompilation(LibraryProject);
buildResult.Should().HaveSkippedProjectCompilation(MainProject, _appFrameworkFullName);
buildResult.Should().HaveSkippedProjectCompilation(TestLibraryWithAppDependency, _appFrameworkFullName);
buildResult.Should().HaveSkippedProjectCompilation(AppProject, _appFrameworkFullName);
buildResult.Should().HaveSkippedProjectCompilation(LibraryProject, _appFrameworkFullName);
}
protected override string GetProjectDirectory(string projectName)

View file

@ -35,12 +35,12 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
// run compile
var outputDir = Path.Combine(testLibDir.Path, "bin");
var testProject = GetProjectPath(testLibDir);
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultLibraryFramework);
var result = buildCommand.ExecuteWithCapturedOutput();
result.Should().Pass();
// verify the output xml file
var outputXml = Path.Combine(outputDir, "Debug", DefaultFramework, "TestLibrary.xml");
var outputXml = Path.Combine(outputDir, "Debug", DefaultLibraryFramework, "TestLibrary.xml");
Console.WriteLine("OUTPUT XML PATH: " + outputXml);
Assert.True(File.Exists(outputXml));
Assert.Contains("Gets the message from the helper", File.ReadAllText(outputXml));
@ -84,7 +84,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
// run compile
var outputDir = Path.Combine(testLibDir.Path, "bin");
var testProject = GetProjectPath(testLibDir);
var buildCmd = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
var buildCmd = new BuildCommand(testProject, output: outputDir, framework: DefaultLibraryFramework);
var result = buildCmd.ExecuteWithCapturedOutput();
result.Should().Pass();
@ -158,7 +158,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var root = testInstance.TestRoot;
var outputDir = Path.Combine(root, "bin");
var testProject = ProjectUtils.GetProjectJson(root, "LibraryWithOutputAssemblyName");
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultLibraryFramework);
var result = buildCommand.ExecuteWithCapturedOutput();
result.Should().Pass();

View file

@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
_contexts = new List<ProjectContext>
{
ProjectContext.Create(_projectJson, NuGetFramework.Parse("netstandardapp1.5"))
ProjectContext.Create(_projectJson, NuGetFramework.Parse("netcoreapp1.0"))
};
_args = new CompilerCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform");

View file

@ -28,14 +28,14 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
public void It_passes_a_FullTargetFramework_variable_to_the_pre_compile_scripts()
{
_fixture.PreCompileScriptVariables.Should().ContainKey("compile:FullTargetFramework");
_fixture.PreCompileScriptVariables["compile:FullTargetFramework"].Should().Be(".NETStandardApp,Version=v1.5");
_fixture.PreCompileScriptVariables["compile:FullTargetFramework"].Should().Be(".NETCoreApp,Version=v1.0");
}
[Fact]
public void It_passes_a_TargetFramework_variable_to_the_pre_compile_scripts()
{
_fixture.PreCompileScriptVariables.Should().ContainKey("compile:TargetFramework");
_fixture.PreCompileScriptVariables["compile:TargetFramework"].Should().Be("netstandardapp1.5");
_fixture.PreCompileScriptVariables["compile:TargetFramework"].Should().Be("netcoreapp1.0");
}
[Fact]
@ -80,14 +80,14 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
public void It_passes_a_FullTargetFramework_variable_to_the_post_compile_scripts()
{
_fixture.PostCompileScriptVariables.Should().ContainKey("compile:FullTargetFramework");
_fixture.PostCompileScriptVariables["compile:FullTargetFramework"].Should().Be(".NETStandardApp,Version=v1.5");
_fixture.PostCompileScriptVariables["compile:FullTargetFramework"].Should().Be(".NETCoreApp,Version=v1.0");
}
[Fact]
public void It_passes_a_TargetFramework_variable_to_the_post_compile_scripts()
{
_fixture.PostCompileScriptVariables.Should().ContainKey("compile:TargetFramework");
_fixture.PostCompileScriptVariables["compile:TargetFramework"].Should().Be("netstandardapp1.5");
_fixture.PostCompileScriptVariables["compile:TargetFramework"].Should().Be("netcoreapp1.0");
}
[Fact]
@ -138,6 +138,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
public class ScriptVariablesFixture
{
public readonly NuGetFramework TestAssetFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
public const string ConfigValue = "Debug";
public static string TestAssetPath = Path.Combine(
@ -151,7 +152,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
TestAssetPath,
"bin",
ConfigValue,
"netstandardapp1.5");
"netcoreapp1.0");
public string RuntimeOutputDir { get; private set; }
@ -161,7 +162,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
TestAssetPath,
"obj",
ConfigValue,
"netstandardapp1.5",
"netcoreapp1.0",
"dotnet-compile.rsp");
public Dictionary<string, string> PreCompileScriptVariables { get; private set; }
@ -218,7 +219,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
rids.Add(rid);
}
var context = ProjectContext.Create(projectJson, new NuGetFramework(".NETStandardApp", new Version(1, 5)), rids);
var context = ProjectContext.Create(projectJson, TestAssetFramework, rids);
managedCompiler.Compile(context, _args);
RuntimeOutputDir = Path.Combine(OutputPath, rid);

View file

@ -31,8 +31,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
var testProject = GetProjectPath(testLibDir);
var buildCommand = new PackCommand(testProject, configuration: "Test");
var result = buildCommand.Execute();
var packCommand = new PackCommand(testProject, configuration: "Test");
var result = packCommand.Execute();
result.Should().Pass();
var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin", "Test"));
@ -52,8 +52,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin2"));
var testProject = GetProjectPath(testLibDir);
var buildCommand = new PackCommand(testProject, output: outputDir.FullName);
var result = buildCommand.Execute();
var packCommand = new PackCommand(testProject, output: outputDir.FullName);
var result = packCommand.Execute();
result.Should().Pass();
outputDir.Should().Exist();
@ -69,7 +69,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var cmd = new PackCommand(Path.Combine(testInstance.TestRoot, Project.FileName), versionSuffix: "85");
cmd.Execute().Should().Pass();
var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, "TestLibraryWithConfiguration.dll");
var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultLibraryFramework, "TestLibraryWithConfiguration.dll");
var informationalVersion = PeReaderUtils.GetAssemblyAttributeValue(output, "AssemblyInformationalVersionAttribute");
informationalVersion.Should().NotBeNull();
@ -92,7 +92,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
File.Exists(outputPackage).Should().BeTrue(outputPackage);
var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read);
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandardapp1.5/TestLibraryWithConfiguration.dll");
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandard1.5/TestLibraryWithConfiguration.dll");
}
[Fact]
@ -109,13 +109,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var outputPackage = Path.Combine(testInstance.TestRoot, "bin", "Debug", "LibraryWithOutputAssemblyName.1.0.0.nupkg");
File.Exists(outputPackage).Should().BeTrue(outputPackage);
var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read);
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandardapp1.5/MyLibrary.dll");
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandard1.5/MyLibrary.dll");
var symbolsPackage = Path.Combine(testInstance.TestRoot, "bin", "Debug", "LibraryWithOutputAssemblyName.1.0.0.symbols.nupkg");
File.Exists(symbolsPackage).Should().BeTrue(symbolsPackage);
zip = ZipFile.Open(symbolsPackage, ZipArchiveMode.Read);
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandardapp1.5/MyLibrary.dll");
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandardapp1.5/MyLibrary.pdb");
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandard1.5/MyLibrary.dll");
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandard1.5/MyLibrary.pdb");
}
private void CopyProjectToTempDir(string projectDir, TempDirectory tempDir)

View file

@ -75,7 +75,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
.AssertJArrayCount(2)
.Select(f => f["ShortName"].Value<string>());
Assert.Contains("netstandardapp1.5", frameworkShortNames);
Assert.Contains("netcoreapp1.0", frameworkShortNames);
Assert.Contains("dnx451", frameworkShortNames);
}
}

View file

@ -23,6 +23,40 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
_testProjectsRoot = Path.Combine(RepoRoot, "TestAssets", "TestProjects");
}
private static readonly dynamic[] CrossPublishTestData = new[]
{
new
{
Rid="centos.7-x64",
HostExtension="",
ExpectedArtifacts=new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" }
},
new
{
Rid="rhel.7.2-x64",
HostExtension="",
ExpectedArtifacts=new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" }
},
new
{
Rid="ubuntu.14.04-x64",
HostExtension="",
ExpectedArtifacts=new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" }
},
new
{
Rid="win7-x64",
HostExtension=".exe",
ExpectedArtifacts=new string[] { "hostfxr.dll", "coreclr.dll", "hostpolicy.dll" }
},
new
{
Rid="osx.10.11-x64",
HostExtension="",
ExpectedArtifacts=new string[] { "libhostfxr.dylib", "libcoreclr.dylib", "libhostpolicy.dylib" }
}
};
public static IEnumerable<object[]> PublishOptions
{
get
@ -30,12 +64,12 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
return new[]
{
new object[] { "1", "", "", "", "" },
new object[] { "2", "netstandardapp1.5", "", "", "" },
new object[] { "2", "netcoreapp1.0", "", "", "" },
new object[] { "3", "", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "", "" },
new object[] { "4", "", "", "Release", "" },
new object[] { "5", "", "", "", "some/dir"},
new object[] { "6", "", "", "", "some/dir/with spaces" },
new object[] { "7", "netstandardapp1.5", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
new object[] { "7", "netcoreapp1.0", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
};
}
}
@ -92,19 +126,13 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
publishCommand.Execute().Should().Fail();
}
[Theory]
[InlineData("centos.7-x64", "", new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" })]
[InlineData("rhel.7.2-x64", "", new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" })]
[InlineData("ubuntu.14.04-x64", "", new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" })]
[InlineData("win7-x64", ".exe", new string[] { "hostfxr.dll", "coreclr.dll", "hostpolicy.dll" })]
[InlineData("osx.10.11-x64", "", new string[] { "libhostfxr.dylib", "libcoreclr.dylib", "libhostpolicy.dylib" })]
public void CrossPublishingSucceedsAndHasExpectedArtifacts(string rid, string hostExtension, string[] expectedArtifacts)
[Fact]
public void CrossPublishingSucceedsAndHasExpectedArtifacts()
{
var testNugetCache = "packages_cross_publish_test";
TestInstance instance = GetTestGroupTestAssetsManager("CrossPublishTestProjects")
.CreateTestInstance("StandaloneAppCrossPublish");
TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine("PortableTests"));
var testProject = Path.Combine(instance.TestRoot, "project.json");
var testProject = Path.Combine(instance.TestRoot, "StandaloneApp", "project.json");
var restoreCommand = new RestoreCommand();
@ -112,23 +140,26 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
restoreCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
restoreCommand.Execute().Should().Pass();
var buildCommand = new BuildCommand(testProject, runtime: rid);
buildCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
buildCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
buildCommand.Execute().Should().Pass();
var publishCommand = new PublishCommand(testProject, runtime: rid, noBuild: true);
publishCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
publishCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
publishCommand.Execute().Should().Pass();
var publishedDir = publishCommand.GetOutputDirectory();
publishedDir.Should().HaveFile("StandaloneAppCrossPublish"+ hostExtension);
foreach (var artifact in expectedArtifacts)
foreach (var testData in CrossPublishTestData)
{
publishedDir.Should().HaveFile(artifact);
var buildCommand = new BuildCommand(testProject, runtime: testData.Rid);
buildCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
buildCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
buildCommand.Execute().Should().Pass();
var publishCommand = new PublishCommand(testProject, runtime: testData.Rid, noBuild: true);
publishCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
publishCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
publishCommand.Execute().Should().Pass();
var publishedDir = publishCommand.GetOutputDirectory();
publishedDir.Should().HaveFile("StandaloneApp"+ testData.HostExtension);
foreach (var artifact in testData.ExpectedArtifacts)
{
publishedDir.Should().HaveFile(artifact);
}
}
}
@ -147,12 +178,11 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
publishCommand.Execute().Should().Pass();
}
[Fact]
public void LibraryPublishTest()
[Fact(Skip="https://github.com/dotnet/cli/issues/2536")]
public void PublishedLibraryShouldOutputDependenciesAndNoHost()
{
TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine("TestAppWithLibrary"))
.WithLockFiles()
.WithBuildArtifacts();
.WithLockFiles();
var testProject = _getProjectJson(instance.TestRoot, "TestLibrary");
var publishCommand = new PublishCommand(testProject);
@ -165,7 +195,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
publishCommand.GetOutputDirectory().Should().HaveFile("System.Runtime.dll");
}
[WindowsOnlyFact]
[WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/2536")]
public void TestLibraryBindingRedirectGeneration()
{
TestInstance instance = TestAssetsManager.CreateTestInstance("TestBindingRedirectGeneration")
@ -186,7 +216,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll");
publishCommand.GetOutputDirectory().Delete(true);
publishCommand = new PublishCommand(lesserTestProject, "netstandardapp1.5", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier());
publishCommand = new PublishCommand(lesserTestProject, "netstandard1.5", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier());
publishCommand.Execute().Should().Pass();
publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll");

View file

@ -19,9 +19,8 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
public GivenThatWeWantToRunTestsInTheConsole()
{
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance =
testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests");
TestAssetsManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests");
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework(

View file

@ -19,8 +19,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
public GivenThatWeWantToUseDotnetTestE2EInDesignTime()
{
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests");
var testInstance = TestAssetsManager.CreateTestInstance("ProjectWithTests");
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework(

View file

@ -16,6 +16,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
private static readonly string ProjectJsonPath = Path.Combine(
AppContext.BaseDirectory,
"TestAssets",
"TestProjects",
"ProjectWithTests",
"project.json");

View file

@ -12,7 +12,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
public class GivenThatWeWantToParseArgumentsForDotnetTest
{
private const string ProjectJson = "project.json";
private const string Framework = "netstandardapp1.5";
private const string Framework = "netcoreapp1.0";
private const string Output = "some output";
private const string BuildBasePath = "some build base path";
private const string Config = "some config";
@ -108,7 +108,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
[Fact]
public void It_converts_the_framework_to_NugetFramework()
{
_dotnetTestFullParams.Framework.DotNetFrameworkName.Should().Be(".NETStandardApp,Version=v1.5");
_dotnetTestFullParams.Framework.DotNetFrameworkName.Should().Be(".NETCoreApp,Version=v1.0");
}
[Fact]

View file

@ -28,7 +28,7 @@
}
},
"content": [
"../../TestAssets/ProjectWithTests/project.json"
"../../TestAssets/TestProjects/ProjectWithTests/project.json"
],
"testRunner": "xunit"
}

View file

@ -90,7 +90,7 @@ namespace Microsoft.DotNet.Tests
var projectOutputPath = $"AppWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
return new[]
{
new object[] { ".NETStandard,Version=v1.5", "CoreFX", "lib\\netstandard1.5\\dotnet-desktop-and-portable.dll" },
new object[] { ".NETCoreApp,Version=v1.0", "CoreFX", "lib\\netcoreapp1.0\\dotnet-desktop-and-portable.dll" },
new object[] { ".NETFramework,Version=v4.5.1", "NetFX", projectOutputPath }
};
}