From: Yonghong Song Date: Wed, 20 Oct 2021 06:17:40 +0000 (-0700) Subject: reduce counter.enabled checking in test_perf_event.cc X-Git-Tag: v0.23.0~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2510ad738e9ee5a89d599569478e53b6c3969c9e;p=platform%2Fupstream%2Fbcc.git reduce counter.enabled checking in test_perf_event.cc 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 --- diff --git a/tests/cc/test_perf_event.cc b/tests/cc/test_perf_event.cc index b3b26031..d2a7b9ab 100644 --- a/tests/cc/test_perf_event.cc +++ b/tests/cc/test_perf_event.cc @@ -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