mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
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 <thomas.burdick@intel.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
12
tests/kernel/timer/timer_behavior/src/main.c
Normal file
12
tests/kernel/timer/timer_behavior/src/main.c
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_run_test_suite(timer_jitter_drift);
|
||||
}
|
||||
Reference in New Issue
Block a user