Commit 9fc0a77c authored by Daniel Martin's avatar Daniel Martin Committed by Peter Hutterer
Browse files

Deprecate WaitForConnections()



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.

This only deprecates the call and warns potential users, it will be removed
in a future release.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 4dd53534
......@@ -109,7 +109,7 @@ class XServer : public xorg::testing::Process {
/**
* Waits until this server is ready to take connections.
*/
void WaitForConnections(void);
_X_DEPRECATED void WaitForConnections(void);
/**
* Set the display number for this server. This number must be set
......
......@@ -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);
}
......
......@@ -222,36 +222,6 @@ bool xorg::testing::XServer::WaitForDevice(::Display *display, const std::string
}
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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment