[cairo-commit] 3 commits - boilerplate/cairo-boilerplate.c perf/Makefile.am test/Makefile.am test/README

Bryce Harrington bryce at kemper.freedesktop.org
Fri Aug 15 03:22:07 PDT 2014


 boilerplate/cairo-boilerplate.c |  129 +++++++++++++++++++++++++++++++++-------
 perf/Makefile.am                |    3 
 test/Makefile.am                |    3 
 test/README                     |   17 +++--
 4 files changed, 125 insertions(+), 27 deletions(-)

New commits:
commit 7736d08e22ffd7ab9968617164c7e027125b7755
Author: Ravi Nanjundappa <nravi.n at samsung.com>
Date:   Wed Aug 6 09:49:59 2014 +0530

    README : Update README file related to usage of FORMAT make variable
    
    Reformatted the README file to simplify the sentences.
    
    Signed-off-by: Ravi Nanjundappa <nravi.n at samsung.com>
    Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/README b/test/README
index e8e7189..f143394 100644
--- a/test/README
+++ b/test/README
@@ -41,14 +41,21 @@ There are some mechanisms to limit the tests run during "make test".
 These come very handy when doing development, but should not be used
 to circumvent the "pass" requirements listed below.
 
-To limit the backends that the tests are run against, use the
-TARGETS make variable, that can also be passed to make.
-It should contain a (space-, comma-, etc-separated) list of backends to test.
-To limit the tests run, use the CAIRO_TESTS environment variable, which
-should be a space-separated list of tests to run.  For example:
+make's TARGETS environment variable can be used to limit the backends when
+running the tests. It should contain a (space-, comma-separated) list of
+backends. CAIRO_TESTS environment variable, which is a comma-, space-seperated
+lists, can be used to limit the tests run.
+For example:
 
   CAIRO_TESTS="zero-alpha" make test TARGETS=image,ps
 
+make's FORMAT variable can also be used to limit the content formats when
+running the tests. It should contain a (space-, comma-separated) list of
+content formats to test.
+For example:
+
+  CAIRO_TESTS="zero-alpha" make test TARGETS=image,ps FORMAT="rgb,rgba"
+
 Another very handy mechanism when trying to fix bugs is:
 
   make retest
commit c61aeddc44c8619a271151b2a2f6bf9f8ff2a18b
Author: Ravi Nanjundappa <nravi.n at samsung.com>
Date:   Tue Aug 5 14:31:37 2014 +0530

    test: improve selective execution of Cairo tests based on FORMAT option
    
    This patch improves the patch "test: Selective execution of Cairo tests based on FORMAT option"
    by extending the usage of FORMAT option even in the case of user not
    providing TARGETS= option
    
    For ex:
    (1). CAIRO_TESTS="zero-alpha" make test FORMAT=rgba
    This command runs the zero-alpha test for all the backends with
    argb32 content format and so on.
    (2). CAIRO_TESTS="zero-alpha" make test FORMAT=rgba,rgb
    This command runs the zero-alpha test for all the backends with
    argb32 and rgb24 content formats.
    
    Signed-off-by: Ravi Nanjundappa <nravi.n at samsung.com>
    Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 240f108..7fdbf79 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -683,20 +683,62 @@ cairo_boilerplate_get_targets (int	    *pnum_targets,
 	    tname = end;
 	}
     } else {
-	/* check all compiled in targets */
-	num_targets = 0;
-	for (list = cairo_boilerplate_targets; list != NULL; list = list->next)
-	    num_targets++;
+	    int found = 0;
+	    int not_found_targets = 0;
+	    num_targets = 0;
+	    targets_to_test = xmalloc (sizeof(cairo_boilerplate_target_t*) * num_targets);
+	    for (list = cairo_boilerplate_targets; list != NULL; list = list->next)
+	    {
+		    const cairo_boilerplate_target_t *target = list->target;
+		    const char *tcontent_name;
+		    const char *tcontent_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;
+				    }
+				    else
+				    {
+					    not_found_targets++;
+				    }
+
+				    if (tcontent_end)
+					    tcontent_end++;
+
+				    tcontent_name = tcontent_end;
+			    }
+		    }
+		    else
+		    {
+			    num_targets++;
+		    }
+	    }
+	    if (!found)
+	    {
+		    /* check all compiled in targets */
+		    num_targets = num_targets + not_found_targets;
+		    targets_to_test = xrealloc (targets_to_test,
+				    sizeof(cairo_boilerplate_target_t*) * num_targets);
+		    num_targets = 0;
+		    for (list = cairo_boilerplate_targets;
+				    list != NULL;
+				    list = list->next)
+		    {
+			    const cairo_boilerplate_target_t *target = list->target;
+			    targets_to_test[num_targets++] = target;
+		    }
+	    }
 
-	targets_to_test = xmalloc (sizeof(cairo_boilerplate_target_t*) * num_targets);
-	num_targets = 0;
-	for (list = cairo_boilerplate_targets;
-	     list != NULL;
-	     list = list->next)
-	{
-	    const cairo_boilerplate_target_t *target = list->target;
-	    targets_to_test[num_targets++] = target;
-	}
     }
 
     /* exclude targets as specified by the user */
commit f8e0ecb5af8859e2bff26cb719b10b3a9784f6f1
Author: Ravi Nanjundappa <nravi.n at samsung.com>
Date:   Thu Jul 24 14:19:21 2014 +0530

    test: Selective execution of Cairo tests based on FORMAT option
    
    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>
    Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index b19cd39..240f108 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 = \


More information about the cairo-commit mailing list