Skip to content

Commit 47fb5bd

Browse files
authored
[clang] Deflake the TimeProfile support tests (#138613)
These tests have been flaky since they were merged into the AllClangUnitTests binary, but the flakiness is inherent to the nature of timer-based tests.
1 parent 2693a71 commit 47fb5bd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang/unittests/Support/TimeProfilerTest.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ std::string buildTraceGraph(StringRef Json) {
155155
bool InsideCurrentEvent =
156156
Event.TimestampBegin >= EventStack.top()->TimestampBegin &&
157157
Event.TimestampEnd <= EventStack.top()->TimestampEnd;
158+
159+
// Presumably due to timer rounding, PerformPendingInstantiations often
160+
// appear to be within the timer interval of the immediately previous
161+
// event group. We always know these events occur at level 1, not level 2,
162+
// in our tests, so pop an event in that case.
163+
if (InsideCurrentEvent && Event.Name == "PerformPendingInstantiations" &&
164+
EventStack.size() == 2) {
165+
InsideCurrentEvent = false;
166+
}
167+
158168
if (!InsideCurrentEvent)
159169
EventStack.pop();
160170
else

0 commit comments

Comments
 (0)