[clang] [clang] Deflake the TimeProfile support tests (PR #138613)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 5 16:26:43 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Reid Kleckner (rnk)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/138613.diff
1 Files Affected:
- (modified) clang/unittests/Support/TimeProfilerTest.cpp (+10)
``````````diff
diff --git a/clang/unittests/Support/TimeProfilerTest.cpp b/clang/unittests/Support/TimeProfilerTest.cpp
index f8053f2dfce48..7698742426dfc 100644
--- a/clang/unittests/Support/TimeProfilerTest.cpp
+++ b/clang/unittests/Support/TimeProfilerTest.cpp
@@ -155,6 +155,16 @@ std::string buildTraceGraph(StringRef Json) {
bool InsideCurrentEvent =
Event.TimestampBegin >= EventStack.top()->TimestampBegin &&
Event.TimestampEnd <= EventStack.top()->TimestampEnd;
+
+ // Presumably due to timer rounding, PerformPendingInstantiations often
+ // appear to be within the timer interval of the immediately previous
+ // event group. We always know these events occur at level 1, not level 2,
+ // in our tests, so pop an event in that case.
+ if (InsideCurrentEvent && Event.Name == "PerformPendingInstantiations" &&
+ EventStack.size() == 2) {
+ InsideCurrentEvent = false;
+ }
+
if (!InsideCurrentEvent)
EventStack.pop();
else
``````````
</details>
https://github.com/llvm/llvm-project/pull/138613
More information about the cfe-commits
mailing list