Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/tests/GC/Stress/Framework/ReliabilityFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public class ReliabilityFramework
private int _reportedFailCnt = 0;
private RFLogging _logger = new RFLogging();
private DateTime _lastLogTime = DateTime.Now;
private Dictionary<string, uint> _testRunCounter = new();
private object _testRunCounterLock = new();

// static members
private static int s_seed = (int)System.DateTime.Now.Ticks;
Expand Down Expand Up @@ -161,6 +163,11 @@ public static int Main(string[] args)

ReliabilityFramework rf = new ReliabilityFramework();
rf._logger.WriteToInstrumentationLog(null, LoggingLevels.StartupShutdown, "Started");

Console.CancelKeyPress += (object _, ConsoleCancelEventArgs _) => {
rf.RecordTestRunCount();
};

var configVars = GC.GetConfigurationVariables();
foreach (var kvp in configVars)
{
Expand Down Expand Up @@ -305,7 +312,7 @@ public static int Main(string[] args)
}

NoExitPoll();

rf.RecordTestRunCount();
rf._logger.WriteToInstrumentationLog(null, LoggingLevels.StartupShutdown, String.Format("Shutdown w/ ret val of {0}", retVal));


Expand All @@ -314,6 +321,19 @@ public static int Main(string[] args)
return (retVal);
}

public void RecordTestRunCount()
{
StringBuilder sb = new();
lock (_testRunCounterLock)
{
foreach(var item in _testRunCounter)
{
sb.AppendLine($"{item.Key}: {item.Value}");
}
}
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, $"Tests run count:\n{sb}");
}

public void HandleOom(Exception e, string message)
{
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.Tests, String.Format("Exception while running tests: {0}", e));
Expand Down Expand Up @@ -621,6 +641,11 @@ private void TestStarter()
DateTime lastStart = DateTime.Now; // keeps track of when we last started a test
TimeSpan minTimeToStartTest = new TimeSpan(0, 5, 0); // after 5 minutes if we haven't started a test we're having problems...
int cpuAdjust = 0, memAdjust = 0; // if we discover that we're not starting new tests quick enough we adjust the CPU/Mem percentages

foreach (var test in _curTestSet.Tests)
{
_testRunCounter[test.RefOrID] = 0;
}
// so we start new tests sooner (so they start BEFORE we drop below our minimum CPU)

//Console.WriteLine("RF - TestStarter found {0} tests to run", totalTestsToRun);
Expand Down Expand Up @@ -1196,6 +1221,12 @@ 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