Support for being executed from runtests.py
This is also needed to make it possible to run unit tests easily using Chromium's buildbot source code.
BUG=None
TEST=tools/valgrind-webrtc/webrtc_tests.sh --test test_support_unittests --build_dir=out/Debug
Review URL: https://webrtc-codereview.appspot.com/784007
git-svn-id: http://webrtc.googlecode.com/svn/trunk@2738 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/tools/valgrind-webrtc/webrtc_tests.py b/tools/valgrind-webrtc/webrtc_tests.py
index 0b6fb3c..3ad73cb 100755
--- a/tools/valgrind-webrtc/webrtc_tests.py
+++ b/tools/valgrind-webrtc/webrtc_tests.py
@@ -121,6 +121,11 @@
if len(options.test) != 1 and options.gtest_filter:
parser.error("--gtest_filter and multiple tests don't make sense together")
+ # If --build_dir is provided, prepend that path to the test name to make it a
+ # valid path when running on the build slaves using Chromium's runtest.py
+ if options.build_dir and 'cmdline' in options.test and len(args) == 1:
+ args[0] = os.path.join(options.build_dir, args[0])
+
# Performs the deferred-argument black magic described in the usage.
translated_args = map(lambda arg: arg.replace('+', '-'), args)