summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-12 19:42:21 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-12 19:42:21 +0000
commitd97759da59ccdf1e7f728e6446cb853e20a4c8f0 (patch)
treef27dc42a5ee84d18de83846ba4c8a156e84a4fe6 /tools
parent6e0cb2f3ad6d92ebc29b9727be0583a0fb9d621f (diff)
downloadchromium_src-d97759da59ccdf1e7f728e6446cb853e20a4c8f0.zip
chromium_src-d97759da59ccdf1e7f728e6446cb853e20a4c8f0.tar.gz
chromium_src-d97759da59ccdf1e7f728e6446cb853e20a4c8f0.tar.bz2
Find out the Webkit layout_tests names by reading their stdout
TEST=`./tools/valgrind/chrome_tests.sh --test webkit` with suppressions removed Review URL: http://codereview.chromium.org/8537013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109805 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/valgrind/valgrind_test.py42
1 files changed, 31 insertions, 11 deletions
diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py
index 72d6a59..fd727c7 100755
--- a/tools/valgrind/valgrind_test.py
+++ b/tools/valgrind/valgrind_test.py
@@ -390,23 +390,43 @@ class ValgrindTool(BaseTool):
appropriately.
"""
command = " ".join(proc)
+ # Add the PID of the browser wrapper to the logfile names so we can
+ # separate log files for different UI tests at the analyze stage.
command = command.replace("%p", "$$.%p")
(fd, indirect_fname) = tempfile.mkstemp(dir=self.log_dir,
prefix="browser_wrapper.",
text=True)
f = os.fdopen(fd, "w")
- f.write("#!/bin/bash\n")
- f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n\n')
- f.write('for arg in $@\ndo\n')
- f.write(' if [[ "$arg" =~ --test-name=(.*) ]]\n then\n')
- f.write(' TESTCASE=${BASH_REMATCH[1]}\n')
- f.write(' echo $TESTCASE >`dirname $0`/testcase.$$.name\n')
- f.write(' fi\ndone\n')
- # Add the PID of the browser wrapper to the logfile names so we can
- # separate log files for different UI tests at the analyze stage.
- f.write(command)
- f.write(' "$@"\n')
+ f.write('#!/bin/bash\n'
+ 'echo "Started Valgrind wrapper for this test, PID=$$"\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)
+
f.close()
os.chmod(indirect_fname, stat.S_IRUSR|stat.S_IXUSR)
return indirect_fname