summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-04-18 10:23:38 -0700
committerChase Douglas <chase.douglas@canonical.com>2012-04-18 10:23:38 -0700
commit5b1b93962317140c480bbf34a6f988568bfd51d1 (patch)
tree6731648ed82bc09a79379ee2bb835d6c5e9969c9
parent1e7618f41e48e29c8dfa30cb74dbdeb8ebd83896 (diff)
Add Environment::Kill() to forcefully terminate the dummy Xorg server
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--include/xorg/gtest/environment.h5
-rw-r--r--src/environment.cpp6
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";
+}