[PATCH xorg-gtest 2/7] test: wait a bit for the server to finish

Peter Hutterer peter.hutterer at who-t.net
Thu Dec 13 17:17:35 PST 2012


Every so-often, the server doesn't terminate fast enough and we fail the
test. Put a wait loop in.

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

diff --git a/test/xserver-test.cpp b/test/xserver-test.cpp
index 7f949ef..822bb23 100644
--- a/test/xserver-test.cpp
+++ b/test/xserver-test.cpp
@@ -358,10 +358,15 @@ TEST(XServer, KeepAlive)
 
 TEST(XServer, RemoveOption)
 {
+  int i = 0;
   XServer server;
   server.SetOption("-fail", "yes");
   server.SetOption("-logfile", LOGFILE_DIR "/Xorg-remove-option.log");
   server.Start(TEST_ROOT_DIR "/xserver-test-helper");
+
+  while(i++ < 10 && server.GetState() == Process::RUNNING)
+    usleep(50000);
+
   ASSERT_EQ(server.GetState(), Process::FINISHED_FAILURE);
 
   server.RemoveOption("-fail");
-- 
1.8.0.2



More information about the xorg-devel mailing list