-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some improvements to RF #56659
Merged
Merged
Some improvements to RF #56659
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -630,7 +630,6 @@ public int RunReliabilityTests(string testConfig, bool doReplay) | |
return (99); | ||
} | ||
|
||
#if !PROJECTK_BUILD | ||
[DllImport("kernel32.dll")] | ||
private extern static void DebugBreak(); | ||
|
||
|
@@ -639,7 +638,6 @@ public int RunReliabilityTests(string testConfig, bool doReplay) | |
|
||
[DllImport("kernel32.dll")] | ||
private extern static void OutputDebugString(string debugStr); | ||
#endif | ||
|
||
/// <summary> | ||
/// Checks to see if we should block all execution due to a fatal error | ||
|
@@ -661,20 +659,11 @@ private static void NoExitPoll() | |
} | ||
internal static void MyDebugBreak(string extraData) | ||
{ | ||
#if !PROJECTK_BUILD | ||
if (IsDebuggerPresent()) | ||
{ | ||
OutputDebugString(String.Format("\r\n\r\n\r\nRELIABILITYFRAMEWORK DEBUGBREAK: Breaking in because test throw an exception ({0})\r\n\r\n\r\n", extraData)); | ||
Console.WriteLine(string.Format("DebugBreak: {0}", extraData)); | ||
DebugBreak(); | ||
} | ||
else | ||
#else | ||
if (Debugger.IsAttached) | ||
{ | ||
Console.WriteLine(string.Format("DebugBreak: breaking in because test threw an exception: {0}", extraData)); | ||
Debugger.Break(); | ||
} | ||
#endif | ||
{ | ||
// We need to stop the process now, | ||
// but all the threads are still running | ||
|
@@ -1081,25 +1070,46 @@ private void TestSetShutdown(int totalTestsToRun) | |
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
Console.WriteLine(msg); | ||
|
||
int secondsIter = 5; | ||
int waitCnt = 0; | ||
while (_testsRunningCount > 0 && waitCnt < 7200) // wait a max of 2 hours for the tests to exit... | ||
{ | ||
Thread.Sleep(1000); | ||
Console.Write("\b\b\b\b{0,4}", _testsRunningCount); | ||
int waitCntTotal = _curTestSet.MaximumWaitTime * 60 / secondsIter; | ||
msg = String.Format("START WAITING for {0}s", _curTestSet.MaximumWaitTime * 60); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
long lastAllocatedBytes = GC.GetTotalAllocatedBytes(false); | ||
while (_testsRunningCount > 0 && waitCnt < waitCntTotal) | ||
{ | ||
Thread.Sleep(secondsIter * 1000); | ||
long currentAllocatedBytes = GC.GetTotalAllocatedBytes(false); | ||
msg = String.Format("============current number of tests running {0,4}, allocated {1:n0} so far, {2:n0} since last; (GC {3}:{4}:{5}), waited {6}s", | ||
_testsRunningCount, currentAllocatedBytes, (currentAllocatedBytes - lastAllocatedBytes), | ||
GC.CollectionCount(0), | ||
GC.CollectionCount(1), | ||
GC.CollectionCount(2), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You called GC.CollectionCount(2) twice, looks like one should use 1 as an argument, or am I wrong? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed it should be 1, thanks for spotting it!! 👍 |
||
(waitCnt * secondsIter)); | ||
lastAllocatedBytes = currentAllocatedBytes; | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
|
||
for (int i = 0; i < _curTestSet.Tests.Length; i++) | ||
{ | ||
if (_curTestSet.Tests[i].RunningCount != 0) | ||
{ | ||
msg = String.Format("Still running: {0}", _curTestSet.Tests[i].RefOrID); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
} | ||
} | ||
waitCnt++; | ||
} | ||
} | ||
|
||
// let the user know what tests haven't finished... | ||
if (_testsRunningCount != 0) | ||
{ | ||
string msg; | ||
|
||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, "************Timeout reached************"); | ||
for (int i = 0; i < _curTestSet.Tests.Length; i++) | ||
{ | ||
if (_curTestSet.Tests[i].RunningCount != 0) | ||
{ | ||
msg = String.Format("Still running: {0}", _curTestSet.Tests[i].RefOrID); | ||
string msg = String.Format("Still running: {0}", _curTestSet.Tests[i].RefOrID); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
Console.WriteLine(msg); | ||
AddFailure("Test Hang", _curTestSet.Tests[i], -1); | ||
|
@@ -1116,6 +1126,9 @@ private void TestSetShutdown(int totalTestsToRun) | |
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private void TestIsHungDebugBreak() | ||
{ | ||
string msg = String.Format("break"); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
|
||
MyDebugBreak("TestHang"); | ||
} | ||
|
||
|
@@ -1165,7 +1178,8 @@ private void StartTest(ReliabilityTest test) | |
|
||
Interlocked.Increment(ref _testsRunningCount); | ||
test.TestStarted(); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.TestStarter, String.Format("RF.StartTest, RTs({0}) - Instances of this test: {1} - New Test:{2}", _testsRunningCount, test.RunningCount, test.RefOrID)); | ||
_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)); | ||
|
||
newThread.Start(test); | ||
} | ||
|
@@ -1207,7 +1221,11 @@ private void StartTestWorker(object test) | |
#if PROJECTK_BUILD | ||
Task.Factory.StartNew(() => | ||
{ | ||
Console.WriteLine("==============================running test: {0}==============================", daTest.Assembly); | ||
string msg = String.Format("==============================[tid: {0, 4}, running test: {1} STATUS: START, {2} tests running {3} threads ==============================", | ||
Thread.CurrentThread.ManagedThreadId, daTest.Assembly, _testsRunningCount, | ||
Process.GetCurrentProcess().Threads.Count); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
|
||
try | ||
{ | ||
daTest.EntryPointMethod.Invoke(null, new object[] { (daTest.Arguments == null) ? new string[0] : daTest.GetSplitArguments() }); | ||
|
@@ -1220,6 +1238,10 @@ private void StartTestWorker(object test) | |
|
||
Console.WriteLine(e); | ||
} | ||
msg = String.Format("==============================[tid: {0, 4}, running test: {1} STATUS: DONE, {2} tests running {3} threads ==============================", | ||
Thread.CurrentThread.ManagedThreadId, daTest.Assembly, _testsRunningCount, | ||
Process.GetCurrentProcess().Threads.Count); | ||
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.StartupShutdown, msg); | ||
Interlocked.Increment(ref _testsRanCount); | ||
SignalTestFinished(daTest); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still want to keep the variant where
PROJECTK_BUILD
is not defined?It looks like the code won't compile (with or without your change) without
PROJECTK_BUILD
defined.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I thought about just getting rid of the define (ie, it's always defined) since I don't see any value of maintaining it. but didn't do it with this PR... feel free to do that if you like.