[PATCH xorg-gtest 1/3] Add Environment::Kill() to forcefully terminate the dummy Xorg server

Chase Douglas chase.douglas at canonical.com
Wed Apr 18 10:39:03 PDT 2012


Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 include/xorg/gtest/environment.h |    5 +++++
 src/environment.cpp              |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/xorg/gtest/environment.h b/include/xorg/gtest/environment.h
index 55b590d..e113cd7 100644
--- a/include/xorg/gtest/environment.h
+++ b/include/xorg/gtest/environment.h
@@ -139,6 +139,11 @@ class Environment : public ::testing::Environment {
    */
   int display() const;
 
+  /**
+   * Kill the dummy Xorg server with SIGKILL.
+   */
+  void Kill();
+
  protected:
   /**
    * Starts the dummy X server.
diff --git a/src/environment.cpp b/src/environment.cpp
index f4bb9e1..c1c4d80 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -152,3 +152,9 @@ void xorg::testing::Environment::TearDown() {
                 << std::strerror(errno) << "\n";
   }
 }
+
+void xorg::testing::Environment::Kill() {
+  if (!d_->process.Kill())
+    std::cerr << "Warning: Failed to kill dummy Xorg server: "
+              << std::strerror(errno) << "\n";
+}
-- 
1.7.9.1



More information about the xorg-devel mailing list