rendercheck: 2 commits - doc/TODO main.c rendercheck.h tests.c

Eric Anholt anholt at kemper.freedesktop.org
Fri Apr 21 19:27:31 EEST 2006


 doc/TODO      |    2 
 main.c        |    6 +-
 rendercheck.h |    4 -
 tests.c       |  125 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 4 files changed, 108 insertions(+), 29 deletions(-)

New commits:
diff-tree f95ea74cd31f28e33a0c888f9ab26a6408fb1d2e (from beeae5eb9b1d85d8e3b638e7927d94ad2f3c5f1d)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Apr 21 09:21:50 2006 -0700

    Update TODO list.

diff --git a/doc/TODO b/doc/TODO
index e4e68cc..ee20732 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -4,7 +4,5 @@
 - Get a useful number being produced for error values, and correct eval_diff's
   limit.
 - Check source/mask pixels falling outside the drawable.
-- Command line args for what tests, move iter, etc.
-- Check repeating of sources with various sizes.
 - Check trapezoids!
 - get_pixel equivalent that doesn't involve round-trips per call.
diff-tree beeae5eb9b1d85d8e3b638e7927d94ad2f3c5f1d (from 9d46f6e9528040416356602688d717a2bb0dd2a5)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Apr 21 09:20:21 2006 -0700

    Count the successes and failures of tests, printing results when finished, and
    returning a failure exit code if we failed any tests.

diff --git a/main.c b/main.c
index 8c4de3f..f3fd525 100644
--- a/main.c
+++ b/main.c
@@ -242,8 +242,10 @@ int main(int argc, char **argv)
 
 	while (XNextEvent(dpy, &ev) == 0) {
 		if (ev.type == Expose && !ev.xexpose.count) {
-			begin_test(dpy, &window);
-			exit(0);
+			if (do_tests(dpy, &window))
+				exit(0);
+			else
+				exit(1);
 		}
 	}
 
diff --git a/rendercheck.h b/rendercheck.h
index 648ef9e..5d9521b 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -87,8 +87,8 @@ void
 argb_fill(Display *dpy, picture_info *p, int x, int y, int w, int h, float a,
     float r, float g, float b);
 
-void
-begin_test(Display *dpy, picture_info *win);
+Bool
+do_tests(Display *dpy, picture_info *win);
 
 /* ops.c */
 void
diff --git a/tests.c b/tests.c
index 4b3c87f..ee4a208 100644
--- a/tests.c
+++ b/tests.c
@@ -194,12 +194,13 @@ argb_fill(Display *dpy, picture_info *p,
 	XRenderFillRectangle(dpy, PictOpSrc, p->pict, &rendercolor, x, y, w, h);
 }
 
