[cairo-commit] boilerplate/cairo-boilerplate.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Sep 3 06:38:45 PDT 2007


 boilerplate/cairo-boilerplate.c |   39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

New commits:
diff-tree b60c0a672f1711c20f898ac76c15b6b65a63d46e (from c8ed3e1827dd1e6e85f2a40de67c4013432ba3bf)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 3 14:33:11 2007 +0100

    [cairo-boilerplate] Introduce CAIRO_TEST_TARGET_EXCLUDE.
    
    As opposed to the CAIRO_TEST_TARGET env var which lists the exact
    targets to test, CAIRO_TEST_TARGET_EXCLUDE instead supplies a list of
    targets to filter from the testing set. This is useful under
    circumstances where the build environment prevents testing of a target,
    for example no DirectFB support or the glitz library is broken, but where
    you still want to perform the minimal check that the code compiles.

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index b9438a2..9479284 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -356,7 +356,7 @@ cairo_boilerplate_get_targets (int *pnum
     cairo_boilerplate_target_t **targets_to_test;
 
     if ((tname = getenv ("CAIRO_TEST_TARGET")) != NULL && *tname) {
-
+	/* check the list of targets specified by the user */
 	limited_targets = TRUE;
 
 	num_targets = 0;
@@ -393,6 +393,7 @@ cairo_boilerplate_get_targets (int *pnum
 	    tname = end;
 	}
     } else {
+	/* check all compiled in targets */
 	num_targets = sizeof (targets) / sizeof (targets[0]);
 	targets_to_test = xmalloc (sizeof(cairo_boilerplate_target_t*) * num_targets);
 	for (i = 0; i < num_targets; i++) {
@@ -400,6 +401,42 @@ cairo_boilerplate_get_targets (int *pnum
 	}
     }
 
+    /* exclude targets as specified by the user */
+    if ((tname = getenv ("CAIRO_TEST_TARGET_EXCLUDE")) != NULL && *tname) {
+	limited_targets = TRUE;
+
+	while (*tname) {
+	    int j, found = 0;
+	    const char *end = strpbrk (tname, " \t\r\n;:,");
+	    if (!end)
+	        end = tname + strlen (tname);
+
+	    if (end == tname) {
+		tname = end + 1;
+		continue;
+	    }
+
+	    for (i = j = 0; i < num_targets; i++) {
+		if (0 == strncmp (targets_to_test[i]->name, tname, end - tname) &&
+		    !isalnum (targets_to_test[i]->name[end - tname])) {
+		    found = 1;
+		} else {
+		    targets_to_test[j++] = targets_to_test[i];
+		}
+	    }
+	    num_targets = j;
+
+	    if (!found) {
+		fprintf (stderr, "Cannot find target '%.*s'\n", (int)(end - tname), tname);
+		exit(-1);
+	    }
+
+	    if (*end)
+	      end++;
+	    tname = end;
+	}
+    }
+
     if (pnum_targets)
 	*pnum_targets = num_targets;
 


More information about the cairo-commit mailing list