[PATCH xorg-gtest 2/3] accommodate valgrind being a wrapper script

Stephen M. Webb stephen.webb at canonical.com
Wed Jan 30 17:39:10 PST 2013


From: "Stephen M. Webb" <stephen.webb at canonical.com>

Some systems provide valgrind as a shell script wrapper that calls
through to the real valgrind binary.  The xorg-gtest test suite
fails on those platforms because it causes the process args to
mismatch.

Signed-off-by: Stephen M. Webb <stephen.webb at canonical.com>
---
 test/process-test.cpp |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/process-test.cpp b/test/process-test.cpp
index 3446fe1..0c788fa 100644
--- a/test/process-test.cpp
+++ b/test/process-test.cpp
@@ -355,6 +355,15 @@ TEST_P(ProcessValgrindArgsWrapper, ValgrindWrapperWithArgs)
   } while(strstr(buff, program_invocation_short_name));
 
   const char * arg = buff + strlen(buff) + 1;
+
+  /* accommodate the case that valgrind has a shell script wrapper */
+  if (0 == strcmp(buff, "/bin/sh")) {
+    if (0 == strcmp(arg, "-e")) {
+      arg += strlen(arg) + 1;
+    }
+    arg += strlen(arg) + 1;
+  }
+
   std::vector<std::string>::const_iterator it = valgrind_args.begin();
 
   it++; /* first one is "valgrind" */
-- 
1.7.10.4



More information about the xorg-devel mailing list