[igt-dev] [PATCH i-g-t 02/11] runner/resultgen: Extract finding begin/end lines for a subtest to a helper

Arkadiusz Hiler arkadiusz.hiler at intel.com
Wed Dec 11 12:46:57 UTC 2019


On Tue, Dec 03, 2019 at 03:33:45PM +0200, Arkadiusz Hiler wrote:
> On Mon, Dec 02, 2019 at 03:01:00PM +0200, Petri Latvala wrote:
> > Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> > ---
> >  runner/resultgen.c | 99 ++++++++++++++++++++++++----------------------
> >  1 file changed, 51 insertions(+), 48 deletions(-)
> > 
> > diff --git a/runner/resultgen.c b/runner/resultgen.c
> > index 31bc0bb1..be058327 100644
> > --- a/runner/resultgen.c
> > +++ b/runner/resultgen.c
> > @@ -376,6 +376,54 @@ static void add_igt_version(struct json_object *testobj,
> >  
> >  }
> >  
> > +static int find_subtest_idx_limited(struct matches matches,
> > +				    const char *bufend,
> > +				    const char *linekey,
> > +				    const char *pattern,
> > +				    const char *subtest_name,
> > +				    int first,
> > +				    int last)
> > +{
> > +	char *full_line;
> > +	int line_len;
> > +	int k;
> > +
> > +	/*
> > +	 * The pattern is a string literal in all call-sites, and we
> > +	 * don't want to disable this warning globally
> > +	 */
> > +#pragma GCC diagnostic push
> > +#pragma GCC diagnostic ignored "-Wformat-nonliteral"
> > +	line_len = asprintf(&full_line, pattern, linekey, subtest_name);
> > +#pragma GCC diagnostic pop
> 
> I guess that you didn't go for:
> 
> __attribute__((format(printf, 5, 6)))
> static int find_subtest_idx_limited(struct matches matches,
> 				    int first,
> 				    int last,
> 				    const char *bufend,
> 				    const char *pattern,
> 				    ...)
> 
> because linekey is needed for comparison few lines below this and
> extracting it with va_start()/va_arg()/va_end() is equally ugly.
> 
> How about using an enum for selecting the desired one from a set of
> locally defined patterns instead of passing it as char* with all this
> pragma wizardry.

Other than the comment above the series is:
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>


More information about the igt-dev mailing list