Re: [PATCH v2 11/14] rv: Add KUnit tests for some DA/HA monitors
From: Nam Cao
Date: Tue May 19 2026 - 09:24:22 EST
Gabriele Monaco <gmonaco@xxxxxxxxxx> writes:
> +#define RV_KUNIT_EXPECT_REACTION_HERE(test, ctx) \
> + for (int __done = ({ RV_KUNIT_EXPECT_NO_REACTION(test, ctx); 0; }); \
> + !__done; \
> + __done = ({ RV_KUNIT_EXPECT_REACTION(test, ctx); 1; }))
Cool trick.
> +static void rv_test_stub(struct kunit *test)
> +{
> + kunit_skip(test, "Monitor not enabled\n");
> +}
> +
> +#define DECLARE_RV_TEST(name) \
> + void name(struct kunit *test) __weak __alias(rv_test_stub)
> +
> +DECLARE_RV_TEST(rv_test_sco);
> +DECLARE_RV_TEST(rv_test_sssw);
> +DECLARE_RV_TEST(rv_test_sts);
> +DECLARE_RV_TEST(rv_test_opid);
> +DECLARE_RV_TEST(rv_test_nomiss);
Good to know this one. I think I can make use of this trick for some LTL improvement..
Reviewed-by: Nam Cao <namcao@xxxxxxxxxxxxx>