Skip to content

Commit 00abfa9

Browse files
teburdnashif
authored andcommitted
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 <[email protected]>
1 parent bcc1165 commit 00abfa9

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tests/kernel/timer/timer_behavior/src/jitter_drift.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ double cycles_to_us(double cycles)
5858
return 1000000.0 * (cycles / (double)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
5959
}
6060

61-
ZTEST(timer_behavior, test_periodic_behavior)
61+
/**
62+
* @brief Test a timers jitter and drift over time
63+
*
64+
* Named alpha_jitter_drift as this test requires ideally no
65+
* clock counter roll overs while running on Arm and should be
66+
* the first test in the suite to run
67+
*/
68+
ZTEST(timer_jitter_drift, test_jitter_drift)
6269
{
6370
TC_PRINT("periodic timer behavior test\n");
6471

@@ -200,4 +207,4 @@ ZTEST(timer_behavior, test_periodic_behavior)
200207
"Drift (in microseconds) outside expected bound");
201208
}
202209

203-
ZTEST_SUITE(timer_behavior, NULL, NULL, NULL, NULL, NULL);
210+
ZTEST_SUITE(timer_jitter_drift, NULL, NULL, NULL, NULL, NULL);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2022 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/ztest.h>
8+
9+
void test_main(void)
10+
{
11+
ztest_run_test_suite(timer_jitter_drift);
12+
}

0 commit comments

Comments
 (0)