summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-03-13 23:30:39 -0700
committerChase Douglas <chase.douglas@canonical.com>2012-03-16 15:24:00 -0700
commit3f019e8272e33869312a7b5a94af94e14c81cd15 (patch)
tree37a7ef560995f250a9c662d487d0c8f6d3fc167e
parent6d0cd228d5ea5ff734f3bc1754d0dfbb93e6d1b4 (diff)
Print more helpful error message when X server fails to start
Usually, xorg-gtest requires the dummy video driver. It also requires an X server at least version 1.12, or to be run as root when testing with a previous X server. Print this information when the server fails to start, and point the user to the log file for further details. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-By: Christopher Halse Rogers <christopher.halse.rogers@canonical.com>
-rw-r--r--src/environment.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 3da27cb..f4bb9e1 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -122,16 +122,22 @@ void xorg::testing::Environment::SetUp() {
int status;
int pid = waitpid(d_->process.Pid(), &status, WNOHANG);
- if (pid == d_->process.Pid())
- throw std::runtime_error("Dummy X server failed to start, did you run as "
- "root?");
- else if (pid == 0)
+ if (pid == d_->process.Pid()) {
+ std::string message;
+ message += "X server failed to start. Ensure that the \"dummy\" video "
+ "driver is installed. If the X.org server is older than 1.12, "
+ "tests will need to be run as root. Check ";
+ message += d_->path_to_log_file;
+ message += " for any errors";
+ throw std::runtime_error(message);
+ } else if (pid == 0) {
sleep(1); /* Give the dummy X server some time to start */
- else if (pid == -1)
+ } else if (pid == -1) {
throw std::runtime_error("Could not get status of dummy X server "
"process");
- else
+ } else {
throw std::runtime_error("Invalid child PID returned by Process::Wait()");
+ }
}
throw std::runtime_error("Unable to open connection to dummy X server");