Fix EndToEnd Tests for portable build and publish
This commit is contained in:
parent
6c17d0e29c
commit
d878331a5e
1 changed files with 20 additions and 1 deletions
|
@ -107,10 +107,19 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
string expectedOutput)
|
||||
{
|
||||
var executablePath = Path.Combine(outputDir, executableName);
|
||||
var args = new List<string>();
|
||||
|
||||
if (IsPortable(executablePath))
|
||||
{
|
||||
args.Add(ArgumentEscaper.EscapeSingleArg(executablePath));
|
||||
|
||||
var muxer = new Muxer();
|
||||
executablePath = muxer.MuxerPath;
|
||||
}
|
||||
|
||||
var executableCommand = new TestCommand(executablePath);
|
||||
|
||||
var result = executableCommand.ExecuteWithCapturedOutput("");
|
||||
var result = executableCommand.ExecuteWithCapturedOutput(string.Join(" ", args));
|
||||
|
||||
result.Should().HaveStdOut(expectedOutput);
|
||||
result.Should().NotHaveStdErr();
|
||||
|
@ -141,5 +150,15 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
return executablePath;
|
||||
}
|
||||
|
||||
private bool IsPortable(string executablePath)
|
||||
{
|
||||
var executableDir = Path.GetDirectoryName(executablePath);
|
||||
|
||||
var runtimeConfig = Directory.EnumerateFiles(executableDir)
|
||||
.FirstOrDefault(x => x.EndsWith("runtimeconfig.json"));
|
||||
|
||||
return runtimeConfig != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue