Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: webkit/tools/layout_tests/dedup-tests.py

Issue 545145: Move the layout test scripts into a 'webkitpy' subdirectory in preparation... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: try to de-confuse svn and the try bots Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/tools/layout_tests/layout_package/apache_http_server.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """dedup-tests -- print test results duplicated between win and linux.
7
8 Because the outputs are very similar, we fall back on Windows outputs
9 if there isn't an expected output for Linux layout tests. This means
10 that any file that is duplicated between the Linux and Windows directories
11 is redundant.
12
13 This command dumps out all such files. You can use it like:
14 dedup-tests.py # print out the bad files
15 dedup-tests.py | xargs git rm # delete the bad files
16 """
17
18 import collections
19 import os.path
20 import subprocess
21 import sys
22
23 # A map of file hash => set of all files with that hash.
24 hashes = collections.defaultdict(set)
25
26 # Fill in the map.
27 cmd = ['git', 'ls-tree', '-r', 'HEAD', 'webkit/data/layout_tests/']
28 try:
29 git = subprocess.Popen(cmd, stdout=subprocess.PIPE)
30 except OSError, e:
31 if e.errno == 2: # No such file or directory.
32 print >> sys.stderr, "Error: 'No such file' when running git."
33 print >> sys.stderr, "This script requires git."
34 sys.exit(1)
35 raise e
36
37 for line in git.stdout:
38 attrs, file = line.strip().split('\t')
39 _, _, hash = attrs.split(' ')
40 hashes[hash].add(file)
41
42 # Dump out duplicated files.
43 for cluster in hashes.values():
44 if len(cluster) < 2:
45 continue
46 for file in cluster:
47 if '/chromium-linux/' in file:
48 if file.replace('/chromium-linux/', '/chromium-win/') in cluster:
49 print file
OLDNEW
« no previous file with comments | « no previous file | webkit/tools/layout_tests/layout_package/apache_http_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698