As we already know that the XServer is ready for connections due to it's notification via SIGUSR1, we don't need to poll anymore. --- include/xorg/gtest/xorg-gtest-xserver.h | 5 ----- src/environment.cpp | 1 - src/xserver.cpp | 33 --------------------------------- 3 files changed, 39 deletions(-)
diff --git a/include/xorg/gtest/xorg-gtest-xserver.h b/include/xorg/gtest/xorg-gtest-xserver.h index 2e7ef13..851d8ce 100644 --- a/include/xorg/gtest/xorg-gtest-xserver.h +++ b/include/xorg/gtest/xorg-gtest-xserver.h @@ -107,11 +107,6 @@ class XServer : public xorg::testing::Process { void RemoveLogFile(bool force = false); /** - * Waits until this server is ready to take connections. - */ - void WaitForConnections(void); - - /** * Set the display number for this server. This number must be set * before the server is started to have any effect. * If unset, the default display number is used. diff --git a/src/environment.cpp b/src/environment.cpp index 54eb6b6..44d6b2e 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -106,7 +106,6 @@ void xorg::testing::Environment::SetUp() { if (d_->path_to_conf.length()) d_->server.SetOption("-config", d_->path_to_log_file); d_->server.Start(d_->path_to_server); - d_->server.WaitForConnections(); Process::SetEnv("DISPLAY", d_->server.GetDisplayString(), true); } diff --git a/src/xserver.cpp b/src/xserver.cpp index 2ff718d..42b3b3b 100644 --- a/src/xserver.cpp +++ b/src/xserver.cpp @@ -221,39 +221,6 @@ bool xorg::testing::XServer::WaitForDevice(::Display *display, const std::string return false; } -void xorg::testing::XServer::WaitForConnections(void) { - for (int i = 0; i < 100; ++i) { - Display *test_display = XOpenDisplay(GetDisplayString().c_str()); - - if (test_display) { - XCloseDisplay(test_display); - return; - } - - int status; - int pid = waitpid(Pid(), &status, WNOHANG); - if (pid == Pid()) { - std::string message; - message += "X server failed to start on display "; - message += GetDisplayString(); - message += ". Ensure that the correct 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_->options["-logfile"]; - message += " for any errors"; - throw std::runtime_error(message); - } else if (pid == 0) { - usleep(100); - } else if (pid == -1) { - throw std::runtime_error("Could not get status of X server process"); - } else { - throw std::runtime_error("Invalid child PID returned by Process::Wait()"); - } - } - - throw std::runtime_error("Unable to open connection to X server"); -} - void xorg::testing::XServer::TestStartup(void) { Display* test_display = XOpenDisplay(GetDisplayString().c_str()); if (test_display) { -- 1.7.12.2 _______________________________________________ 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