diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-05-07 18:18:40 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-05-10 11:48:41 -0700 |
commit | a30927f9b4279e2404f4deea2e3966364d5f0fd0 (patch) | |
tree | 198ee744324bd061a827f212046c1df61baacdec | |
parent | 73623549b4eae25f0884f11875d95b3b8fa948cf (diff) |
Report which test groups passed successfully
This was previously computed but never passed on to the caller.
Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | main.c | 83 | ||||
-rw-r--r-- | rendercheck.h | 5 | ||||
-rw-r--r-- | tests.c | 2 |
4 files changed, 58 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac index 4fa5a63..09b07bd 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ XORG_DEFAULT_OPTIONS AC_CHECK_HEADERS([err.h]) # Checks for pkg-config packages -PKG_CHECK_MODULES(RC, [xrender x11]) +PKG_CHECK_MODULES(RC, [xrender x11 xproto >= 7.0.17]) AC_CONFIG_FILES([Makefile man/Makefile]) @@ -103,16 +103,55 @@ describe_format(char *desc, int len, XRenderPictFormat *format) } } +struct { + int flag; + const char *name; +} available_tests[] = { + {TEST_FILL, "fill"}, + {TEST_DSTCOORDS, "dcoords"}, + {TEST_SRCCOORDS, "scoords"}, + {TEST_MASKCOORDS, "mcoords"}, + {TEST_TSRCCOORDS, "tscoords"}, + {TEST_TMASKCOORDS, "tmcoords"}, + {TEST_BLEND, "blend"}, + {TEST_COMPOSITE, "composite"}, + {TEST_CACOMPOSITE, "cacomposite"}, + {TEST_GRADIENTS, "gradients"}, + {TEST_REPEAT, "repeat"}, + {TEST_TRIANGLES, "triangles"}, + {TEST_BUG7366, "bug7366"}, + {0, NULL} +}; + +void print_tests(FILE *file, int tests) { + int i, j; + + for (i=0, j=0; available_tests[i].name; i++) { + if (!(available_tests[i].flag & tests)) + continue; + if (j % 5 == 0) { + if(j != 0) + putc('\n', stderr); + putc('\t', stderr); + } else { + fprintf(stderr, ", "); + } + fprintf(stderr, "%s", available_tests[i].name); + j++; + } + if (j) + fprintf(file, "\n"); +} + +_X_NORETURN static void usage (char *program) { fprintf(stderr, "usage: %s [-d|--display display] [-v|--verbose]\n" "\t[-t test1,test2,...] [-o op1,op2,...] [-f format1,format2,...]\n" "\t[--sync] [--minimalrendering] [--version]\n" - "\tAvailable tests: fill,dcoords,scoords,mcoords,tscoords,\n" - "\t\ttmcoords,blend,composite,cacomposite,gradients,repeat,triangles,\n" - "\t\tbug7366\n", - program); + "Available tests:\n", program); + print_tests(stderr, ~0); exit(1); } @@ -197,35 +236,15 @@ int main(int argc, char **argv) enabled_tests = 0; while ((test = strsep(&nextname, ",")) != NULL) { - if (strcmp(test, "fill") == 0) { - enabled_tests |= TEST_FILL; - } else if (strcmp(test, "dcoords") == 0) { - enabled_tests |= TEST_DSTCOORDS; - } else if (strcmp(test, "scoords") == 0) { - enabled_tests |= TEST_SRCCOORDS; - } else if (strcmp(test, "mcoords") == 0) { - enabled_tests |= TEST_MASKCOORDS; - } else if (strcmp(test, "tscoords") == 0) { - enabled_tests |= TEST_TSRCCOORDS; - } else if (strcmp(test, "tmcoords") == 0) { - enabled_tests |= TEST_TMASKCOORDS; - } else if (strcmp(test, "blend") == 0) { - enabled_tests |= TEST_BLEND; - } else if (strcmp(test, "composite") == 0) { - enabled_tests |= TEST_COMPOSITE; - } else if (strcmp(test, "cacomposite") == 0) { - enabled_tests |= TEST_CACOMPOSITE; - } else if (strcmp(test, "gradients") == 0) { - enabled_tests |= TEST_GRADIENTS; - } else if (strcmp(test, "repeat") == 0) { - enabled_tests |= TEST_REPEAT; - } else if (strcmp(test, "triangles") == 0) { - enabled_tests |= TEST_TRIANGLES; - } else if (strcmp(test, "bug7366") == 0) { - enabled_tests |= TEST_BUG7366; - } else { - usage(argv[0]); + int i; + for(i=0; available_tests[i].name; i++) { + if(strcmp(test, available_tests[i].name) == 0) { + enabled_tests |= available_tests[i].flag; + break; + } } + if(available_tests[i].name == NULL) + usage(argv[0]); } break; diff --git a/rendercheck.h b/rendercheck.h index 34d06c5..92ce789 100644 --- a/rendercheck.h +++ b/rendercheck.h @@ -22,12 +22,12 @@ #include <X11/Xlib.h> #include <X11/extensions/Xrender.h> +#include <stdio.h> #if HAVE_ERR_H # include <err.h> #else # include <stdarg.h> -# include <stdio.h> # include <stdlib.h> static inline void errx(int eval, const char *fmt, ...) { va_list args; @@ -101,6 +101,9 @@ describe_format(char *desc, int len, XRenderPictFormat *format); int bit_count(int i); +void +print_tests(FILE *file, int tests); + /* tests.c */ void color_correct(picture_info *pi, color4d *color); @@ -753,6 +753,8 @@ do { \ free(test_dst); printf("%d tests passed of %d total\n", tests_passed, tests_total); + printf("Successful Groups:\n"); + print_tests(stdout, success_mask); return tests_passed == tests_total; } |