[PATCH xorg-gtest] Expand on the default 'failed to open connection to display' error
Peter Hutterer
peter.hutterer at who-t.net
Mon Nov 5 17:28:38 PST 2012
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 at who-t.net>
---
src/test.cpp | 11 +++++++++--
1 file 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() {
--
1.7.11.7
More information about the xorg-devel
mailing list