ztest: provide sys_clock_tick_set syscall

Accurate timekeeping is something that is often taken for granted.

However, reliability of timekeeping code is critical for most core
and subsystem code. Furthermore, Many higher-level timekeeping
utilities in Zephyr work off of ticks but there is no way to modify
ticks directly which would require either unnecessary delays in
test code or non-ideal compromises in test coverage.

Since timekeeping is so critical, there should be as few barriers
to testing timekeeping code as possible, while preserving
integrity of the kernel's public interface.

With this, we expose `sys_clock_tick_set()` as a system call only
when `CONFIG_ZTEST` is set, declared within the ztest framework.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
This commit is contained in:
Chris Friedt 2022-12-15 10:14:43 -08:00 committed by Carles Cufí
commit 4108e14740
2 changed files with 14 additions and 0 deletions

View file

@ -21,6 +21,8 @@ extern "C" {
__syscall void z_test_1cpu_start(void);
__syscall void z_test_1cpu_stop(void);
__syscall void sys_clock_tick_set(uint64_t tick);
#ifdef __cplusplus
}
#endif