diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 20:08:17 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 20:08:17 +0000 |
commit | 55c8b97de347a0ca743e4a5a6322e3ab4e9a23b0 (patch) | |
tree | 5e84deafc0f8e33d614b2bc5732add6241e85e57 | |
parent | cbb9f9b449677cc1bc60f9edd0ad36c6681ac0e5 (diff) | |
download | chromium_src-55c8b97de347a0ca743e4a5a6322e3ab4e9a23b0.zip chromium_src-55c8b97de347a0ca743e4a5a6322e3ab4e9a23b0.tar.gz chromium_src-55c8b97de347a0ca743e4a5a6322e3ab4e9a23b0.tar.bz2 |
Tool for finding duplicate test outputs.
Review URL: http://codereview.chromium.org/40177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11018 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | webkit/tools/layout_tests/dedup-tests.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/webkit/tools/layout_tests/dedup-tests.py b/webkit/tools/layout_tests/dedup-tests.py new file mode 100755 index 0000000..ea5de92 --- /dev/null +++ b/webkit/tools/layout_tests/dedup-tests.py @@ -0,0 +1,46 @@ +#!/usr/bin/python + +"""dedup-tests -- print test results duplicated between win and linux. + +Because the outputs are very similar, we fall back on Windows outputs +if there isn't an expected output for Linux layout tests. This means +that any file that is duplicated between the Linux and Windows directories +is redundant. + +This command dumps out all such files. You can use it like: + dedup-tests.py # print out the bad files + dedup-tests.py | xargs git rm # delete the bad files +""" + +import collections +import os.path +import subprocess +import sys + +# A map of file hash => set of all files with that hash. +hashes = collections.defaultdict(set) + +# Fill in the map. +cmd = ['git', 'ls-tree', '-r', 'HEAD', 'webkit/data/layout_tests/'] +try: + git = subprocess.Popen(cmd, stdout=subprocess.PIPE) +except OSError, e: + if e.errno == 2: # No such file or directory. + print >>sys.stderr, "Error: 'No such file' when running git." + print >>sys.stderr, "This script requires git." + sys.exit(1) + raise e + +for line in git.stdout: + attrs, file = line.strip().split('\t') + _, _, hash = attrs.split(' ') + hashes[hash].add(file) + +# Dump out duplicated files. +for cluster in hashes.values(): + if len(cluster) < 2: + continue + for file in cluster: + if '/chromium-linux/' in file: + if file.replace('/chromium-linux/', '/chromium-win/') in cluster: + print file |