[PATCH xorg-gtest 3/5] xserver: add destructor to tear down the server

Chase Douglas chase.douglas at canonical.com
Mon Aug 13 09:40:21 PDT 2012


On 08/09/2012 10:38 PM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>   include/xorg/gtest/xorg-gtest-xserver.h | 1 +
>   src/xserver.cpp                         | 6 ++++++
>   2 files changed, 7 insertions(+)
>
> diff --git a/include/xorg/gtest/xorg-gtest-xserver.h b/include/xorg/gtest/xorg-gtest-xserver.h
> index ee2b0e3..f3bda9b 100644
> --- a/include/xorg/gtest/xorg-gtest-xserver.h
> +++ b/include/xorg/gtest/xorg-gtest-xserver.h
> @@ -59,6 +59,7 @@ namespace testing {
>   class XServer : public xorg::testing::Process {
>     public:
>       XServer();
> +    ~XServer();
>
>       /**
>        * Start a new server. If no binary is given, the server started is the
> diff --git a/src/xserver.cpp b/src/xserver.cpp
> index 244a96e..86c8484 100644
> --- a/src/xserver.cpp
> +++ b/src/xserver.cpp
> @@ -68,6 +68,12 @@ xorg::testing::XServer::XServer() : d_(new Private) {
>     SetDisplayNumber(d_->display_number);
>   }
>
> +xorg::testing::XServer::~XServer() {
> +  if (Pid() > 0)
> +    if (!Terminate(3000))
> +      Kill(300);
> +}
> +
>   void xorg::testing::XServer::SetDisplayNumber(unsigned int display_number) {
>       d_->display_number = display_number;
>
>

Makes sense.

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

And pushed as 340c07db1cbaa5fab10985d270fb30a2751abf61.

Thanks!


More information about the xorg-devel mailing list