mirror of
https://github.com/torvalds/linux.git
synced 2026-10-16 04:39:02 +02:00
Validate the functionality of DA monitors by injecting events in a controlled environment (KUnit) and expecting reactions. Events handlers are exported directly from the monitor source files without using system events and with dummy arguments (e.g. no real tasks). If the provided sequence of events incurs a violation, the test expects the stub version of rv_react() to be called. This testing method can validate the entire monitor implementation since it sits between the monitor and the system (in place of the tracepoints). All sorts of system and timing events can be emulated without affecting the running kernel. Handlers and monitor functions are exported as part of a struct to simplify the process of running KUnit tests from kernel modules. Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20260723074534.43521-13-gmonaco@redhat.com Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
31 lines
894 B
C
31 lines
894 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Automatically generated by rvgen kunit.
|
|
* May need manual intervention for function prototypes that couldn't be
|
|
* found (e.g. are in another file) or variables to be exported.
|
|
*/
|
|
|
|
#ifndef __SSSW_KUNIT_H
|
|
#define __SSSW_KUNIT_H
|
|
|
|
#if IS_ENABLED(CONFIG_RV_MONITORS_KUNIT_TEST)
|
|
|
|
#include <linux/rv.h>
|
|
#include <rv/kunit.h>
|
|
|
|
extern const struct rv_sssw_ops {
|
|
struct rv_kunit_mon mon;
|
|
void (*handle_sched_set_state)(void *data, struct task_struct *tsk, int state);
|
|
void (*handle_sched_switch)(void *data, bool preempt,
|
|
struct task_struct *prev,
|
|
struct task_struct *next,
|
|
unsigned int prev_state);
|
|
void (*handle_sched_wakeup)(void *data, struct task_struct *p);
|
|
void (*handle_signal_deliver)(void *data, int sig,
|
|
struct kernel_siginfo *info,
|
|
struct k_sigaction *ka);
|
|
} rv_sssw_ops;
|
|
#endif
|
|
|
|
#endif /* __SSSW_KUNIT_H */
|