[PATCH xorg-gtest] xserver: add environment variable to suspend after startup

Chase Douglas chase.douglas at canonical.com
Wed Jul 25 10:53:15 PDT 2012


On 07/24/2012 06:26 PM, Peter Hutterer wrote:
> Allows for attaching gdb to a server without messing around too much in the
> test code.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>   README          |    5 +++++
>   src/xserver.cpp |    6 ++++++
>   2 files changed, 11 insertions(+)
>
> diff --git a/README b/README
> index 7a44075..33e1fe3 100644
> --- a/README
> +++ b/README
> @@ -74,3 +74,8 @@ xorg-gtest main() library targets if you will not use them. Copy the gtest and
>   xorg-gtest library targets if multiple builds with different compilation flags
>   are needed. Finally, link the tests with the appropriate gtest and xorg-gtest
>   libraries and their dependencies: libpthread and libX11.
> +
> +Environment variables
> +---------------------
> +XORG_GTEST_XSERVER_SIGSTOP
> +  If set, an XServer object will raise a SIGSTOP signal after startup.
> diff --git a/src/xserver.cpp b/src/xserver.cpp
> index b420dd1..bb25373 100644
> --- a/src/xserver.cpp
> +++ b/src/xserver.cpp
> @@ -302,6 +302,12 @@ void xorg::testing::XServer::Start(const std::string &program) {
>     }
>
>     Process::Start(program.empty() ? d_->path_to_server : program, args);
> +
> +  if (Pid() > 0) {
> +    char *sleepwait = getenv("XORG_GTEST_XSERVER_SIGSTOP");
> +    if (sleepwait)
> +      raise(SIGSTOP);
> +  }
>   }
>
>   bool xorg::testing::XServer::Terminate(unsigned int timeout) {
>

Works for me.

Reviewed-by: Chase Douglas <chase.douglas at canonical.com>


More information about the xorg-devel mailing list