diff options
| author | 2023-07-13 11:42:22 +0000 | |
|---|---|---|
| committer | 2023-07-14 00:26:02 +0000 | |
| commit | c33ca3ed90fe4607c072bbd069f71904d9b225d2 (patch) | |
| tree | 9f8017888e0aeaeb8d70b640aa0b3e3041d490b4 | |
| parent | 4f3c7a98febe594469dd1bd82e0086c24bbc3b51 (diff) | |
time_util_unittest: remove sleep test for monotonic_raw
Monotonic raw clocks do not promise anything w.r.t. the real time. This
makes checking whether |X| seconds has passed after sleeping |X| seconds
infeasible as a sanity check.
In this CL, we remove the offending test.
Bug: 289894845
Tag: #floss
Test: atest bluetooth_test_common:bluetooth_test_common64.TimeTest#test_time_get_os_monotonic_raw_us_increases_lower_bound -- --abi x86_64
Change-Id: I1fe9efd86f2a18f2178d55e2a757a6fa45f51f7f
| -rw-r--r-- | system/common/time_util_unittest.cc | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/system/common/time_util_unittest.cc b/system/common/time_util_unittest.cc index eb21aee5ad..848ef06746 100644 --- a/system/common/time_util_unittest.cc +++ b/system/common/time_util_unittest.cc @@ -125,28 +125,6 @@ TEST(TimeTest, test_time_get_os_boottime_us_increases_lower_bound) { } // -// Test that the return value of -// bluetooth::common::time_get_os_monotonic_raw_us() is increasing. -// -TEST(TimeTest, test_time_get_os_monotonic_raw_us_increases_lower_bound) { - static const uint64_t TEST_TIME_SLEEP_US = 100 * 1000; - struct timespec delay = {}; - - delay.tv_sec = TEST_TIME_SLEEP_US / (1000 * 1000); - delay.tv_nsec = 1000 * (TEST_TIME_SLEEP_US % (1000 * 1000)); - - // Take two timestamps with sleep in-between - uint64_t t1 = bluetooth::common::time_get_os_monotonic_raw_us(); - int err = nanosleep(&delay, &delay); - uint64_t t2 = bluetooth::common::time_get_os_monotonic_raw_us(); - - ASSERT_EQ(err, 0); - ASSERT_GT(t2, t1); - ASSERT_TRUE((t2 - t1) >= TEST_TIME_SLEEP_US); - ASSERT_TRUE((t2 - t1) < TEST_TIME_DELTA_UPPER_BOUND_MS * 1000); -} - -// // Test that the return value of bluetooth::common::time_gettimeofday_us() is // not zero. // |