From 2bc9c835b31b27d3c6f8d3b501591e100a6a91ac Mon Sep 17 00:00:00 2001 From: "Stephen M. Webb" Date: Wed, 30 Jan 2013 20:39:10 -0500 Subject: 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 Signed-off-by: Peter Hutterer --- 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::const_iterator it = valgrind_args.begin(); it++; /* first one is "valgrind" */ -- cgit v1.2.3