Skip to content

Commit

Permalink
reduce counter.enabled checking in test_perf_event.cc
Browse files Browse the repository at this point in the history
The test "attach perf event" is often flaky with the failure:

  3: /home/fedora/jenkins/workspace/bcc-pr/label/fc28/tests/cc/test_perf_event.cc:139: FAILED:
  3:   REQUIRE( counter.enabled >= 800000000 )
  3: with expansion:
  3:   774406106 (0x2e287fda)
  3:   >=
  3:   800000000 (0x2faf0800)

Previous workaround with 800000000 nano-second doesn't work 100%.
Let us change to 200000000 nano-second.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Oct 20, 2021
1 parent 691a4bf commit 2510ad7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/cc/test_perf_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ TEST_CASE("test attach perf event", "[bpf_perf_event]") {
// the program slept one second between perf_event attachment and detachment
// in the above, so the enabled counter should be 1000000000ns or
// more. But in reality, most of counters (if not all) are 9xxxxxxxx,
// and I also saw one 8xxxxxxxx. So let us a little bit conservative here.
REQUIRE(counter.enabled >= 800000000);
// and I also saw 7xxxxxxxx. So let us a little bit conservative here and
// set 200000000 to avoie test flakiness.
REQUIRE(counter.enabled >= 200000000);
REQUIRE(counter.running >= 0);
REQUIRE(counter.running <= counter.enabled);
#endif
Expand Down

0 comments on commit 2510ad7

Please sign in to comment.