[PATCH v2] riscv: Add kprobes KUnit test

Nam Cao namcao at linutronix.de
Wed May 14 03:01:25 PDT 2025


On Wed, May 14, 2025 at 10:22:03AM +0200, Alexandre Ghiti wrote:
> On 13/05/2025 17:16, Nam Cao wrote:
> > +	for (i = 0; i < num_kprobe; ++i) {
> > +		kp[i].addr = test_kprobes_addresses[i];
> > +		kp[i].pre_handler = kprobe_dummy_handler;
> > +		KUNIT_EXPECT_EQ(test, 0, register_kprobe(&kp[i]));
> 
> 
> Will kp be freed if the test fails?

Yes. Unlike KUNIT_ASSERT_EQ() which terminates the test, KUNIT_EXPECT_EQ()
still lets the test continues.

> Thanks for adding new tests, KUnit tests do not run yet in the CI but I'll
> add them soon!

Well I promised Björn this test back in 2023 ;) But I wasn't sure how to
implement it (I was still a student at that time) and then got busy with
other stuffs. But I guess better late than never.

Nam



More information about the linux-riscv mailing list