Re: [PATCH v5 13/17] rv: Add KUnit mock for current
Nam Cao <[email protected]> Fri, 31 Jul 2026 12:59:30 +0200
| Newsgroups | org.kernel.vger.linux-trace-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Gabriele Monaco <[email protected]> writes: > Some monitors do not only rely on tracepoint arguments but also on the > currently executing task. > This makes it more challenging to mock events in KUnit. > > Define wrapper functions around current, the functionality is mocked > only during KUnit, an additional function call is avoided using a static > branch unless any (even unrelated) KUnit test is running. > > Rely on a global mock_current variable that is set only by the RV KUnit > tests and cleared on teardown. Unrelated KUnit tests that happen to > trigger RV handlers would see it null and use current. > > Signed-off-by: Gabriele Monaco <[email protected]> Reviewed-by: Nam Cao <[email protected]>