提交 006b915c 编写于 作者: B Balaji Soundrarajan

Merge pull request #11086 from basoundr/FixNRE

Fix NRE and provide better verbosity
@echo off @echo off
:: 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.
call "%VS140COMNTOOLS%VsDevCmd.bat" call "%VS140COMNTOOLS%VsDevCmd.bat"
...@@ -9,6 +9,6 @@ pushd %~dp0 ...@@ -9,6 +9,6 @@ pushd %~dp0
csi fetch_build.csx Master %~dp0..\..\..\..\Binaries\Release csi fetch_build.csx Master %~dp0..\..\..\..\Binaries\Release
:: Start Test Automation from the binaries directory :: Start Test Automation from the binaries directory
csi %~dp0..\..\..\..\Binaries\Release\Perf\infra\automation.csx csi %~dp0..\..\..\..\Binaries\Release\Perf\infra\automation.csx --verbose
popd popd
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#load "./util/runner_util.csx" #load "./util/runner_util.csx"
// Log() // Log()
// StdoutFrom() // StdoutFrom()
// IsVerbose()
#load "./util/tools_util.csx" #load "./util/tools_util.csx"
using System.Collections.Generic; using System.Collections.Generic;
...@@ -33,7 +34,7 @@ foreach (var script in GetAllCsxRecursive(testDirectory)) ...@@ -33,7 +34,7 @@ foreach (var script in GetAllCsxRecursive(testDirectory))
testInstances.AddRange(tests); testInstances.AddRange(tests);
} }
var traceManager = TraceManagerFactory.GetTraceManager(); var traceManager = TraceManagerFactory.GetTraceManager(IsVerbose());
traceManager.Initialize(); traceManager.Initialize();
foreach (var test in testInstances) foreach (var test in testInstances)
......
...@@ -19,13 +19,13 @@ public ConsoleAndFileLogger(string file = "log.txt") ...@@ -19,13 +19,13 @@ public ConsoleAndFileLogger(string file = "log.txt")
public void Flush() public void Flush()
{ {
File.WriteAllText(_file, _buffer.ToString()); File.AppendAllText(_file, _buffer.ToString());
} }
public void Log(string v) public void Log(string v)
{ {
Console.WriteLine(v); Console.WriteLine(DateTime.Now + " : " + v);
_buffer.AppendLine(v); _buffer.AppendLine(DateTime.Now + " : " + v);
} }
} }
} }
...@@ -4,13 +4,17 @@ namespace Roslyn.Test.Performance.Utilities ...@@ -4,13 +4,17 @@ namespace Roslyn.Test.Performance.Utilities
{ {
public class TraceManagerFactory public class TraceManagerFactory
{ {
public static ITraceManager GetTraceManager() public static ITraceManager GetTraceManager(bool isVerbose = false)
{ {
var cpcFullPath = Path.Combine(TestUtilities.GetCPCDirectoryPath(), "CPC.exe"); var cpcFullPath = Path.Combine(TestUtilities.GetCPCDirectoryPath(), "CPC.exe");
var scenarioPath = TestUtilities.GetCPCDirectoryPath(); var scenarioPath = TestUtilities.GetCPCDirectoryPath();
if (File.Exists(cpcFullPath)) if (File.Exists(cpcFullPath))
{ {
return new TraceManager(cpcFullPath, scenarioPath, verbose: true, logger: null); return new TraceManager(
cpcFullPath,
scenarioPath,
verbose: isVerbose,
logger: isVerbose ? new ConsoleAndFileLogger() : null);
} }
else else
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册