[PATCH xorg-gtest 04/16] xserver: move starting the process into the XServer object
Peter Hutterer
peter.hutterer at who-t.net
Mon Jul 2 23:44:45 PDT 2012
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.hutterer at 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);
+
+ /**
* 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);
+}
--
1.7.10.4
More information about the xorg-devel
mailing list