summaryrefslogtreecommitdiffstats
path: root/tools/valgrind
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-07 13:44:00 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-07 13:44:00 +0000
commitfa93de610f3df414dc74738b3a6f6619cb8bdc05 (patch)
tree72ded9657b6c6f9ea4af112721ca34c2bf007af2 /tools/valgrind
parent243cac7d0d9961ec15cea368168b98b7a4522f8d (diff)
downloadchromium_src-fa93de610f3df414dc74738b3a6f6619cb8bdc05.zip
chromium_src-fa93de610f3df414dc74738b3a6f6619cb8bdc05.tar.gz
chromium_src-fa93de610f3df414dc74738b3a6f6619cb8bdc05.tar.bz2
Fix WebKit layout Valgrind runner, part 2
Get the layout test URL from the DRT stdin TBR=thestig BUG=130832 Review URL: https://chromiumcodereview.appspot.com/10539047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind')
-rw-r--r--tools/valgrind/valgrind_test.py49
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 "====================================================="