[cairo] [PATCH] test: Selective execution of Cairo tests based on FORMAT option

Bryce Harrington bryce at osg.samsung.com
Thu Aug 14 16:14:09 PDT 2014


On Mon, Aug 04, 2014 at 03:53:23PM -0700, Bryce Harrington wrote:
> On Thu, Jul 24, 2014 at 02:19:21PM +0530, Ravi Nanjundappa wrote:
> > Added a new command line option FORMAT which can take rgb and/or rgba
> > values which enables the execution of tests only for the given FORMAT
> > For ex:
> > (1). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba,rgb
> > This command runs the zero-alpha test for both ps2 and image backends
> > with argb32 and rgb24 content formats.
> > (2). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba
> > This command runs the zero-alpha test for both ps2 and image backends
> > with argb32 content format and so on.
> > 
> > Signed-off-by: Ravi Nanjundappa <nravi.n at samsung.com>
> 
> LGTM.  (I reviewed an earlier version of this patch, and Ravi
> incorporated my feedback already).
>
> Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

Ravi also got a review of this patch series by Chris Wilson.

Btw when I applied the patches there were a number of warnings about
trailing whitespace, which I've removed, and with that this patch is
merged and pushed.
 
> > ---
> >  boilerplate/cairo-boilerplate.c |   61 ++++++++++++++++++++++++++++++++++-----
> >  perf/Makefile.am                |    3 +-
> >  test/Makefile.am                |    3 +-
> >  3 files changed, 58 insertions(+), 9 deletions(-)
> > 
> > diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
> > index 97d624c..29b3a12 100644
> > --- a/boilerplate/cairo-boilerplate.c
> > +++ b/boilerplate/cairo-boilerplate.c
> > @@ -522,6 +522,28 @@ _cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
> >  }
> >  
> >  static cairo_bool_t
> > +_cairo_boilerplate_target_format_matches_name (const cairo_boilerplate_target_t *target,
> > +					const char *tcontent_name,
> > +					const char *tcontent_end)
> > +{
> > +	char const *content_name;
> > +	const char *content_end = tcontent_end;
> > +	size_t content_len;
> > +
> > +	content_name = _cairo_boilerplate_content_visible_name (target->content);
> > +	if (tcontent_end)
> > +		content_len = content_end - tcontent_name;
> > +	else
> > +		content_len = strlen(tcontent_name);
> > +	if (strlen(content_name) != content_len)
> > +		return FALSE;
> > +	if (0 == strncmp (content_name, tcontent_name, content_len))
> > +		return TRUE;
> > +
> > +	return FALSE;
> > +}
> > +
> > +static cairo_bool_t
> >  _cairo_boilerplate_target_matches_name (const cairo_boilerplate_target_t *target,
> >  					const char			 *tname,
> >  					const char			 *end)
> > @@ -597,13 +619,38 @@ cairo_boilerplate_get_targets (int	    *pnum_targets,
> >  		 list != NULL;
> >  		 list = list->next)
> >  	    {
> > -		const cairo_boilerplate_target_t *target = list->target;
> > -		if (_cairo_boilerplate_target_matches_name (target, tname, end)) {
> > -		    /* realloc isn't exactly the best thing here, but meh. */
> > -		    targets_to_test = xrealloc (targets_to_test, sizeof(cairo_boilerplate_target_t *) * (num_targets+1));
> > -		    targets_to_test[num_targets++] = target;
> > -		    found = 1;
> > -		}
> > +		    const cairo_boilerplate_target_t *target = list->target;
> > +		    const char *tcontent_name;
> > +		    const char *tcontent_end;
> > +		    if (_cairo_boilerplate_target_matches_name (target, tname, end)) {
> > +			    if ((tcontent_name = getenv ("CAIRO_TEST_TARGET_FORMAT")) != NULL && *tcontent_name) {
> > +				    while(tcontent_name) {
> > +					    tcontent_end = strpbrk (tcontent_name, " \t\r\n;:,");
> > +					    if (tcontent_end == tcontent_name) {
> > +						    tcontent_name = tcontent_end + 1;
> > +						    continue;
> > +					    }
> > +					    if(_cairo_boilerplate_target_format_matches_name (target,
> > +								    tcontent_name, tcontent_end)) {
> > +						    /* realloc isn't exactly the best thing here, but meh. */
> > +						    targets_to_test = xrealloc (targets_to_test, 
> > +								    sizeof(cairo_boilerplate_target_t *) * (num_targets+1));
> > +						    targets_to_test[num_targets++] = target;
> > +						    found = 1;
> > +					    }
> > +
> > +					    if (tcontent_end)
> > +						    tcontent_end++;
> > +					    tcontent_name = tcontent_end;
> > +				    }
> > +			    } else {
> > +				    /* realloc isn't exactly the best thing here, but meh. */
> > +				    targets_to_test = xrealloc (targets_to_test, 
> > +						    sizeof(cairo_boilerplate_target_t *) * (num_targets+1));
> > +				    targets_to_test[num_targets++] = target;
> > +				    found = 1;
> > +			    }
> > +		    }
> >  	    }
> >  
> >  	    if (!found) {
> > diff --git a/perf/Makefile.am b/perf/Makefile.am
> > index 92f0dfc..40b35bc 100644
> > --- a/perf/Makefile.am
> > +++ b/perf/Makefile.am
> > @@ -106,9 +106,10 @@ $(top_builddir)/util/cairo-script/libcairo-script-interpreter.la: $(top_builddir
> >  # and TARGETS make var on the command line.  Same for the rest.
> >  TARGETS = $(CAIRO_TEST_TARGET)
> >  TARGETS_EXCLUDE = $(CAIRO_TEST_TARGET_EXCLUDE)
> > +FORMAT = $(CAIRO_TEST_TARGET_FORMAT)
> >  ITERS = $(CAIRO_PERF_ITERATIONS)
> >  
> > -CAIRO_PERF_ENVIRONMENT = CAIRO_PERF_ITERATIONS="$(ITERS)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)"
> > +CAIRO_PERF_ENVIRONMENT = CAIRO_PERF_ITERATIONS="$(ITERS)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_FORMAT="$(FORMAT)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)"
> >  
> >  perf: cairo-perf-micro$(EXEEXT) cairo-perf-trace$(EXEEXT)
> >  	-$(CAIRO_PERF_ENVIRONMENT) ./cairo-perf-micro$(EXEEXT)
> > diff --git a/test/Makefile.am b/test/Makefile.am
> > index 547e5d2..81c50e6 100644
> > --- a/test/Makefile.am
> > +++ b/test/Makefile.am
> > @@ -289,13 +289,14 @@ EXTRA_PROGRAMS += $(TESTS)
> >  # and TARGETS make var on the command line.  Same for the rest.
> >  TARGETS = $(CAIRO_TEST_TARGET)
> >  TARGETS_EXCLUDE = $(CAIRO_TEST_TARGET_EXCLUDE)
> > +FORMAT = $(CAIRO_TEST_TARGET_FORMAT)
> >  NUM_THREADS = $(CAIRO_TEST_NUM_THREADS)
> >  MODE = $(CAIRO_TEST_MODE)
> >  
> >  # Same about ENV vs CAIRO_TEST_ENV.  ENV is used with "make run" only
> >  ENV = $(CAIRO_TEST_ENV)
> >  
> > -TESTS_ENVIRONMENT = CAIRO_TEST_MODE="$(MODE)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)" CAIRO_TEST_NUM_THREADS="$(NUM_THREADS)" $(ENV)
> > +TESTS_ENVIRONMENT = CAIRO_TEST_MODE="$(MODE)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_FORMAT="$(FORMAT)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)" CAIRO_TEST_NUM_THREADS="$(NUM_THREADS)" $(ENV)
> >  
> >  EXTRA_VALGRIND_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
> >  VALGRIND_FLAGS = \
> > -- 
> > 1.7.9.5
> > 
> > -- 
> > cairo mailing list
> > cairo at cairographics.org
> > http://lists.cairographics.org/mailman/listinfo/cairo
> -- 
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list