Re: [PATCH 4/5] kselftest: add fixture parameters

From: Kees Cook
Date: Fri Mar 13 2020 - 20:05:27 EST


On Fri, Mar 13, 2020 at 04:52:02PM -0700, Jakub Kicinski wrote:
> On Fri, 13 Mar 2020 16:31:25 -0700 Kees Cook wrote:
> > > @@ -326,7 +387,8 @@
> > > } \
> > > static void fixture_name##_##test_name( \
> > > struct __test_metadata __attribute__((unused)) *_metadata, \
> > > - FIXTURE_DATA(fixture_name) __attribute__((unused)) *self)
> > > + FIXTURE_DATA(fixture_name) __attribute__((unused)) *self, \
> > > + const FIXTURE_PARAMS(fixture_name) __attribute__((unused)) *params)
> >
> > Could this be done without expanding the function arguments? (i.e. can
> > the params just stay attached to the __test_metadata, perhaps having the
> > test runner adjust a new "current_param" variable to point to the
> > current param? Having everything attached to the single __test_metadata
> > makes a lot of things easier, IMO.
>
> Sure! I felt a little awkward dereferencing _metadata in the test,
> so I followed the example of self. But I can change.
>
> Can I add a macro like CURRENT_PARAM() that would implicitly use
> _metadata?

Yeah, that seems cleaner. Thanks! This is very cool. :)

--
Kees Cook