-void
-begin_test(Display *dpy, picture_info *win)
+Bool
+do_tests(Display *dpy, picture_info *win)
 {
 	int i, j, src, dst = 0, mask;
 	int num_dests, num_formats;
 	picture_info *dests, *pictures_1x1, *pictures_10x10, picture_3x3, *pictures_solid;
+	int success_mask = 0, tests_passed = 0, tests_total = 0;
 
 	num_dests = 3;
 	dests = (picture_info *)malloc(num_dests * sizeof(dests[0]));
@@ -323,46 +324,87 @@ begin_test(Display *dpy, picture_info *w
             pictures_solid[i].name = "Solid";
         }
 
+#define RECORD_RESULTS()					\
+do {								\
+	group_ok = group_ok && ok;				\
+	if (ok)							\
+		tests_passed++;					\
+	tests_total++;						\
+} while (0)
+
 	if (enabled_tests & TEST_FILL) {
+		Bool ok, group_ok = TRUE;
+
 		printf("Beginning testing of filling of 1x1R pictures\n");
 		for (i = 0; i < num_colors * num_formats; i++) {
-			fill_test(dpy, win, &pictures_1x1[i]);
+			ok = fill_test(dpy, win, &pictures_1x1[i]);
+			RECORD_RESULTS();
 		}
 
 		printf("Beginning testing of filling of 10x10 pictures\n");
 		for (i = 0; i < num_colors * num_formats; i++) {
-			fill_test(dpy, win, &pictures_10x10[i]);
+			ok = fill_test(dpy, win, &pictures_10x10[i]);
+			RECORD_RESULTS();
 		}
+		if (group_ok)
+			success_mask |= TEST_FILL;
 	}
 
 	if (enabled_tests & TEST_DSTCOORDS) {
+		Bool ok, group_ok = TRUE;
+
 		printf("Beginning dest coords test\n");
 		/* 0 and num_formats should result in ARGB8888 red on ARGB8888 white. */
-		dstcoords_test(dpy, win, &dests[0], &pictures_1x1[0],
+		ok = dstcoords_test(dpy, win, &dests[0], &pictures_1x1[0],
 		    &pictures_1x1[num_formats]);
+		RECORD_RESULTS();
+		if (group_ok)
+			success_mask |= TEST_DSTCOORDS;
 	}
 
 	if (enabled_tests & TEST_SRCCOORDS) {
+		Bool ok, group_ok = TRUE;
+
 		printf("Beginning src coords test\n");
-		srccoords_test(dpy, win, &pictures_1x1[0], FALSE);
+		ok = srccoords_test(dpy, win, &pictures_1x1[0], FALSE);
+		RECORD_RESULTS();
+		if (group_ok)
+			success_mask |= TEST_SRCCOORDS;
 	}
 
 	if (enabled_tests & TEST_MASKCOORDS) {
+		Bool ok, group_ok = TRUE;
+
 		printf("Beginning mask coords test\n");
-		srccoords_test(dpy, win, &pictures_1x1[0], TRUE);
+		ok = srccoords_test(dpy, win, &pictures_1x1[0], TRUE);
+		RECORD_RESULTS();
+		if (group_ok)
+			success_mask |= TEST_MASKCOORDS;
 	}
 
 	if (enabled_tests & TEST_TSRCCOORDS) {
+		Bool ok, group_ok = TRUE;
+
 		printf("Beginning transformed src coords test\n");
-		trans_coords_test(dpy, win, &pictures_1x1[0], FALSE);
+		ok = trans_coords_test(dpy, win, &pictures_1x1[0], FALSE);
+		RECORD_RESULTS();
+		if (group_ok)
+			success_mask |= TEST_TSRCCOORDS;
 	}
 
 	if (enabled_tests & TEST_TMASKCOORDS) {
+		Bool ok, group_ok = TRUE;
+
 		printf("Beginning transformed mask coords test\n");
-		trans_coords_test(dpy, win, &pictures_1x1[0], TRUE);
+		ok = trans_coords_test(dpy, win, &pictures_1x1[0], TRUE);
+		RECORD_RESULTS();
+		if (group_ok)
+			success_mask |= TEST_TMASKCOORDS;
 	}
 
 	if (enabled_tests & TEST_BLEND) {
+		Bool ok, group_ok = TRUE;
+
 		for (i = 0; i < num_ops; i++) {
 		    for (j = 0; j <= num_dests; j++) {
 			picture_info *pi;
@@ -376,24 +418,31 @@ begin_test(Display *dpy, picture_info *w
 
 			for (src = 0; src < num_colors * num_formats; src++) {
 				for (dst = 0; dst < num_colors; dst++) {
-					blend_test(dpy, win, pi, i,
+					ok = blend_test(dpy, win, pi, i,
 					    &pictures_1x1[src],
 					    &pictures_1x1[dst]);
-					blend_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = blend_test(dpy, win, pi, i,
 					    &pictures_10x10[src],
 					    &pictures_1x1[dst]);
+					RECORD_RESULTS();
 				}
 			}
                         for (src = 0; src < num_colors; src++) {
                             for (dst = 0; dst < num_colors; dst++) {
-                                blend_test(dpy, win, pi, i, &pictures_solid[src], &pictures_1x1[dst]);
+                                ok = blend_test(dpy, win, pi, i, &pictures_solid[src], &pictures_1x1[dst]);
+				RECORD_RESULTS();
                             }
                         }
 		    }
 		}
+		if (group_ok)
+			success_mask |= TEST_BLEND;
 	}
 
 	if (enabled_tests & TEST_COMPOSITE) {
+		Bool ok, group_ok = TRUE;
+
 		for (i = 0; i < num_ops; i++) {
 		    for (j = 0; j <= num_dests; j++) {
 			picture_info *pi;
@@ -408,30 +457,38 @@ begin_test(Display *dpy, picture_info *w
 			for (src = 0; src < num_colors; src++) {
 			    for (mask = 0; mask < num_colors; mask++) {
 				for (dst = 0; dst < num_colors; dst++) {
-					composite_test(dpy, win, pi, i,
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_10x10[src],
 					    &pictures_10x10[mask],
 					    &pictures_1x1[dst], FALSE, TRUE);
-					composite_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_1x1[src],
 					    &pictures_10x10[mask],
 					    &pictures_1x1[dst], FALSE, TRUE);
-					composite_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_10x10[src],
 					    &pictures_1x1[mask],
 					    &pictures_1x1[dst], FALSE, TRUE);
-					composite_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_1x1[src],
 					    &pictures_1x1[mask],
 					    &pictures_1x1[dst], FALSE, TRUE);
+					RECORD_RESULTS();
 				}
 			    }
 			}
 		    }
 		}
+		if (group_ok)
+			success_mask |= TEST_COMPOSITE;
 	}
 
 	if (enabled_tests & TEST_CACOMPOSITE) {
+		Bool ok, group_ok = TRUE;
+
 		for (i = 0; i < num_ops; i++) {
 		    for (j = 0; j <= num_dests; j++) {
 			picture_info *pi;
@@ -446,30 +503,38 @@ begin_test(Display *dpy, picture_info *w
 			for (src = 0; src < num_colors; src++) {
 			    for (mask = 0; mask < num_colors; mask++) {
 				for (dst = 0; dst < num_colors; dst++) {
-					composite_test(dpy, win, pi, i,
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_10x10[src],
 					    &pictures_10x10[mask],
 					    &pictures_1x1[dst], TRUE, TRUE);
-					composite_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_1x1[src],
 					    &pictures_10x10[mask],
 					    &pictures_1x1[dst], TRUE, TRUE);
-					composite_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_10x10[src],
 					    &pictures_1x1[mask],
 					    &pictures_1x1[dst], TRUE, TRUE);
-					composite_test(dpy, win, pi, i,
+					RECORD_RESULTS();
+					ok = composite_test(dpy, win, pi, i,
 					    &pictures_1x1[src],
 					    &pictures_1x1[mask],
 					    &pictures_1x1[dst], TRUE, TRUE);
+					RECORD_RESULTS();
 				}
 			    }
 			}
 		    }
 		}
+		if (group_ok)
+			success_mask |= TEST_CACOMPOSITE;
 	}
 
         if (enabled_tests & TEST_GRADIENTS) {
+	    Bool ok, group_ok = TRUE;
+
             for (i = 0; i < num_ops; i++) {
                 for (j = 0; j <= num_dests; j++) {
                     picture_info *pi;
@@ -483,14 +548,20 @@ begin_test(Display *dpy, picture_info *w
                     
                     for (src = 0; src < num_colors; src++) {
                         for (mask = 0; mask < num_colors; mask++) {
-                            linear_gradient_test(dpy, win, pi, i, &pictures_1x1[dst]);
+                            ok = linear_gradient_test(dpy, win, pi, i,
+				&pictures_1x1[dst]);
+			    RECORD_RESULTS();
                         }
                     }
                 }
             }
+	    if (group_ok)
+		 success_mask |= TEST_GRADIENTS;
         }
 
         if (enabled_tests & TEST_REPEAT) {
+	    Bool ok, group_ok = TRUE;
+
             for (i = 0; i < num_ops; i++) {
                 for (j = 0; j <= num_dests; j++) {
                     picture_info *pi;
@@ -504,17 +575,25 @@ begin_test(Display *dpy, picture_info *w
 		    /* Test with white dest, and generated repeating src
 		     * consisting of colors 1 and 2 (r, g).
 		     */
-		    repeat_test(dpy, win, pi, i, argb32white, argb32red,
+		    ok = repeat_test(dpy, win, pi, i, argb32white, argb32red,
 		        argb32green, FALSE);
+		    RECORD_RESULTS();
 
                     printf("Beginning %s mask repeat test on %s\n",
                            ops[i].name, pi->name);
 		    /* Test with white dest, translucent red src, and generated
 		     * repeating mask consisting of colors 1 and 2 (r, g).
 		     */
-		    repeat_test(dpy, win, pi, i, argb32white, argb32red,
+		    ok = repeat_test(dpy, win, pi, i, argb32white, argb32red,
 		        argb32green, TRUE);
+		    RECORD_RESULTS();
                 }
             }
+	    if (group_ok)
+		success_mask |= TEST_REPEAT;
         }
+
+	printf("%d tests passed of %d total\n", tests_passed, tests_total);
+
+	return tests_passed == tests_total;
 }



More information about the xorg-commit mailing list