On 07/25/2012 10:53 AM, Chase Douglas wrote:
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 <[email protected]>
---
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 <[email protected]>
And pushed as commit 3fafcb6956779cbbbb0d1d4cadf4d7ea79671ef4.
-- Chase
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel