Test Changes to work with new Argument Escaping and Command Infra
This commit is contained in:
parent
8d0fada156
commit
37445f053d
18 changed files with 93 additions and 45 deletions
|
@ -2,7 +2,7 @@
|
|||
<configuration>
|
||||
<packageSources>
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<clear />
|
||||
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="nugetbuild" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" />
|
||||
<add key="AspNetCIDev" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>65741cb1-8aee-4c66-8198-10a7ea0e4258</ProjectGuid>
|
||||
<RootNamespace>E2E</RootNamespace>
|
||||
<RootNamespace>Microsoft.DotNet.Tests.EndToEnd</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
{
|
||||
private static readonly string s_expectedOutput = "Hello World!" + Environment.NewLine;
|
||||
private static readonly string s_testdirName = "e2etestroot";
|
||||
private static readonly string s_outputdirName = "testbin";
|
||||
private static readonly string s_outputdirName = "test space/bin";
|
||||
|
||||
private string Rid { get; set; }
|
||||
private string TestDirectory { get; set; }
|
||||
|
@ -51,8 +51,6 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
[Fact]
|
||||
public void TestDotnetIncrementalBuild()
|
||||
{
|
||||
TestSetup();
|
||||
|
||||
// first build
|
||||
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory);
|
||||
buildCommand.Execute().Should().Pass();
|
||||
|
|
|
@ -5,19 +5,21 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library" : "1.0.0-rc2-23704",
|
||||
"NETStandard.Library" : "1.0.0-rc2-23706",
|
||||
|
||||
"xunit": "2.1.0",
|
||||
"xunit.console.netcore": "1.0.2-prerelease-00101",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-*",
|
||||
"xunit.runner.utility": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-dev-*",
|
||||
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": "1.0.0-*"
|
||||
"Microsoft.DotNet.ProjectModel": {"target":"project"},
|
||||
"Microsoft.DotNet.Cli.Utils": {"target":"project"},
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": {"target":"project"}
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
},
|
||||
"testRunner":"xunit"
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530",
|
||||
|
||||
"Microsoft.DotNet.ProjectModel.Loader": "1.0.0-*"
|
||||
"Microsoft.DotNet.ProjectModel.Loader": {"target":"project"}
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23704",
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23706",
|
||||
"Microsoft.DotNet.ProjectModel": {"target":"project"},
|
||||
"Microsoft.DotNet.ProjectModel.Server": {"target":"project"},
|
||||
"Newtonsoft.Json": "7.0.1",
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
new object[] { "", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "", "" },
|
||||
new object[] { "", "", "Release", "" },
|
||||
new object[] { "", "", "", "some/dir"},
|
||||
//new object[] { "", "", "", "\"some/dir/with spaces\"" }, // issue - https://github.com/dotnet/cli/issues/525
|
||||
new object[] { "", "", "", "some/dir/with spaces" },
|
||||
new object[] { "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23704",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-*",
|
||||
"System.Text.RegularExpressions": "4.0.11-*",
|
||||
"NETStandard.Library": "1.0.0-rc2-23706",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23706",
|
||||
"System.Text.RegularExpressions": "4.0.11-rc2-23706",
|
||||
|
||||
"xunit": "2.1.0",
|
||||
"xunit.console.netcore": "1.0.2-prerelease-00101",
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
return _outputDirectory == string.Empty ?
|
||||
"" :
|
||||
$"-o {_outputDirectory}";
|
||||
$"-o \"{_outputDirectory}\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return $"{BuildProfile} {ForceIncrementalUnsafe} {_projectPath} {OutputOption} {TempOutputOption} {ConfigurationOption} {NoHostOption} {NativeOption} {ArchitectureOption} {IlcArgsOption} {IlcPathOption} {AppDepSDKPathOption} {NativeCppModeOption} {CppCompilerFlagsOption}";
|
||||
return $"{BuildProfile} {ForceIncrementalUnsafe} \"{_projectPath}\" {OutputOption} {TempOutputOption} {ConfigurationOption} {NoHostOption} {NativeOption} {ArchitectureOption} {IlcArgsOption} {IlcPathOption} {AppDepSDKPathOption} {NativeCppModeOption} {CppCompilerFlagsOption}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
return _outputDirectory == string.Empty ?
|
||||
"" :
|
||||
$"-o {_outputDirectory}";
|
||||
$"-o \"{_outputDirectory}\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
private string GetOutputOption()
|
||||
{
|
||||
return string.IsNullOrEmpty(_output) ? "" : $"-o {_output}";
|
||||
return string.IsNullOrEmpty(_output) ? "" : $"-o \"{_output}\"";
|
||||
}
|
||||
|
||||
private string GetConfigOption()
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
return _projectPath == string.Empty ?
|
||||
"" :
|
||||
$"-p {_projectPath}";
|
||||
$"-p \"{_projectPath}\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
get
|
||||
{
|
||||
return _preserveTemporary ?
|
||||
$"-t {_projectPath}" :
|
||||
$"-t \"{_projectPath}\"" :
|
||||
"";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
|
@ -19,23 +20,69 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
public virtual CommandResult Execute(string args = "")
|
||||
{
|
||||
Console.WriteLine($"Executing - {_command} {args}");
|
||||
var commandResult = Command.Create(_command, args)
|
||||
.ForwardStdErr()
|
||||
.ForwardStdOut()
|
||||
.Execute();
|
||||
|
||||
return commandResult;
|
||||
var commandPath = Env.GetCommandPath(_command) ??
|
||||
Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, _command);
|
||||
|
||||
var stdOut = new StreamForwarder();
|
||||
var stdErr = new StreamForwarder();
|
||||
|
||||
stdOut.ForwardTo(write: Reporter.Output.Write, writeLine: Reporter.Output.WriteLine);
|
||||
stdErr.ForwardTo(write: Reporter.Error.Write, writeLine: Reporter.Output.WriteLine);
|
||||
|
||||
return RunProcess(commandPath, args, stdOut, stdErr);
|
||||
}
|
||||
|
||||
public virtual CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
Console.WriteLine($"Executing (Captured Output) - {_command} {args}");
|
||||
var commandResult = Command.Create(_command, args)
|
||||
.CaptureStdErr()
|
||||
.CaptureStdOut()
|
||||
.Execute();
|
||||
|
||||
return commandResult;
|
||||
var commandPath = Env.GetCommandPath(_command, ".exe", ".cmd", "") ??
|
||||
Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, _command, ".exe", ".cmd", "");
|
||||
|
||||
Console.Write("command");
|
||||
Console.WriteLine(commandPath);
|
||||
|
||||
var stdOut = new StreamForwarder();
|
||||
var stdErr = new StreamForwarder();
|
||||
|
||||
stdOut.Capture();
|
||||
stdErr.Capture();
|
||||
|
||||
return RunProcess(commandPath, args, stdOut, stdErr);
|
||||
}
|
||||
|
||||
private CommandResult RunProcess(string executable, string args, StreamForwarder stdOut, StreamForwarder stdErr)
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = executable,
|
||||
Arguments = args,
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardOutput = true
|
||||
};
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = psi
|
||||
};
|
||||
|
||||
process.EnableRaisingEvents = true;
|
||||
process.Start();
|
||||
|
||||
var threadOut = stdOut.BeginRead(process.StandardOutput);
|
||||
var threadErr = stdErr.BeginRead(process.StandardError);
|
||||
|
||||
process.WaitForExit();
|
||||
threadOut.Join();
|
||||
threadErr.Join();
|
||||
|
||||
var result = new CommandResult(
|
||||
process.ExitCode,
|
||||
stdOut.GetCapturedOutput(),
|
||||
stdErr.GetCapturedOutput());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
"description": "Microsoft.DotNet.Tools.Tests.Utilities Class Library",
|
||||
|
||||
"dependencies": {
|
||||
"System.Collections": "4.0.11-*",
|
||||
"System.Collections.Immutable": "1.1.38-*",
|
||||
"System.Linq": "4.0.1-*",
|
||||
"System.Threading": "4.0.11-*",
|
||||
"System.IO.FileSystem": "4.0.1-*",
|
||||
"System.IO": "4.0.11-*",
|
||||
"System.Runtime.InteropServices": "4.0.21-*",
|
||||
"System.Text.RegularExpressions": "4.0.11-*",
|
||||
"System.Collections": "4.0.11-rc2-*",
|
||||
"System.Collections.Immutable": "1.1.38-rc2-*",
|
||||
"System.Linq": "4.0.1-rc2-*",
|
||||
"System.Threading": "4.0.11-rc2-*",
|
||||
"System.IO.FileSystem": "4.0.1-rc2-*",
|
||||
"System.IO": "4.0.11-rc2-*",
|
||||
"System.Runtime.InteropServices": "4.0.21-rc2-*",
|
||||
"System.Text.RegularExpressions": "4.0.11-rc2-*",
|
||||
"FluentAssertions": "4.0.0",
|
||||
"xunit": "2.1.0",
|
||||
|
||||
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
|
||||
"Microsoft.DotNet.Cli.Utils": {"target":"project"},
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530"
|
||||
},
|
||||
|
||||
|
@ -23,3 +23,4 @@
|
|||
"dnxcore50": { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23616",
|
||||
"NETStandard.Library": "1.0.0-rc2-23714",
|
||||
"dotnet-hello": { "version": "1.0.0", "target": "package" }
|
||||
},
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"testRunner": "must-be-specified-to-generate-deps",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23616",
|
||||
"NETStandard.Library": "1.0.0-rc2-23714",
|
||||
"dotnet-hello": {"version": "1.0.0", "target": "package"}
|
||||
},
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23616"
|
||||
"NETStandard.Library": "1.0.0-rc2-23714"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library" : "1.0.0-rc2-23704",
|
||||
"NETStandard.Library" : "1.0.0-rc2-23706",
|
||||
|
||||
"xunit": "2.1.0",
|
||||
"xunit.console.netcore": "1.0.2-prerelease-00101",
|
||||
|
|
Loading…
Reference in a new issue