diff options
author | Evan Green <evgreen@chromium.org> | 2021-07-28 12:25:48 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-02 15:43:16 +0000 |
commit | ba4017a3ec1bbd1ab7ae601da6ce194ef8e6b349 (patch) | |
tree | e535e0c6b87d38d6722973aa513b745936a7710a /test | |
parent | ee342c585c588bf171357753f7b35133a3949fb1 (diff) | |
download | chrome-ec-ba4017a3ec1bbd1ab7ae601da6ce194ef8e6b349.tar.gz |
test: Ensure time move forward in usb_pd_int
test_storm_not_triggered_for_32bit_overflow wanted to check to ensure
the storm detection worked across the 32-bit boundary, so it forced the
current time to 0xff000000. It assumed however that this timestamp was
in the future. If it's in the past (say for instance someone else has
bumped time forward) then the storm tracking is broken and this test
fails. Since it is not the goal of this test to see how the storm
tracker behaves when time moves backwards, fix up the test to ensure
it's got the high bit set but is also in the future.
BUG=b:179062230
BRANCH=none
TEST=make -j runhosttests
Signed-off-by: Evan Green <evgreen@chromium.org>
Change-Id: Iac4c68e2bf46649a01477dbd1dabfcf0d95b1371
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3059232
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/usb_pd_int.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/usb_pd_int.c b/test/usb_pd_int.c index 8a15cfdcd6..5d3cbbf0f2 100644 --- a/test/usb_pd_int.c +++ b/test/usb_pd_int.c @@ -71,8 +71,11 @@ test_static int test_storm_not_triggered_for_32bit_overflow(void) int i; timestamp_t time; - /* Ensure the MSB is 1 for overflow comparison tests */ - time.val = 0xff000000; + /* + * Ensure the MSB is 1 for overflow comparison tests. + * But make sure not to move time backwards. + */ + time.val = (get_time().val + 0x100000000) | 0xff000000; force_time(time); /* |