[PATCH xorg-gtest 08/16] xserver: return used display number from Start()

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


Doesn't do much yet, but once we support -displayfd we can hook it up here.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 include/xorg/gtest/xorg-gtest-xserver.h |    7 +++++--
 src/xserver.cpp                         |    9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/xorg/gtest/xorg-gtest-xserver.h b/include/xorg/gtest/xorg-gtest-xserver.h
index 33331cd..5cab01b 100644
--- a/include/xorg/gtest/xorg-gtest-xserver.h
+++ b/include/xorg/gtest/xorg-gtest-xserver.h
@@ -48,13 +48,16 @@ class XServer : public xorg::testing::Process {
 
     /**
      * Start a new server, using the default binary
+     *
+     * @return The display number this server is running on
      */
-    void Start(void);
+    unsigned int Start(void);
     /**
      * Start a new server
      * @param [in] program Path to the XServer binary
+     * @return The display number this server is running on
      */
-    void Start(std::string &program);
+    unsigned int Start(std::string &program);
 
     /**
      * Terminates this server process. Will signal the server to terminate
diff --git a/src/xserver.cpp b/src/xserver.cpp
index 160eadc..f5fd245 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -289,11 +289,11 @@ void xorg::testing::XServer::TestStartup(void) {
 
 }
 
-void xorg::testing::XServer::Start(void) {
-  Start(d_->path_to_server);
+unsigned int xorg::testing::XServer::Start(void) {
+  return Start(d_->path_to_server);
 }
 
-void xorg::testing::XServer::Start(std::string &program) {
+unsigned int xorg::testing::XServer::Start(std::string &program) {
   TestStartup();
   Process::Start(program, program.c_str(),
                  GetDisplayString(),
@@ -301,6 +301,9 @@ void xorg::testing::XServer::Start(std::string &program) {
                  "-logfile", d_->path_to_logfile.c_str(),
                  "-config", d_->path_to_conf.c_str(),
                  NULL);
+
+  /* FIXME: use -displayfd here once the released servers support it */
+  return d_->display_number;
 }
 
 bool xorg::testing::XServer::Terminate(void) {
-- 
1.7.10.4



More information about the xorg-devel mailing list