Re: [PATCH] kunit: Introduce autorun option

From: Stanislav Kinsburskii
Date: Mon Oct 28 2024 - 14:17:03 EST


On Tue, Oct 22, 2024 at 05:16:31PM -0400, Rae Moar wrote:
> > diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
> > index 34b7b6833df3..340723571b0f 100644
> > --- a/lib/kunit/executor.c
> > +++ b/lib/kunit/executor.c
> > @@ -29,6 +29,22 @@ const char *kunit_action(void)
> > return action_param;
> > }
> >
> > +/*
> > + * Run KUnit tests after initialization
> > + */
> > +#ifdef CONFIG_KUNIT_AUTORUN_ENABLED
> > +static bool autorun_param = true;
> > +#else
> > +static bool autorun_param;
> > +#endif
> > +module_param_named(autorun, autorun_param, bool, 0);
> > +MODULE_PARM_DESC(autorun, "Run KUnit tests after initialization");
> > +
> > +bool kunit_autorun(void)
> > +{
> > + return autorun_param;
> > +}
> > +
> > static char *filter_glob_param;
> > static char *filter_param;
> > static char *filter_action_param;
> > @@ -266,7 +282,7 @@ void kunit_exec_run_tests(struct kunit_suite_set *suite_set, bool builtin)
> > pr_info("1..%zu\n", num_suites);
>
> When using this feature, I still see some KTAP output that are printed
> from this function (kunit_exec_run_tests). I think it would be great
> if we could remove this output as to not clutter the kernel log.
>
> At first, I was confused as to why we needed to call this function and
> initialize the tests but I realized the debugfs suites need to be
> created.
>
> So instead, could we check for kunit_autorun() here instead as a
> condition before printing the output?
>

Sure, I'll address it in the next revision.

Thanks,
Stanislav