lkml.org 
[lkml]   [2020]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5] kselftest: add fixture parameters
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

\
 
 \ /
  Last update: 2020-03-14 01:07    [W:0.059 / U:2.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site