diff options
-rw-r--r-- | core/host/timer.c | 16 | ||||
-rw-r--r-- | test/build.mk | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/core/host/timer.c b/core/host/timer.c index e76e4b3e3b..f7067dce08 100644 --- a/core/host/timer.c +++ b/core/host/timer.c @@ -52,12 +52,16 @@ void usleep(unsigned us) timestamp_t _get_time(void) { - struct timespec ts; - timestamp_t ret; - clock_gettime(CLOCK_MONOTONIC, &ts); - ret.val = (1000000000 * (uint64_t)ts.tv_sec + ts.tv_nsec) * - TEST_TIME_SCALE / 1000 / TEST_TIME_SLOW_DOWN; - return ret; + static timestamp_t time; + + /* + * We just monotonically increase the microsecond every time we check + * the time. Do not depend on host system time as this introduces + * flakyness in tests. The time is periodically fast forwarded with + * force_time() during the host's task scheduler implementation. + */ + ++time.val; + return time; } test_mockable timestamp_t get_time(void) diff --git a/test/build.mk b/test/build.mk index e670042c9b..e9a7f53648 100644 --- a/test/build.mk +++ b/test/build.mk @@ -79,7 +79,7 @@ test-list-host += usb_sm_framework_h0 test-list-host += usb_typec_vpd test-list-host += usb_typec_ctvpd test-list-host += usb_typec_drp_acc_trysrc -#test-list-host += usb_prl # crbug.com/1013701 +test-list-host += usb_prl test-list-host += utils test-list-host += utils_str test-list-host += vboot |