From 00abfa975b33dc997dbed93eebf1862c157eca7d Mon Sep 17 00:00:00 2001 From: Tom Burdick Date: Fri, 7 Oct 2022 11:04:24 -0500 Subject: [PATCH] tests: Timer behavior custom test_main Adds a custom test_main and renames the test suite for jitter_drift. Runs the jitter_drift test suite. The order of these tests matter on hardware as the counter is often reset on loading the test program. This is useful as its far less likely to encounter a clock counter rollover. On arm this is especially useful. Signed-off-by: Tom Burdick --- tests/kernel/timer/timer_behavior/src/jitter_drift.c | 11 +++++++++-- tests/kernel/timer/timer_behavior/src/main.c | 12 ++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/kernel/timer/timer_behavior/src/main.c diff --git a/tests/kernel/timer/timer_behavior/src/jitter_drift.c b/tests/kernel/timer/timer_behavior/src/jitter_drift.c index 43bb7c9d8b..f8624b6ced 100644 --- a/tests/kernel/timer/timer_behavior/src/jitter_drift.c +++ b/tests/kernel/timer/timer_behavior/src/jitter_drift.c @@ -58,7 +58,14 @@ double cycles_to_us(double cycles) return 1000000.0 * (cycles / (double)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC); } -ZTEST(timer_behavior, test_periodic_behavior) +/** + * @brief Test a timers jitter and drift over time + * + * Named alpha_jitter_drift as this test requires ideally no + * clock counter roll overs while running on Arm and should be + * the first test in the suite to run + */ +ZTEST(timer_jitter_drift, test_jitter_drift) { TC_PRINT("periodic timer behavior test\n"); @@ -200,4 +207,4 @@ ZTEST(timer_behavior, test_periodic_behavior) "Drift (in microseconds) outside expected bound"); } -ZTEST_SUITE(timer_behavior, NULL, NULL, NULL, NULL, NULL); +ZTEST_SUITE(timer_jitter_drift, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/kernel/timer/timer_behavior/src/main.c b/tests/kernel/timer/timer_behavior/src/main.c new file mode 100644 index 0000000000..fa5e199805 --- /dev/null +++ b/tests/kernel/timer/timer_behavior/src/main.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +void test_main(void) +{ + ztest_run_test_suite(timer_jitter_drift); +}