aboutsummaryrefslogtreecommitdiff
path: root/pixman/test
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
committermarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
commit990bc3f015a4f8fce2eb918375defcd44980a845 (patch)
tree8e8301f19482b52cc00bd95b4593522cc93267af /pixman/test
parent1af6fc1b5d93e54d6674de8b5870448b29f139a7 (diff)
downloadvcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.gz
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.bz2
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.zip
Used synchronise script to update files
Diffstat (limited to 'pixman/test')
-rw-r--r--pixman/test/fuzzer-find-diff.pl136
-rw-r--r--pixman/test/region-test.c246
2 files changed, 191 insertions, 191 deletions
diff --git a/pixman/test/fuzzer-find-diff.pl b/pixman/test/fuzzer-find-diff.pl
index a43f6fb83..53d9b8de1 100644
--- a/pixman/test/fuzzer-find-diff.pl
+++ b/pixman/test/fuzzer-find-diff.pl
@@ -1,68 +1,68 @@
-#!/usr/bin/env perl
-
-$usage = "Usage:
- fuzzer-find-diff.pl reference_binary new_binary [number_of_tests_to_run]
-
-The first two input arguments are the commands to run the test programs
-based on fuzzer_test_main() function from 'util.c' (preferably they should
-be statically compiled, this can be achieved via '--disable-shared' pixman
-configure option). The third optional argument is the number of test rounds
-to run (if not specified, then testing runs infinitely or until some problem
-is detected).
-
-Usage examples:
- fuzzer-find-diff.pl ./blitters-test-with-sse-disabled ./blitters-test 9000000
- fuzzer-find-diff.pl ./blitters-test \"ssh ppc64_host /path/to/blitters-test\"
-";
-
-$#ARGV >= 1 or die $usage;
-
-$batch_size = 10000;
-
-if ($#ARGV >= 2) {
- $number_of_tests = int($ARGV[2]);
-} else {
- $number_of_tests = -1
-}
-
-sub test_range {
- my $min = shift;
- my $max = shift;
-
- if (`$ARGV[0] $min $max 2>/dev/null` eq `$ARGV[1] $min $max 2>/dev/null`) {
- return;
- }
-
- while ($max != $min + 1) {
- my $avg = int(($min + $max) / 2);
- my $res1 = `$ARGV[0] $min $avg 2>/dev/null`;
- my $res2 = `$ARGV[1] $min $avg 2>/dev/null`;
- if ($res1 ne $res2) {
- $max = $avg;
- } else {
- $min = $avg;
- }
- }
- return $max;
-}
-
-$base = 1;
-while ($number_of_tests <= 0 || $base <= $number_of_tests) {
- printf("testing %-12d\r", $base + $batch_size - 1);
- my $res = test_range($base, $base + $batch_size - 1);
- if ($res) {
- printf("Failure: results are different for test %d:\n", $res);
-
- printf("\n-- ref --\n");
- print `$ARGV[0] $res`;
- printf("-- new --\n");
- print `$ARGV[1] $res`;
-
- printf("The problematic conditions can be reproduced by running:\n");
- printf("$ARGV[1] %d\n", $res);
-
- exit(1);
- }
- $base += $batch_size;
-}
-printf("Success: %d tests finished\n", $base - 1);
+#!/usr/bin/env perl
+
+$usage = "Usage:
+ fuzzer-find-diff.pl reference_binary new_binary [number_of_tests_to_run]
+
+The first two input arguments are the commands to run the test programs
+based on fuzzer_test_main() function from 'util.c' (preferably they should
+be statically compiled, this can be achieved via '--disable-shared' pixman
+configure option). The third optional argument is the number of test rounds
+to run (if not specified, then testing runs infinitely or until some problem
+is detected).
+
+Usage examples:
+ fuzzer-find-diff.pl ./blitters-test-with-sse-disabled ./blitters-test 9000000
+ fuzzer-find-diff.pl ./blitters-test \"ssh ppc64_host /path/to/blitters-test\"
+";
+
+$#ARGV >= 1 or die $usage;
+
+$batch_size = 10000;
+
+if ($#ARGV >= 2) {
+ $number_of_tests = int($ARGV[2]);
+} else {
+ $number_of_tests = -1
+}
+
+sub test_range {
+ my $min = shift;
+ my $max = shift;
+
+ if (`$ARGV[0] $min $max 2>/dev/null` eq `$ARGV[1] $min $max 2>/dev/null`) {
+ return;
+ }
+
+ while ($max != $min + 1) {
+ my $avg = int(($min + $max) / 2);
+ my $res1 = `$ARGV[0] $min $avg 2>/dev/null`;
+ my $res2 = `$ARGV[1] $min $avg 2>/dev/null`;
+ if ($res1 ne $res2) {
+ $max = $avg;
+ } else {
+ $min = $avg;
+ }
+ }
+ return $max;
+}
+
+$base = 1;
+while ($number_of_tests <= 0 || $base <= $number_of_tests) {
+ printf("testing %-12d\r", $base + $batch_size - 1);
+ my $res = test_range($base, $base + $batch_size - 1);
+ if ($res) {
+ printf("Failure: results are different for test %d:\n", $res);
+
+ printf("\n-- ref --\n");
+ print `$ARGV[0] $res`;
+ printf("-- new --\n");
+ print `$ARGV[1] $res`;
+
+ printf("The problematic conditions can be reproduced by running:\n");
+ printf("$ARGV[1] %d\n", $res);
+
+ exit(1);
+ }
+ $base += $batch_size;
+}
+printf("Success: %d tests finished\n", $base - 1);
diff --git a/pixman/test/region-test.c b/pixman/test/region-test.c
index 9d5a41eb9..a1fc4a837 100644
--- a/pixman/test/region-test.c
+++ b/pixman/test/region-test.c
@@ -1,123 +1,123 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "utils.h"
-
-int
-main ()
-{
- pixman_region32_t r1;
- pixman_region32_t r2;
- pixman_region32_t r3;
- pixman_box32_t boxes[] = {
- { 10, 10, 20, 20 },
- { 30, 30, 30, 40 },
- { 50, 45, 60, 44 },
- };
- pixman_box32_t boxes2[] = {
- { 2, 6, 7, 6 },
- { 4, 1, 6, 7 },
- };
- pixman_box32_t boxes3[] = {
- { 2, 6, 7, 6 },
- { 4, 1, 6, 1 },
- };
- int i, j;
- pixman_box32_t *b;
- pixman_image_t *image, *fill;
- pixman_color_t white = {
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff
- };
-
- /* This used to go into an infinite loop before pixman-region.c
- * was fixed to not use explict "short" variables
- */
- pixman_region32_init_rect (&r1, 0, 0, 20, 64000);
- pixman_region32_init_rect (&r2, 0, 0, 20, 64000);
- pixman_region32_init_rect (&r3, 0, 0, 20, 64000);
-
- pixman_region32_subtract (&r1, &r2, &r3);
-
-
- /* This would produce a region containing an empty
- * rectangle in it. Such regions are considered malformed,
- * but using an empty rectangle for initialization should
- * work.
- */
- pixman_region32_init_rects (&r1, boxes, 3);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 1);
-
- while (i--)
- {
- assert (b[i].x1 < b[i].x2);
- assert (b[i].y1 < b[i].y2);
- }
-
- /* This would produce a rectangle containing the bounding box
- * of the two rectangles. The correct result is to eliminate
- * the broken rectangle.
- */
- pixman_region32_init_rects (&r1, boxes2, 2);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 1);
-
- assert (b[0].x1 == 4);
- assert (b[0].y1 == 1);
- assert (b[0].x2 == 6);
- assert (b[0].y2 == 7);
-
- /* This should produce an empty region */
- pixman_region32_init_rects (&r1, boxes3, 2);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 0);
-
- fill = pixman_image_create_solid_fill (&white);
- for (i = 0; i < 100; i++)
- {
- int image_size = 128;
-
- pixman_region32_init (&r1);
-
- /* Add some random rectangles */
- for (j = 0; j < 64; j++)
- pixman_region32_union_rect (&r1, &r1,
- lcg_rand_n (image_size),
- lcg_rand_n (image_size),
- lcg_rand_n (25),
- lcg_rand_n (25));
-
- /* Clip to image size */
- pixman_region32_init_rect (&r2, 0, 0, image_size, image_size);
- pixman_region32_intersect (&r1, &r1, &r2);
- pixman_region32_fini (&r2);
-
- /* render region to a1 mask */
- image = pixman_image_create_bits (PIXMAN_a1, image_size, image_size, NULL, 0);
- pixman_image_set_clip_region32 (image, &r1);
- pixman_image_composite32 (PIXMAN_OP_SRC,
- fill, NULL, image,
- 0, 0, 0, 0, 0, 0,
- image_size, image_size);
- pixman_region32_init_from_image (&r2, image);
-
- pixman_image_unref (image);
-
- assert (pixman_region32_equal (&r1, &r2));
- pixman_region32_fini (&r1);
- pixman_region32_fini (&r2);
-
- }
- pixman_image_unref (fill);
-
- return 0;
-}
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "utils.h"
+
+int
+main ()
+{
+ pixman_region32_t r1;
+ pixman_region32_t r2;
+ pixman_region32_t r3;
+ pixman_box32_t boxes[] = {
+ { 10, 10, 20, 20 },
+ { 30, 30, 30, 40 },
+ { 50, 45, 60, 44 },
+ };
+ pixman_box32_t boxes2[] = {
+ { 2, 6, 7, 6 },
+ { 4, 1, 6, 7 },
+ };
+ pixman_box32_t boxes3[] = {
+ { 2, 6, 7, 6 },
+ { 4, 1, 6, 1 },
+ };
+ int i, j;
+ pixman_box32_t *b;
+ pixman_image_t *image, *fill;
+ pixman_color_t white = {
+ 0xffff,
+ 0xffff,
+ 0xffff,
+ 0xffff
+ };
+
+ /* This used to go into an infinite loop before pixman-region.c
+ * was fixed to not use explict "short" variables
+ */
+ pixman_region32_init_rect (&r1, 0, 0, 20, 64000);
+ pixman_region32_init_rect (&r2, 0, 0, 20, 64000);
+ pixman_region32_init_rect (&r3, 0, 0, 20, 64000);
+
+ pixman_region32_subtract (&r1, &r2, &r3);
+
+
+ /* This would produce a region containing an empty
+ * rectangle in it. Such regions are considered malformed,
+ * but using an empty rectangle for initialization should
+ * work.
+ */
+ pixman_region32_init_rects (&r1, boxes, 3);
+
+ b = pixman_region32_rectangles (&r1, &i);
+
+ assert (i == 1);
+
+ while (i--)
+ {
+ assert (b[i].x1 < b[i].x2);
+ assert (b[i].y1 < b[i].y2);
+ }
+
+ /* This would produce a rectangle containing the bounding box
+ * of the two rectangles. The correct result is to eliminate
+ * the broken rectangle.
+ */
+ pixman_region32_init_rects (&r1, boxes2, 2);
+
+ b = pixman_region32_rectangles (&r1, &i);
+
+ assert (i == 1);
+
+ assert (b[0].x1 == 4);
+ assert (b[0].y1 == 1);
+ assert (b[0].x2 == 6);
+ assert (b[0].y2 == 7);
+
+ /* This should produce an empty region */
+ pixman_region32_init_rects (&r1, boxes3, 2);
+
+ b = pixman_region32_rectangles (&r1, &i);
+
+ assert (i == 0);
+
+ fill = pixman_image_create_solid_fill (&white);
+ for (i = 0; i < 100; i++)
+ {
+ int image_size = 128;
+
+ pixman_region32_init (&r1);
+
+ /* Add some random rectangles */
+ for (j = 0; j < 64; j++)
+ pixman_region32_union_rect (&r1, &r1,
+ lcg_rand_n (image_size),
+ lcg_rand_n (image_size),
+ lcg_rand_n (25),
+ lcg_rand_n (25));
+
+ /* Clip to image size */
+ pixman_region32_init_rect (&r2, 0, 0, image_size, image_size);
+ pixman_region32_intersect (&r1, &r1, &r2);
+ pixman_region32_fini (&r2);
+
+ /* render region to a1 mask */
+ image = pixman_image_create_bits (PIXMAN_a1, image_size, image_size, NULL, 0);
+ pixman_image_set_clip_region32 (image, &r1);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ fill, NULL, image,
+ 0, 0, 0, 0, 0, 0,
+ image_size, image_size);
+ pixman_region32_init_from_image (&r2, image);
+
+ pixman_image_unref (image);
+
+ assert (pixman_region32_equal (&r1, &r2));
+ pixman_region32_fini (&r1);
+ pixman_region32_fini (&r2);
+
+ }
+ pixman_image_unref (fill);
+
+ return 0;
+}