[Pixman] [PATCH 1/2] blitters-test: Make common formats more likely to be tested.

Søren Sandmann sandmann at cs.au.dk
Mon Jun 20 01:01:14 PDT 2011


From: Søren Sandmann Pedersen <ssp at redhat.com>

Move the eight most common formats to the top of the list of image
formats and make create_random_image() much more likely to select one
of those eight formats.

This should help catch more bugs in SIMD optimized operations.
---
 test/blitters-test.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/test/blitters-test.c b/test/blitters-test.c
index 3ecfb09..594ec54 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -14,6 +14,11 @@
 static pixman_indexed_t rgb_palette[9];
 static pixman_indexed_t y_palette[9];
 
+/* The first eight format in the list are by far the most widely
+ * used formats, so we test those more than the others
+ */
+#define N_MOST_LIKELY_FORMATS 8
+
 /* Create random image for testing purposes */
 static pixman_image_t *
 create_random_image (pixman_format_code_t *allowed_formats,
@@ -29,6 +34,9 @@ create_random_image (pixman_format_code_t *allowed_formats,
 
     while (allowed_formats[n] != PIXMAN_null)
 	n++;
+
+    if (n > N_MOST_LIKELY_FORMATS && lcg_rand_n (4) != 0)
+	n = N_MOST_LIKELY_FORMATS;
     fmt = allowed_formats[lcg_rand_n (n)];
 
     width = lcg_rand_n (max_width) + 1;
@@ -177,12 +185,14 @@ static pixman_op_t op_list[] = {
 
 static pixman_format_code_t img_fmt_list[] = {
     PIXMAN_a8r8g8b8,
+    PIXMAN_a8b8g8r8,
     PIXMAN_x8r8g8b8,
+    PIXMAN_x8b8g8r8,
     PIXMAN_r5g6b5,
-    PIXMAN_r3g3b2,
+    PIXMAN_b5g6r5,
     PIXMAN_a8,
-    PIXMAN_a8b8g8r8,
-    PIXMAN_x8b8g8r8,
+    PIXMAN_a1,
+    PIXMAN_r3g3b2,
     PIXMAN_b8g8r8a8,
     PIXMAN_b8g8r8x8,
     PIXMAN_r8g8b8a8,
@@ -190,8 +200,6 @@ static pixman_format_code_t img_fmt_list[] = {
     PIXMAN_x14r6g6b6,
     PIXMAN_r8g8b8,
     PIXMAN_b8g8r8,
-    PIXMAN_r5g6b5,
-    PIXMAN_b5g6r5,
     PIXMAN_x2r10g10b10,
     PIXMAN_a2r10g10b10,
     PIXMAN_x2b10g10r10,
@@ -204,7 +212,6 @@ static pixman_format_code_t img_fmt_list[] = {
     PIXMAN_x4r4g4b4,
     PIXMAN_a4b4g4r4,
     PIXMAN_x4b4g4r4,
-    PIXMAN_a8,
     PIXMAN_r3g3b2,
     PIXMAN_b2g3r3,
     PIXMAN_a2r2g2b2,
@@ -222,7 +229,6 @@ static pixman_format_code_t img_fmt_list[] = {
     PIXMAN_b1g2r1,
     PIXMAN_a1r1g1b1,
     PIXMAN_a1b1g1r1,
-    PIXMAN_a1,
     PIXMAN_null
 };
 
@@ -417,6 +423,6 @@ main (int argc, const char *argv[])
     }
 
     return fuzzer_test_main("blitters", 2000000,
-			    0x265CDFEB,
+			    0xB610300B,
 			    test_composite, argc, argv);
 }
-- 
1.6.0.6



More information about the Pixman mailing list