anton-afanasyev created this revision.
anton-afanasyev added reviewers: broadwaylamb, russell.gallop.
anton-afanasyev requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This test sometimes triggers failures during build testing. For instance, see:
https://lab.llvm.org/buildbot/#/builders/52/builds/10161, details: 
https://lab.llvm.org/buildbot/#/builders/52/builds/10161/steps/5/logs/FAIL__Clang__check-time-trace-sections_cpp
 .
AFAICT the time between driver calling and checking its time tracker output
is not guaranteed to be stable and small:

  > head -2 check-time-trace-sections.cpp
  // RUN: %clangxx -S -ftime-trace -ftime-trace-granularity=0 -o 
%T/check-time-trace-sections %s
  // RUN: cat %T/check-time-trace-sections.json | %python 
%S/check-time-trace-sections.py
  > clang -S -ftime-trace -ftime-trace-granularity=0 -o /tmp/check 
check-time-trace-sections.cpp
  > cat /tmp/check.json | python check-time-trace-sections.py
  > sleep 10
  > cat /tmp/check.json | python check-time-trace-sections.py
  'beginningOfTime' should represent the absolute time when the process has 
started
  >

One can change "10 sec" value to something longer, but I believe
it's enough just to check that `beginningOfTime` exists and is
not later than current time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108625

Files:
  clang/test/Driver/check-time-trace-sections.py


Index: clang/test/Driver/check-time-trace-sections.py
===================================================================
--- clang/test/Driver/check-time-trace-sections.py
+++ clang/test/Driver/check-time-trace-sections.py
@@ -20,10 +20,8 @@
 beginning_of_time = log_contents["beginningOfTime"] / 1000000
 seconds_since_epoch = time.time()
 
-# Make sure that the 'beginningOfTime' is not earlier than 10 seconds ago
-# and not later than now.
-if beginning_of_time > seconds_since_epoch or \
-        seconds_since_epoch - beginning_of_time > 10:
+# Make sure that the 'beginningOfTime' is not later than now.
+if beginning_of_time > seconds_since_epoch:
     sys.exit("'beginningOfTime' should represent the absolute time when the "
              "process has started")
 


Index: clang/test/Driver/check-time-trace-sections.py
===================================================================
--- clang/test/Driver/check-time-trace-sections.py
+++ clang/test/Driver/check-time-trace-sections.py
@@ -20,10 +20,8 @@
 beginning_of_time = log_contents["beginningOfTime"] / 1000000
 seconds_since_epoch = time.time()
 
-# Make sure that the 'beginningOfTime' is not earlier than 10 seconds ago
-# and not later than now.
-if beginning_of_time > seconds_since_epoch or \
-        seconds_since_epoch - beginning_of_time > 10:
+# Make sure that the 'beginningOfTime' is not later than now.
+if beginning_of_time > seconds_since_epoch:
     sys.exit("'beginningOfTime' should represent the absolute time when the "
              "process has started")
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to