On 07/02/2012 11:44 PM, Peter Hutterer wrote:
The API currently means we lose the ability to pass arbitrary options (aside
from display/logfile/conf path), but this should be of minor impact only.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
  include/xorg/gtest/xorg-gtest-xserver.h |    6 ++++++
  src/environment.cpp                     |    7 +------
  src/xserver.cpp                         |    9 +++++++++
  3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/xorg/gtest/xorg-gtest-xserver.h 
b/include/xorg/gtest/xorg-gtest-xserver.h
index c5cb32d..5c5ce99 100644
--- a/include/xorg/gtest/xorg-gtest-xserver.h
+++ b/include/xorg/gtest/xorg-gtest-xserver.h
@@ -47,6 +47,12 @@ class XServer : public xorg::testing::Process {
      XServer();

      /**
+     * Start a new server
+     * @param [in] program Path to the XServer binary
+     */
+    void Start(std::string &program);

Instead of defining a new method altogether, I think we should be make xorg::testing::Process::Start virtual and override it here.

I also don't want to lose the ability to pass arbitrary arguments in. Somewhere down the road someone will want to pass a specific option in. For example, there may be a test to see if a specific argument modifies the server behavior. Can we make XServer::Start() work with var args?

+
+    /**
       * Waits until this server is ready to take connections.
       */
      void WaitForConnections(void);
diff --git a/src/environment.cpp b/src/environment.cpp
index 2b3abca..7ed23b3 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -144,12 +144,7 @@ void xorg::testing::Environment::SetUp() {
    d_->server.SetDisplayNumber(d_->display);
    d_->server.SetLogfilePath(d_->path_to_log_file);
    d_->server.SetConfigPath(d_->path_to_conf);
-  d_->server.Start(d_->path_to_server, d_->path_to_server.c_str(),
-                    display_string,
-                    "-logverbose", "10",
-                    "-logfile", d_->path_to_log_file.c_str(),
-                    "-config", d_->path_to_conf.c_str(),
-                    NULL);
+  d_->server.Start(d_->path_to_server);
    d_->server.WaitForConnections();

    Process::SetEnv("DISPLAY", display_string, true);
diff --git a/src/xserver.cpp b/src/xserver.cpp
index 7f0483b..38394f3 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -249,3 +249,12 @@ void xorg::testing::XServer::WaitForConnections(void) {

    throw std::runtime_error("Unable to open connection to dummy X server");
  }
+
+void xorg::testing::XServer::Start(std::string &program) {
+  Process::Start(program, program.c_str(),
+                 GetDisplayString(),
+                 "-logverbose", "10",
+                 "-logfile", d_->path_to_logfile.c_str(),
+                 "-config", d_->path_to_conf.c_str(),
+                 NULL);
+}


_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to