summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen M. Webb <stephen.webb@canonical.com>2013-01-30 20:39:10 -0500
committerPeter Hutterer <peter.hutterer@who-t.net>2013-02-01 10:57:25 +1000
commit2bc9c835b31b27d3c6f8d3b501591e100a6a91ac (patch)
tree95eb58f050ace7ddb514e00bcab0b9978669f77d
parent649f4f66efd5d8454478c4d45473cff0f75667e2 (diff)
accommodate valgrind being a wrapper script
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@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--test/process-test.cpp9
1 files changed, 9 insertions, 0 deletions
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" */