Last active
November 14, 2017 21:18
-
-
Save Hexcles/e258a7275b9283d971c4bd1661780c57 to your computer and use it in GitHub Desktop.
Simple LayoutTests global baseline optimization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from collections import defaultdict | |
import hashlib | |
import re | |
def main(): | |
baselines = defaultdict(dict) | |
f = open('baselines', 'r') | |
regexp_head = re.compile(r'^\./(platform/[^/]+/)') | |
regexp_tail = re.compile(r'-expected\.(png|txt|wav)$') | |
for line in f.readlines(): | |
filename = line.strip() | |
testname = regexp_head.sub('', filename) | |
testname = regexp_tail.sub('.html', testname) | |
sha1sum = hashlib.sha1(open(filename, 'rb').read()).digest() | |
if sha1sum not in baselines[testname]: | |
baselines[testname][sha1sum] = [filename] | |
else: | |
baselines[testname][sha1sum].append(filename) | |
for testname in baselines: | |
found_dupe = False | |
for sha1sum in baselines[testname]: | |
if len(baselines[testname][sha1sum]) == 1: | |
continue | |
found_dupe = True | |
break | |
if found_dupe: | |
print(testname) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Must run from third_party/WebKit/LayoutTests | |
find . -name "*-expected.txt" -or -name "*-expected.png" -or -name "*-expected.wav" > baselines | |
python2 find_dupes.py > dupes | |
cat dupes | xargs ../Tools/Scripts/webkit-patch optimize-baselines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment