[PATCH rendercheck] Report which test groups passed successfully
Jeremy Huddleston
jeremyhu at apple.com
Mon May 9 18:31:34 PDT 2011
This was previously computed but never passed on to the caller.
Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
configure.ac | 2 +-
main.c | 83 +++++++++++++++++++++++++++++++++++----------------------
rendercheck.h | 5 +++-
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])
diff --git a/main.c b/main.c
index 9a97d72..7fa771c 100644
--- a/main.c
+++ b/main.c
@@ -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);
diff --git a/tests.c b/tests.c
index f722bc6..def1bf5 100644
--- a/tests.c
+++ b/tests.c
@@ -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;
}
--
1.7.4.1
More information about the xorg-devel
mailing list