summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-11-05 16:20:36 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-11-06 16:27:18 +1000
commitef7e3c94868e2dfdae7634441d688b69ed8f6a71 (patch)
tree016eb31475f3d6f0a154f3ca368281ed66196a0a
parent6bf515f0845fe0903e7cf689953d4ada485afcd9 (diff)
Expand on the default 'failed to open connection to display' error
Virtually everyone trying the tests the first time will run into this issue since we cannot check if the ABI for dummy and whatever else is needed actually matches the server (well, we have a test for that, but unless you run that one first...) So be at least more verbose about the potential reasons and provide some basic debugging help. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--src/test.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test.cpp b/src/test.cpp
index c7b69bc..a484787 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -50,8 +50,15 @@ void xorg::testing::Test::SetUp() {
dpy = d_->display_string.c_str();
d_->display = XOpenDisplay(dpy);
- if (!d_->display)
- throw std::runtime_error("Failed to open connection to display");
+ if (!d_->display) {
+ std::stringstream ss;
+ ss << "Failed to open connection to display";
+ if (dpy != NULL) ss << " " << dpy;
+ ss << ".\nThis usually means that your X server did not start properly.\n";
+ ss << "Check the log file, or set XORG_GTEST_CHILD_STDOUT to see the server's\n"
+ "error messages when starting.";
+ throw std::runtime_error(ss.str());
+ }
}
void xorg::testing::Test::TearDown() {