[PATCH 06/10] test/integration: decouple input_drivers test from standard mainloop

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 2 23:59:23 PDT 2012


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

diff --git a/test/integration/input_drivers.cpp b/test/integration/input_drivers.cpp
index 5b3060b..bd0777f 100644
--- a/test/integration/input_drivers.cpp
+++ b/test/integration/input_drivers.cpp
@@ -10,9 +10,15 @@
  *
  */
 class InputDriverTest : public xorg::testing::Test {
+private:
+    xorg::testing::XServer server;
 protected:
     virtual void SetUp()
     {
+        server.Start();
+        server.WaitForConnections();
+        xorg::testing::Test::SetDisplayString(server.GetDisplayString());
+
         ASSERT_NO_FATAL_FAILURE(xorg::testing::Test::SetUp());
 
         int event_start;
@@ -27,6 +33,13 @@ protected:
         ASSERT_EQ(Success, XIQueryVersion(Display(), &major, &minor));
     }
 
+    virtual void TearDown()
+    {
+        if (server.Pid() != -1)
+            if (!server.Terminate())
+                server.Kill();
+    }
+
     int xi2_opcode_;
 };
 
@@ -126,3 +139,9 @@ TEST_F(InputDriverTest, NewMaster)
     XIFreeDeviceInfo(info);
 }
 
+int main(int argc, char **argv) {
+
+    testing::InitGoogleTest(&argc, argv);
+
+    return RUN_ALL_TESTS();
+}
-- 
1.7.10.4



More information about the xorg-devel mailing list