提交 0a0972f6 编写于 作者: T Tanner Gooding

Update TestRunner.cs to properly create the parent directory instead of a...

Update TestRunner.cs to properly create the parent directory instead of a directory with the file name.
上级 0df0937a
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
......@@ -121,18 +121,19 @@ private async Task<TestResult> RunTest(string assemblyPath, CancellationToken ca
{
var assemblyName = Path.GetFileName(assemblyPath);
var extension = _useHtml ? "html" : "xml";
var resultsPath = Path.Combine(Path.GetDirectoryName(assemblyPath), "xUnitResults", $"{assemblyName}.{extension}");
var resultsFile = Path.Combine(Path.GetDirectoryName(assemblyPath), "xUnitResults", $"{assemblyName}.{extension}");
var resultsPath = Path.GetDirectoryName(resultsFile);
// NOTE: xUnit doesn't always create the log directory
Directory.CreateDirectory(resultsPath);
// NOTE: xUnit seems to have an occasional issue creating logs create
// an empty log just in case, so our runner will still fail.
File.Create(resultsPath).Close();
File.Create(resultsFile).Close();
var builder = new StringBuilder();
builder.AppendFormat(@"""{0}""", assemblyPath);
builder.AppendFormat(@" -{0} ""{1}""", _useHtml ? "html" : "xml", resultsPath);
builder.AppendFormat(@" -{0} ""{1}""", _useHtml ? "html" : "xml", resultsFile);
builder.Append(" -noshadow");
var errorOutput = new StringBuilder();
......@@ -157,7 +158,7 @@ private async Task<TestResult> RunTest(string assemblyPath, CancellationToken ca
var all = string.Empty;
try
{
all = File.ReadAllText(resultsPath).Trim();
all = File.ReadAllText(resultsFile).Trim();
}
catch
{
......@@ -171,7 +172,7 @@ private async Task<TestResult> RunTest(string assemblyPath, CancellationToken ca
Console.Write(string.Join(Environment.NewLine, output));
// Delete the output file.
File.Delete(resultsPath);
File.Delete(resultsFile);
}
errorOutput.AppendLine($"Command: {_xunitConsolePath} {builder}");
......@@ -192,7 +193,7 @@ private async Task<TestResult> RunTest(string assemblyPath, CancellationToken ca
if (_useHtml && !noResultsData)
{
Process.Start(resultsPath);
Process.Start(resultsFile);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册