summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-09-13 19:31:29 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-09-24 18:29:30 -0400
commitaa311a4641b79eac39fe602b75d7bee3de9b1dce (patch)
treeb9560ebddfd02018b88ce8fccb93135b669f8f53
parentd5c721768c9811ce22bc0cd50bdf1c7bccc264e0 (diff)
test: Add inifinite-loop test
This test demonstrates a bug where a certain transformation matrix can result in an infinite loop. It was extracted as a standalone version of "affine-test 212944861". If given the option -nf, the test program will not call fail_after() and therefore potentially run forever.
-rw-r--r--test/Makefile.sources1
-rw-r--r--test/infinite-loop.c39
2 files changed, 40 insertions, 0 deletions
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 3e37e32..0f34411 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -7,6 +7,7 @@ TESTPROGRAMS = \
fetch-test \
rotate-test \
oob-test \
+ infinite-loop \
trap-crasher \
alpha-loop \
scaling-crash-test \
diff --git a/test/infinite-loop.c b/test/infinite-loop.c
new file mode 100644
index 0000000..02addaa
--- /dev/null
+++ b/test/infinite-loop.c
@@ -0,0 +1,39 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define SRC_WIDTH 16
+#define SRC_HEIGHT 12
+#define DST_WIDTH 7
+#define DST_HEIGHT 2
+
+ static const pixman_transform_t transform = {
+ { { 0x200017bd, 0x00000000, 0x000e6465 },
+ { 0x00000000, 0x000a42fd, 0x000e6465 },
+ { 0x00000000, 0x00000000, 0x00010000 },
+ }
+ };
+ pixman_image_t *src, *dest;
+
+ src = pixman_image_create_bits (
+ PIXMAN_a8r8g8b8, SRC_WIDTH, SRC_HEIGHT, NULL, -1);
+ dest = pixman_image_create_bits (
+ PIXMAN_a8r8g8b8, DST_WIDTH, DST_HEIGHT, NULL, -1);
+
+ pixman_image_set_transform (src, &transform);
+ pixman_image_set_repeat (src, PIXMAN_REPEAT_NORMAL);
+ pixman_image_set_filter (src, PIXMAN_FILTER_BILINEAR, NULL, 0);
+
+ if (argc == 1 || strcmp (argv[1], "-nf") != 0)
+ fail_after (1, "infinite loop detected");
+
+ pixman_image_composite (
+ PIXMAN_OP_OVER, src, NULL, dest, -3, -3, 0, 0, 0, 0, 6, 2);
+
+ return 0;
+}