summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2021-07-28 12:29:08 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-02 15:43:31 +0000
commit87165ffd56c6c1f051ddb0a184628a1789c69874 (patch)
treec4137350e85341234d608cf6114105a98f61a15b /core
parent1821e9423af84c7a126a4a15303c6492dd44e94b (diff)
downloadchrome-ec-87165ffd56c6c1f051ddb0a184628a1789c69874.tar.gz
test: Start host test timer near 32-bit rollover
Rather than starting the timestamp at 0 for each test, let's start it just before the 32-bit rollover. This gives us more of a chance to catch 32-bit rollover issues in the tests. BUG=b:179062230 BRANCH=none TEST=make -j runhosttests BOARD=host Signed-off-by: Evan Green <evgreen@chromium.org> Change-Id: Ia0551b4409c4bc63938f319312f6c66acf7c6cd9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3059233 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/host/timer.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/host/timer.c b/core/host/timer.c
index c99c002533..3c3695cad4 100644
--- a/core/host/timer.c
+++ b/core/host/timer.c
@@ -90,6 +90,16 @@ int timestamp_expired(timestamp_t deadline, const timestamp_t *now)
void timer_init(void)
{
- if (!time_set)
- boot_time = _get_time();
+
+ if (!time_set) {
+ /*
+ * Start the timer just before the 64-bit rollover to try
+ * and catch 32-bit rollover/truncation bugs.
+ */
+ timestamp_t ts = {
+ .val = 0xFFFFFFF0
+ };
+
+ force_time(ts);
+ }
}