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:
Tom Burdick
2022-10-07 11:04:24 -05:00
committed by Anas Nashif
parent bcc1165367
commit 00abfa975b
2 changed files with 21 additions and 2 deletions

View File

@@ -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);

View 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);
}