Making some of the testbase methods protected.

Renaming variables according to code review comments. Adding the folder logic to the builder tests. Creating a separate compilation folder during the build.
This commit is contained in:
Livar Cunha 2016-01-21 15:01:21 -08:00 committed by Livar Cunha
parent b459c3665e
commit fdea0b87e0
24 changed files with 132 additions and 131 deletions

View file

@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetOutputExecutableName(), s_expectedOutput);
var binariesOutputDirectory = GetBinariesOutputDirectory(OutputDirectory, false);
var binariesOutputDirectory = GetCompilationOutputPath(OutputDirectory, false);
var latestWriteTimeFirstBuild = GetLastWriteTimeOfDirectoryFiles(
binariesOutputDirectory);
@ -125,7 +125,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
// first build
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, native: true, nativeCppMode: true);
var binariesOutputDirectory = GetBinariesOutputDirectory(OutputDirectory, false);
var binariesOutputDirectory = GetCompilationOutputPath(OutputDirectory, false);
buildCommand.Execute().Should().Pass();

View file

@ -100,7 +100,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
private string GetOutputFileForProject(string projectName)
{
return Path.Combine(GetBinDirectory(), projectName + ".dll");
return Path.Combine(GetCompilationOutputPath(), projectName + ".dll");
}
private IEnumerable<string> GetSourceFilesForProject(string projectName)
@ -109,6 +109,13 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
Where(f => f.EndsWith(".cs"));
}
protected string GetCompilationOutputPath()
{
var executablePath = Path.Combine(GetBinDirectory(), "Debug", "dnxcore50");
return executablePath;
}
private void RunRestore(string args)
{
var restoreCommand = new RestoreCommand();

View file

@ -102,14 +102,14 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var buildResult = BuildProject();
AssertProjectCompiled(_mainProject, buildResult);
Reporter.Verbose.WriteLine($"Files in {GetBinDirectory()}");
foreach (var file in Directory.EnumerateFiles(GetBinDirectory()))
Reporter.Verbose.WriteLine($"Files in {GetCompilationOutputPath()}");
foreach (var file in Directory.EnumerateFiles(GetCompilationOutputPath()))
{
Reporter.Verbose.Write($"\t {file}");
}
// delete output files with extensions
foreach (var outputFile in Directory.EnumerateFiles(GetBinDirectory()).Where(f =>
foreach (var outputFile in Directory.EnumerateFiles(GetCompilationOutputPath()).Where(f =>
{
var fileName = Path.GetFileName(f);
return fileName.StartsWith(_mainProject, StringComparison.OrdinalIgnoreCase) &&

View file

@ -64,7 +64,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
string expectedOutput,
bool native = false)
{
var executablePath = Path.Combine(GetBinariesOutputDirectory(outputDir, native), executableName);
var executablePath = Path.Combine(GetCompilationOutputPath(outputDir, native), executableName);
var executableCommand = new TestCommand(executablePath);
@ -75,12 +75,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
result.Should().Pass();
}
private void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput)
protected void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput)
{
TestOutputExecutable(outputDir, executableName, expectedOutput, true);
}
private string GetBinariesOutputDirectory(string outputDir, bool native)
protected string GetCompilationOutputPath(string outputDir, bool native)
{
var executablePath = Path.Combine(outputDir, "Debug", "dnxcore50");
if (native)