diff options
Diffstat (limited to 'tools/valgrind')
-rw-r--r-- | tools/valgrind/valgrind_test.py | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py index 8632e5f..9eabfbe 100644 --- a/tools/valgrind/valgrind_test.py +++ b/tools/valgrind/valgrind_test.py @@ -387,7 +387,7 @@ class ValgrindTool(BaseTool): # Handle --indirect_webkit_layout separately. if self._options.indirect_webkit_layout: # Need to create the wrapper before modifying |proc|. - wrapper = self.CreateBrowserWrapper(proc) + wrapper = self.CreateBrowserWrapper(proc, webkit=True) proc = self._args proc.append("--wrapper") proc.append(wrapper) @@ -405,7 +405,7 @@ class ValgrindTool(BaseTool): raise NotImplementedError, "This method should be implemented " \ "in the tool-specific subclass" - def CreateBrowserWrapper(self, proc): + def CreateBrowserWrapper(self, proc, webkit=False): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. In this case, use a magic wrapper to only valgrind the Chrome browser. Build the wrapper here. @@ -424,31 +424,24 @@ class ValgrindTool(BaseTool): f.write('#!/bin/bash\n' 'echo "Started Valgrind wrapper for this test, PID=$$" >&2\n') - # Try to get the test case name by looking at the program arguments. - # i.e. Chromium ui_tests and friends pass --test-name arg. f.write('DIR=`dirname $0`\n' - 'FOUND_TESTNAME=0\n' - 'TESTNAME_FILE=$DIR/testcase.$$.name\n' - 'for arg in $@; do\n' - ' # TODO(timurrrr): this doesn\'t handle "--test-name Test.Name"\n' - ' if [[ "$arg" =~ --test-name=(.*) ]]; then\n' - ' echo ${BASH_REMATCH[1]} >$TESTNAME_FILE\n' - ' FOUND_TESTNAME=1\n' - ' fi\n' - 'done\n\n') - - f.write('if [ "$FOUND_TESTNAME" = "1" ]; then\n' - ' %s "$@"\n' - 'else\n' % command) - # Webkit layout_tests print out the test URL as the first line of stdout. - f.write(' %s "$@" | tee $DIR/test.$$.stdout\n' - ' EXITCODE=$PIPESTATUS\n' # $? holds the tee's exit code - ' head -n 1 $DIR/test.$$.stdout |\n' - ' grep URL |\n' - ' sed "s/^.*third_party\/WebKit\/LayoutTests\///" ' - '>$TESTNAME_FILE\n' - ' exit $EXITCODE\n' - 'fi\n' % command) + 'TESTNAME_FILE=$DIR/testcase.$$.name\n\n') + + if webkit: + # Webkit layout_tests pass the URL as the first line of stdin. + f.write('tee $TESTNAME_FILE | %s "$@"\n' % command) + else: + # Try to get the test case name by looking at the program arguments. + # i.e. Chromium ui_tests used --test-name arg. + # TODO(timurrrr): This doesn't handle "--test-name Test.Name" + # TODO(timurrrr): ui_tests are dead. Where do we use the non-webkit + # wrapper now? browser_tests? What do they do? + f.write('for arg in $@\ndo\n' + ' if [[ "$arg" =~ --test-name=(.*) ]]\n then\n' + ' echo ${BASH_REMATCH[1]} >$TESTNAME_FILE\n' + ' fi\n' + 'done\n\n' + '%s "$@"\n' % command) f.close() os.chmod(indirect_fname, stat.S_IRUSR|stat.S_IXUSR) @@ -480,6 +473,10 @@ class ValgrindTool(BaseTool): f = open(self.log_dir + ("/testcase.%d.name" % ppid)) testcase_name = f.read().strip() f.close() + wk_layout_prefix="third_party/WebKit/LayoutTests/" + wk_prefix_at = testcase_name.rfind(wk_layout_prefix) + if wk_prefix_at != -1: + testcase_name = testcase_name[wk_prefix_at + len(wk_layout_prefix):] except IOError: pass print "=====================================================" |