diff options
-rw-r--r-- | boilerplate/cairo-boilerplate.c | 61 | ||||
-rw-r--r-- | perf/Makefile.am | 3 | ||||
-rw-r--r-- | test/Makefile.am | 3 |
3 files changed, 58 insertions, 9 deletions
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index b19cd397e..240f108f7 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 92f0dfc15..40b35bc38 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 547e5d28e..81c50e60f 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 = \ |