diff options
author | Ravi Nanjundappa <nravi.n@samsung.com> | 2014-07-24 14:19:21 +0530 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2014-08-14 16:09:20 -0700 |
commit | f8e0ecb5af8859e2bff26cb719b10b3a9784f6f1 (patch) | |
tree | 74b08c775b8fa14e1777d59eecc85b17585c9f14 /boilerplate | |
parent | 1d9f4ae5208d86843a6001d10c9cb5b16df2b785 (diff) |
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@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate.c | 61 |
1 files changed, 54 insertions, 7 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) { |