[PATCH xorg-gtest 2/8] test: add test-case for starting servers

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 9 22:14:27 PDT 2012


With the SIGUSR1 patch, an XOpenDisplay() after XServer::Start() should
always succeed.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/xserver-test.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/xserver-test.cpp b/test/xserver-test.cpp
index ba6c462..103657c 100644
--- a/test/xserver-test.cpp
+++ b/test/xserver-test.cpp
@@ -55,6 +55,22 @@ TEST(XServer, LogRemoval)
   file.close();
 }
 
+TEST(XServer, WaitForSIGUSR1)
+{
+  SCOPED_TRACE("TESTCASE: XOpenDisplay() following server.Start() must\n"
+               "succeed as we wait for the SIGUSR1 signal\n");
+  for (int i = 0; i < 20; i++) {
+    XServer server;
+    server.SetOption("-logfile", "/tmp/xorg-testing-xserver-sigusr1.log");
+    server.SetOption("-noreset", "");
+    server.Start();
+    ASSERT_EQ(server.GetState(), Process::RUNNING);
+    Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
+    ASSERT_TRUE(dpy != NULL);
+    XCloseDisplay(dpy);
+    server.Terminate(500);
+  }
+}
 
 int main(int argc, char *argv[]) {
   testing::InitGoogleTest(&argc, argv);
-- 
1.7.11.4



More information about the xorg-devel mailing list