[PATCH xorg-gtest] Expand on the default 'failed to open connection to display' error
Chase Douglas
chase.douglas at ubuntu.com
Thu Nov 8 17:38:41 PST 2012
On Mon, Nov 5, 2012 at 5:28 PM, Peter Hutterer <peter.hutterer at who-t.net>wrote:
> 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() {
This should be very helpful for newbies :).
Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20121108/0caa989c/attachment-0001.html>
More information about the xorg-devel
mailing list