Skip to content

Commit

Permalink
selftests/bpf: Relax time_tai test for equal timestamps in tai_forward
Browse files Browse the repository at this point in the history
[ Upstream commit e1ba7f6 ]

We're observing test flakiness on an arm64 platform which might not
have timestamps as precise as x86. The test log looks like:

  test_time_tai:PASS:tai_open 0 nsec
  test_time_tai:PASS:test_run 0 nsec
  test_time_tai:PASS:tai_ts1 0 nsec
  test_time_tai:PASS:tai_ts2 0 nsec
  test_time_tai:FAIL:tai_forward unexpected tai_forward: actual 1702348135471494160 <= expected 1702348135471494160
  test_time_tai:PASS:tai_gettime 0 nsec
  test_time_tai:PASS:tai_future_ts1 0 nsec
  test_time_tai:PASS:tai_future_ts2 0 nsec
  test_time_tai:PASS:tai_range_ts1 0 nsec
  test_time_tai:PASS:tai_range_ts2 0 nsec
  torvalds#199     time_tai:FAIL

This patch changes ASSERT_GT to ASSERT_GE in the tai_forward assertion
so that equal timestamps are permitted.

Fixes: 64e1582 ("selftests/bpf: Add BPF-helper test for CLOCK_TAI access")
Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20231212182911.3784108-1-zhuyifei@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
zhuyifei1999 authored and gregkh committed Jan 25, 2024
1 parent 0c9318d commit 4196b45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/time_tai.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void test_time_tai(void)
ASSERT_NEQ(ts2, 0, "tai_ts2");

/* TAI is moving forward only */
ASSERT_GT(ts2, ts1, "tai_forward");
ASSERT_GE(ts2, ts1, "tai_forward");

/* Check for future */
ret = clock_gettime(CLOCK_TAI, &now_tai);
Expand Down

0 comments on commit 4196b45

Please sign in to comment.