tests: kernel: cycle64: mark test as slow
Previously cycle64 was under `samples/`. It's been moved to `tests/` and has been marked with `slow: True` so that it will not disrupt CI by adding excessive delays. Fixes #40367 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
This commit is contained in:
parent
4d6315a681
commit
7ea93a8853
6 changed files with 38 additions and 27 deletions
|
@ -1,3 +0,0 @@
|
|||
CONFIG_TEST=y
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_ASSERT=y
|
|
@ -1,17 +0,0 @@
|
|||
sample:
|
||||
description: k_cycle_get_64() example
|
||||
name: cycle64
|
||||
common:
|
||||
integration_platforms:
|
||||
- native_posix_64
|
||||
- qemu_riscv
|
||||
- qemu_riscv64
|
||||
tags: kernel
|
||||
harness: console
|
||||
harness_config:
|
||||
type: one_line
|
||||
regex:
|
||||
- "SUCCESS"
|
||||
tests:
|
||||
sample.kernel.cycle64:
|
||||
filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER
|
2
tests/kernel/timer/cycle64/prj.conf
Normal file
2
tests/kernel/timer/cycle64/prj.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_PRINTK=y
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <ztest.h>
|
||||
#include <zephyr.h>
|
||||
|
||||
static void swap64(uint64_t *a, uint64_t *b)
|
||||
|
@ -41,7 +42,7 @@ uint32_t timeout(uint64_t prev, uint64_t now)
|
|||
return (uint32_t)next;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
static void test_32bit_wrap_around(void)
|
||||
{
|
||||
enum {
|
||||
CURR,
|
||||
|
@ -52,7 +53,7 @@ void main(void)
|
|||
uint64_t now;
|
||||
uint64_t c64[2];
|
||||
|
||||
printk("wrap-around should occur in %us\n",
|
||||
printk("32-bit wrap-around should occur every %us\n",
|
||||
(uint32_t)(BIT64(32) / (uint32_t)sys_clock_hw_cycles_per_sec()));
|
||||
|
||||
printk("[ddd:hh:mm:ss.0ms]\n");
|
||||
|
@ -60,7 +61,7 @@ void main(void)
|
|||
c64[CURR] = k_cycle_get_64();
|
||||
msg(c64[CURR]);
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (i = 0; i < 2; ++i) {
|
||||
k_sleep(Z_TIMEOUT_CYC(timeout(c64[CURR], k_cycle_get_64())));
|
||||
|
||||
now = k_cycle_get_64();
|
||||
|
@ -69,9 +70,15 @@ void main(void)
|
|||
|
||||
msg(c64[CURR]);
|
||||
|
||||
__ASSERT(((c64[CURR] - c64[PREV]) >> 32) == 1,
|
||||
"The 64-bit cycle counter did not increment!");
|
||||
zassert_equal(((c64[CURR] - c64[PREV]) >> 32), 1,
|
||||
"The 64-bit cycle counter did not increment by 2^32");
|
||||
}
|
||||
}
|
||||
|
||||
printk("SUCCESS\n");
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(cycle64_tests,
|
||||
ztest_unit_test(test_32bit_wrap_around));
|
||||
|
||||
ztest_run_test_suite(cycle64_tests);
|
||||
}
|
22
tests/kernel/timer/cycle64/testcase.yaml
Normal file
22
tests/kernel/timer/cycle64/testcase.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Note: Re: slow vs fast
|
||||
#
|
||||
# Some platforms such as native_posix, qemu_riscv32, qemu_riscv64
|
||||
# complete these tests almost instantaneously because of qemu timer
|
||||
# quirks ("time warp") even though the test reports that it completes
|
||||
# in e.g. 14 s. We can take advantage of that for fast tests on each PR
|
||||
# but we also want to excercise this code path during daily builds or
|
||||
# otherwise when users specify "twister --enable-slow".
|
||||
#
|
||||
# As other platforms are added with varying timer frequencies, increase
|
||||
# timeout as necessary.
|
||||
tests:
|
||||
kernel.timer.cycle64:
|
||||
tags: kernel timer
|
||||
filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER
|
||||
platform_exclude: native_posix
|
||||
timeout: 140
|
||||
slow: true
|
||||
kernel.timer.cycle64.fast:
|
||||
tags: kernel timer
|
||||
filter: CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER
|
||||
platform_allow: native_posix
|
Loading…
Add table
Add a link
Reference in a new issue