[PATCH xorg-gtest 07/16] xserver: add Start() for default binary path

2012-07-03 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 include/xorg/gtest/xorg-gtest-xserver.h |4 
 src/xserver.cpp |4 
 2 files changed, 8 insertions(+)

diff --git a/include/xorg/gtest/xorg-gtest-xserver.h 
b/include/xorg/gtest/xorg-gtest-xserver.h
index 821b01f..1cd 100644
--- a/include/xorg/gtest/xorg-gtest-xserver.h
+++ b/include/xorg/gtest/xorg-gtest-xserver.h
@@ -47,6 +47,10 @@ class XServer : public xorg::testing::Process {
 XServer();
 
 /**
+ * Start a new server, using the default binary
+ */
+void Start(void);
+/**
  * Start a new server
  * @param [in] program Path to the XServer binary
  */
diff --git a/src/xserver.cpp b/src/xserver.cpp
index bd1e2f9..160eadc 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -289,6 +289,10 @@ void xorg::testing::XServer::TestStartup(void) {
 
 }
 
+void xorg::testing::XServer::Start(void) {
+  Start(d_-path_to_server);
+}
+
 void xorg::testing::XServer::Start(std::string program) {
   TestStartup();
   Process::Start(program, program.c_str(),
-- 
1.7.10.4

___
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


Re: [PATCH xorg-gtest 07/16] xserver: add Start() for default binary path

2012-07-03 Thread Chase Douglas

On 07/02/2012 11:44 PM, Peter Hutterer wrote:

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
  include/xorg/gtest/xorg-gtest-xserver.h |4 
  src/xserver.cpp |4 
  2 files changed, 8 insertions(+)

diff --git a/include/xorg/gtest/xorg-gtest-xserver.h 
b/include/xorg/gtest/xorg-gtest-xserver.h
index 821b01f..1cd 100644
--- a/include/xorg/gtest/xorg-gtest-xserver.h
+++ b/include/xorg/gtest/xorg-gtest-xserver.h
@@ -47,6 +47,10 @@ class XServer : public xorg::testing::Process {
  XServer();

  /**
+ * Start a new server, using the default binary
+ */
+void Start(void);


This can be accomplished by defining the previous definition of Start() 
like:


void Start(std::string program = std::string());

(or something like that, the idea is to provide a default value)

Then, in the implementationm check program.empty(). If it is, then use 
the default value. If it isn't, then used the passed in value.


However, this interface just feels wrong. Why have we defined an 
internal path to the server, and then defined a method that ignores it? 
Ideally, at the XServer object construction time we either set a default 
program or we pass in the initial program. We then only provide getters 
and setters, and a method to start the program.



+/**
   * Start a new server
   * @param [in] program Path to the XServer binary
   */
diff --git a/src/xserver.cpp b/src/xserver.cpp
index bd1e2f9..160eadc 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -289,6 +289,10 @@ void xorg::testing::XServer::TestStartup(void) {

  }

+void xorg::testing::XServer::Start(void) {
+  Start(d_-path_to_server);
+}
+
  void xorg::testing::XServer::Start(std::string program) {
TestStartup();
Process::Start(program, program.c_str(),



___
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