And initialise with the default settings Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- include/xorg/gtest/xorg-gtest-xserver.h | 12 ++++++++++++ src/environment.cpp | 4 +++- src/xserver.cpp | 26 +++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/include/xorg/gtest/xorg-gtest-xserver.h b/include/xorg/gtest/xorg-gtest-xserver.h index c62970d..c5cb32d 100644 --- a/include/xorg/gtest/xorg-gtest-xserver.h +++ b/include/xorg/gtest/xorg-gtest-xserver.h @@ -55,6 +55,18 @@ class XServer : public xorg::testing::Process { * @param [in] display_number The display number the server runs on */ void SetDisplayNumber(unsigned int display_number); + /** + * @param [in] path_to_logfile The path to the log file + */ + void SetLogfilePath(std::string &path_to_logfile); + /** + * @param [in] path_to_conf The path to the xorg.conf file + */ + void SetConfigPath(std::string &path_to_conf); + /** + * @param [in] path_to_server The path to the binary + */ + void SetServerPath(std::string &path_to_server); /** * Get the display string that may be used for XOpenDisplay to this diff --git a/src/environment.cpp b/src/environment.cpp index 5e7a156..2b3abca 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -141,13 +141,15 @@ void xorg::testing::Environment::SetUp() { throw std::runtime_error(message); } + 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.SetDisplayNumber(d_->display); d_->server.WaitForConnections(); Process::SetEnv("DISPLAY", display_string, true); diff --git a/src/xserver.cpp b/src/xserver.cpp index ba847f1..7f0483b 100644 --- a/src/xserver.cpp +++ b/src/xserver.cpp @@ -27,6 +27,7 @@ ******************************************************************************/ #include "xorg/gtest/xorg-gtest_xserver.h" +#include "defines.h" #include <sys/types.h> #include <sys/wait.h> @@ -45,8 +46,19 @@ #include <X11/extensions/XInput2.h> struct xorg::testing::XServer::Private { + Private() + : display_number(DEFAULT_DISPLAY), + display_string(), + path_to_logfile(DEFAULT_XORG_LOGFILE), + path_to_conf(DUMMY_CONF_PATH), + path_to_server(DEFAULT_XORG_SERVER) { + } + unsigned int display_number; std::string display_string; + std::string path_to_logfile; + std::string path_to_conf; + std::string path_to_server; }; xorg::testing::XServer::XServer() : d_(new Private) { @@ -65,6 +77,18 @@ const char* xorg::testing::XServer::GetDisplayString(void) { return d_->display_string.c_str(); } +void xorg::testing::XServer::SetLogfilePath(std::string &path_to_logfile) { + d_->path_to_logfile = path_to_logfile; +} + +void xorg::testing::XServer::SetConfigPath(std::string &path_to_conf) { + d_->path_to_conf = path_to_conf; +} + +void xorg::testing::XServer::SetServerPath(std::string &path_to_server) { + d_->path_to_server = path_to_server; +} + bool xorg::testing::XServer::WaitForEvent(::Display *display, time_t timeout) { fd_set fds; @@ -210,7 +234,7 @@ void xorg::testing::XServer::WaitForConnections(void) { message += ". Ensure that the \"dummy\" video driver is installed.\n" "If the X.org server is older than 1.12, " "tests will need to be run as root.\nCheck "; - //message += d_->path_to_log_file; + message += d_->path_to_logfile; message += " for any errors"; throw std::runtime_error(message); } else if (pid == 0) { -- 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