Commit 5817b3e0 authored by Nick Craver's avatar Nick Craver

Tests: log time on everything

parent 3c6e6821
...@@ -312,7 +312,7 @@ public async Task PubSubGetAllAnyOrder() ...@@ -312,7 +312,7 @@ public async Task PubSubGetAllAnyOrder()
{ {
data.Add(int.Parse(Encoding.UTF8.GetString(val))); data.Add(int.Parse(Encoding.UTF8.GetString(val)));
pulse = data.Count == count; pulse = data.Count == count;
if ((data.Count % 100) == 99) Log(Time() + ": " + data.Count.ToString()); if ((data.Count % 100) == 99) Log(data.Count.ToString());
} }
if (pulse) if (pulse)
{ {
...@@ -367,7 +367,7 @@ async Task RunLoop() ...@@ -367,7 +367,7 @@ async Task RunLoop()
{ {
data.Add(i); data.Add(i);
if (data.Count == count) break; if (data.Count == count) break;
if ((data.Count % 100) == 99) Log(Time() + ": " + data.Count.ToString()); if ((data.Count % 100) == 99) Log(data.Count.ToString());
} }
} }
lock (syncLock) lock (syncLock)
...@@ -424,7 +424,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Sync() ...@@ -424,7 +424,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Sync()
{ {
data.Add(i); data.Add(i);
if (data.Count == count) pulse = true; if (data.Count == count) pulse = true;
if ((data.Count % 100) == 99) Log(Time() + ": " + data.Count.ToString()); if ((data.Count % 100) == 99) Log(data.Count.ToString());
} }
if (pulse) if (pulse)
{ {
...@@ -484,7 +484,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Async() ...@@ -484,7 +484,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Async()
{ {
data.Add(i); data.Add(i);
if (data.Count == count) pulse = true; if (data.Count == count) pulse = true;
if ((data.Count % 100) == 99) Log(Time() + ": " + data.Count.ToString()); if ((data.Count % 100) == 99) Log(data.Count.ToString());
} }
if (pulse) if (pulse)
{ {
......
...@@ -28,7 +28,7 @@ protected TestBase(ITestOutputHelper output) ...@@ -28,7 +28,7 @@ protected TestBase(ITestOutputHelper output)
ClearAmbientFailures(); ClearAmbientFailures();
} }
protected void Log(string message) protected void LogNoTime(string message)
{ {
Output.WriteLine(message); Output.WriteLine(message);
if (TestConfig.Current.LogToConsole) if (TestConfig.Current.LogToConsole)
...@@ -36,9 +36,17 @@ protected void Log(string message) ...@@ -36,9 +36,17 @@ protected void Log(string message)
Console.WriteLine(message); Console.WriteLine(message);
} }
} }
protected void Log(string message)
{
Output.WriteLine(Time() + ": " + message);
if (TestConfig.Current.LogToConsole)
{
Console.WriteLine(message);
}
}
protected void Log(string message, params object[] args) protected void Log(string message, params object[] args)
{ {
Output.WriteLine(message, args); Output.WriteLine(Time() + ": " + message, args);
if (TestConfig.Current.LogToConsole) if (TestConfig.Current.LogToConsole)
{ {
Console.WriteLine(message, args); Console.WriteLine(message, args);
...@@ -146,14 +154,14 @@ public void Teardown() ...@@ -146,14 +154,14 @@ public void Teardown()
{ {
foreach (var item in privateExceptions.Take(5)) foreach (var item in privateExceptions.Take(5))
{ {
Log(item); LogNoTime(item);
} }
} }
lock (backgroundExceptions) lock (backgroundExceptions)
{ {
foreach (var item in backgroundExceptions.Take(5)) foreach (var item in backgroundExceptions.Take(5))
{ {
Log(item); LogNoTime(item);
} }
} }
Assert.True(false, $"There were {privateFailCount} private and {sharedFailCount.Value} ambient exceptions; expected {expectedFailCount}."); Assert.True(false, $"There were {privateFailCount} private and {sharedFailCount.Value} ambient exceptions; expected {expectedFailCount}.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment