File: Wait-to-initialize-X11-before-first-X11-test.patch

package info (click to toggle)
giza 1.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,352 kB
  • sloc: ansic: 13,252; sh: 4,205; f90: 3,003; lex: 437; perl: 330; makefile: 99
file content (40 lines) | stat: -rw-r--r-- 1,069 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Ole Streicher <olebole@debian.org>
Date: Sun, 2 Feb 2025 20:10:22 +0100
Subject: Wait to initialize X11 before first X11 test

See #1095028 for the problem

Closes: #1094102
---
 test/C/test-cairo-xw.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/C/test-cairo-xw.c b/test/C/test-cairo-xw.c
index fc07648..b54cc71 100644
--- a/test/C/test-cairo-xw.c
+++ b/test/C/test-cairo-xw.c
@@ -25,6 +25,8 @@
 #include <cairo/cairo-xlib.h>
 #include <X11/Xutil.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 struct XWstuff
 {
@@ -50,6 +52,15 @@ test_openclose_cairo_xw (void)
   XW.width = 500;
   XW.height = 200;
   XW.display = XOpenDisplay (NULL);
+  int i;
+  for (i == 1; (XW.display == NULL) && (i < 20) ; i++) {
+    sleep(1);
+    XW.display = XOpenDisplay (NULL);
+  }
+  if (XW.display == NULL) {
+    printf("Couldn't connect to X server\n");
+    exit(1);
+  }
   XW.screennum = DefaultScreen (XW.display);
   XW.depth = DefaultDepth(XW.display,XW.screennum);
   XW.visual = DefaultVisual (XW.display, XW.screennum);