diff options
author | Eric Anholt <anholt@freebsd.org> | 2005-01-27 03:12:08 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2005-01-27 03:12:08 +0000 |
commit | 2427ac0046a8f53bea8b709c2d6e90eacb355631 (patch) | |
tree | 3d0801903ef6f83acda607930785f3f515486f9f | |
parent | 7419df337982418ba11432c9f11a7b4056b70658 (diff) |
Allow users to specify the set of tests to be run.
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | main.c | 41 | ||||
-rw-r--r-- | rendercheck.1 | 5 | ||||
-rw-r--r-- | rendercheck.h | 11 | ||||
-rw-r--r-- | tests.c | 210 |
5 files changed, 174 insertions, 97 deletions
@@ -7,7 +7,3 @@ Tests currently include: - Transformed (FilterNearest) source coordinates correctness. - Composite with and without mask (with/without component alpha), with 1x1 repeating Pictures and 10x10 Pictures. - -Unfortunately, there are currently no command-line arguments to control -its execution. Options, such as verbosity or number of iterations to encourage -pixmap migration, are controlled only in source. @@ -33,6 +33,7 @@ extern int num_ops; extern int num_colors; int is_verbose = FALSE; +int enabled_tests = ~0; /* Enable all tests by default */ /* Number of times to repeat operations so that pixmaps will tend to get moved * into offscreen memory and allow hardware acceleration. @@ -107,7 +108,8 @@ describe_format(char *desc, int len, XRenderPictFormat *format) static void usage (char *program) { - fprintf(stderr, "usage: %s [-d display] [-v]\n", program); + fprintf(stderr, "usage: %s [-d display] [-v] [-t test1,test2,...]\n", + program); exit(1); } @@ -120,12 +122,47 @@ int main(int argc, char **argv) XSetWindowAttributes as; picture_info window; char *display = NULL; + char *test, *nextname; - while ((o = getopt (argc, argv, "d:v")) != -1) { + while ((o = getopt (argc, argv, "d:i:t:v")) != -1) { switch (o) { case 'd': display = optarg; break; + case 'i': + pixmap_move_iter = atoi(optarg); + break; + case 't': + nextname = optarg; + + /* disable all tests */ + 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 { + usage(argv[0]); + } + } + + break; case 'v': is_verbose = TRUE; break; diff --git a/rendercheck.1 b/rendercheck.1 index 9578f02..7c649cc 100644 --- a/rendercheck.1 +++ b/rendercheck.1 @@ -15,6 +15,11 @@ of Render implementations in X Servers. .BI \-d\ display Specifies the display to manage. .TP +.BI \-t\ test1,test2,test3... +Enables only a specific subset of the possible tests. Test names include +fill, dcoords, scoords, mcoords, tscoords, tmcoords, blend, composite, and +cacomposite. Names must be separated by commas and have no spaces. +.TP .BI \-v Enables verbose printing of information on tests run, and successes and failures. diff --git a/rendercheck.h b/rendercheck.h index 69ed6a5..41cb48d 100644 --- a/rendercheck.h +++ b/rendercheck.h @@ -50,11 +50,22 @@ struct op_info { char *name; }; +#define TEST_FILL 0x0001 +#define TEST_DSTCOORDS 0x0002 +#define TEST_SRCCOORDS 0x0004 +#define TEST_MASKCOORDS 0x0008 +#define TEST_TSRCCOORDS 0x0010 +#define TEST_TMASKCOORDS 0x0020 +#define TEST_BLEND 0x0040 +#define TEST_COMPOSITE 0x0080 +#define TEST_CACOMPOSITE 0x0100 + extern int pixmap_move_iter; extern int win_width, win_height; extern struct op_info ops[]; extern Bool is_verbose; extern color4d colors[]; +extern int enabled_tests; /* main.c */ void @@ -302,116 +302,144 @@ begin_test(Display *dpy, picture_info *win) argb_fill(dpy, &picture_3x3, x, y, 1, 1, c->a, c->r, c->g, c->b); } - 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]); - } + if (enabled_tests & TEST_FILL) { + 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]); + } - 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]); + 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]); + } } - 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], - &pictures_1x1[num_formats]); - - printf("Beginning src coords test\n"); - srccoords_test(dpy, win, &pictures_1x1[0], FALSE); - - printf("Beginning mask coords test\n"); - srccoords_test(dpy, win, &pictures_1x1[0], TRUE); + if (enabled_tests & TEST_DSTCOORDS) { + 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], + &pictures_1x1[num_formats]); + } - printf("Beginning transformed src coords test\n"); - trans_coords_test(dpy, win, &pictures_1x1[0], FALSE); + if (enabled_tests & TEST_SRCCOORDS) { + printf("Beginning src coords test\n"); + srccoords_test(dpy, win, &pictures_1x1[0], FALSE); + } - printf("Beginning transformed mask coords test\n"); - trans_coords_test(dpy, win, &pictures_1x1[0], TRUE); + if (enabled_tests & TEST_MASKCOORDS) { + printf("Beginning mask coords test\n"); + srccoords_test(dpy, win, &pictures_1x1[0], TRUE); + } - for (i = 0; i < num_ops; i++) { - for (j = 0; j <= num_dests; j++) { - picture_info *pi; + if (enabled_tests & TEST_TSRCCOORDS) { + printf("Beginning transformed src coords test\n"); + trans_coords_test(dpy, win, &pictures_1x1[0], FALSE); + } - if (j != num_dests) - pi = &dests[j]; - else - pi = win; - printf("Beginning %s blend test on %s\n", ops[i].name, - pi->name); + if (enabled_tests & TEST_TMASKCOORDS) { + printf("Beginning transformed mask coords test\n"); + trans_coords_test(dpy, win, &pictures_1x1[0], TRUE); + } - for (src = 0; src < num_colors * num_formats; src++) { - for (dst = 0; dst < num_colors; dst++) { - blend_test(dpy, win, pi, i, - &pictures_1x1[src], &pictures_1x1[dst]); - blend_test(dpy, win, pi, i, - &pictures_10x10[src], &pictures_1x1[dst]); + if (enabled_tests & TEST_BLEND) { + for (i = 0; i < num_ops; i++) { + for (j = 0; j <= num_dests; j++) { + picture_info *pi; + + if (j != num_dests) + pi = &dests[j]; + else + pi = win; + printf("Beginning %s blend test on %s\n", ops[i].name, + pi->name); + + for (src = 0; src < num_colors * num_formats; src++) { + for (dst = 0; dst < num_colors; dst++) { + blend_test(dpy, win, pi, i, + &pictures_1x1[src], + &pictures_1x1[dst]); + blend_test(dpy, win, pi, i, + &pictures_10x10[src], + &pictures_1x1[dst]); + } } + } } - } } - for (i = 0; i < num_ops; i++) { - for (j = 0; j <= num_dests; j++) { - picture_info *pi; - - if (j != num_dests) - pi = &dests[j]; - else - pi = win; - printf("Beginning %s composite mask test on %s\n", ops[i].name, - pi->name); - - 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, - &pictures_10x10[src], &pictures_10x10[mask], - &pictures_1x1[dst], FALSE, TRUE); - composite_test(dpy, win, pi, i, - &pictures_1x1[src], &pictures_10x10[mask], - &pictures_1x1[dst], FALSE, TRUE); - composite_test(dpy, win, pi, i, - &pictures_10x10[src], &pictures_1x1[mask], - &pictures_1x1[dst], FALSE, TRUE); - composite_test(dpy, win, pi, i, - &pictures_1x1[src], &pictures_1x1[mask], - &pictures_1x1[dst], FALSE, TRUE); + if (enabled_tests & TEST_COMPOSITE) { + for (i = 0; i < num_ops; i++) { + for (j = 0; j <= num_dests; j++) { + picture_info *pi; + + if (j != num_dests) + pi = &dests[j]; + else + pi = win; + printf("Beginning %s composite mask test on %s\n", + ops[i].name, pi->name); + + 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, + &pictures_10x10[src], + &pictures_10x10[mask], + &pictures_1x1[dst], FALSE, TRUE); + composite_test(dpy, win, pi, i, + &pictures_1x1[src], + &pictures_10x10[mask], + &pictures_1x1[dst], FALSE, TRUE); + composite_test(dpy, win, pi, i, + &pictures_10x10[src], + &pictures_1x1[mask], + &pictures_1x1[dst], FALSE, TRUE); + composite_test(dpy, win, pi, i, + &pictures_1x1[src], + &pictures_1x1[mask], + &pictures_1x1[dst], FALSE, TRUE); + } + } } } } - } } - for (i = 0; i < num_ops; i++) { - for (j = 0; j <= num_dests; j++) { - picture_info *pi; - - if (j != num_dests) - pi = &dests[j]; - else - pi = win; - printf("Beginning %s composite CA mask test on %s\n", - ops[i].name, pi->name); - - 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, - &pictures_10x10[src], &pictures_10x10[mask], - &pictures_1x1[dst], TRUE, TRUE); - composite_test(dpy, win, pi, i, - &pictures_1x1[src], &pictures_10x10[mask], - &pictures_1x1[dst], TRUE, TRUE); - composite_test(dpy, win, pi, i, - &pictures_10x10[src], &pictures_1x1[mask], - &pictures_1x1[dst], TRUE, TRUE); - composite_test(dpy, win, pi, i, - &pictures_1x1[src], &pictures_1x1[mask], - &pictures_1x1[dst], TRUE, TRUE); + if (enabled_tests & TEST_CACOMPOSITE) { + for (i = 0; i < num_ops; i++) { + for (j = 0; j <= num_dests; j++) { + picture_info *pi; + + if (j != num_dests) + pi = &dests[j]; + else + pi = win; + printf("Beginning %s composite CA mask test on %s\n", + ops[i].name, pi->name); + + 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, + &pictures_10x10[src], + &pictures_10x10[mask], + &pictures_1x1[dst], TRUE, TRUE); + composite_test(dpy, win, pi, i, + &pictures_1x1[src], + &pictures_10x10[mask], + &pictures_1x1[dst], TRUE, TRUE); + composite_test(dpy, win, pi, i, + &pictures_10x10[src], + &pictures_1x1[mask], + &pictures_1x1[dst], TRUE, TRUE); + composite_test(dpy, win, pi, i, + &pictures_1x1[src], + &pictures_1x1[mask], + &pictures_1x1[dst], TRUE, TRUE); + } + } } } } - } } } |