Skip to content
26 changes: 20 additions & 6 deletions src/tests/GC/Stress/Framework/ReliabilityFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,18 @@ public void RecordTestRunCount()
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, $"Tests run count:\n{sb}");
}

public void RecordTestRunCountForPerTest(string refOrID)
{
lock (_testRunCounterLock)
{
if (_testRunCounter.TryGetValue(refOrID, out var value))
{
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, $"Run tests \"{refOrID}\" {value} times.");
}
}

}

public void HandleOom(Exception e, string message)
{
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.Tests, String.Format("Exception while running tests: {0}", e));
Expand Down Expand Up @@ -982,7 +994,15 @@ private void StartTest(ReliabilityTest test)
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.TestStarter, String.Format("RF.StartTest, RTs({0}) - Instances of this test: {1} - New Test:{2}, {3} threads",
_testsRunningCount, test.RunningCount, test.RefOrID, Process.GetCurrentProcess().Threads.Count));

lock(_testRunCounterLock)
{
string testRefOrID = test.RefOrID;
_testRunCounter[testRefOrID] = _testRunCounter.GetValueOrDefault<string, uint>(testRefOrID, 0) + 1;
}

newThread.Start(test);
RecordTestRunCountForPerTest(test.RefOrID);

}
catch (OutOfMemoryException e)
{
Expand Down Expand Up @@ -1222,12 +1242,6 @@ private void StartTestWorker(object test)
}
break;
}

lock (_testRunCounterLock)
{
string testRefOrID = daTest.RefOrID;
_testRunCounter[testRefOrID] = _testRunCounter.GetValueOrDefault<string, uint>(testRefOrID, 0) + 1;
}
}
catch (Exception e)
{
Expand Down