Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useful scripts for interacting with WPT logs #24841

Merged
merged 10 commits into from Nov 23, 2019
Next

Add script to summarize WPT test directories with failing tests.

  • Loading branch information
jdm committed Nov 22, 2019
commit 4c8216129ee655026e4c0e8c3781645017969614
@@ -0,0 +1,60 @@
#!/usr/bin/env python

# Copyright 2019 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

import configparser
import os

test_root = os.path.join('tests', 'wpt', 'web-platform-tests')
meta_root = os.path.join('tests', 'wpt', 'metadata')

test_counts = {}
meta_counts = {}

for base_dir, dir_names, files in os.walk(test_root):
if base_dir == test_root:
continue

rel_base = os.path.relpath(base_dir, test_root)
if not os.path.exists(os.path.join(meta_root, rel_base)):
continue

test_files = []
exts = ['.html', '.htm', '.xht', '.xhtml', '.window.js', '.worker.js', '.any.js']
for f in files:
for ext in exts:
if f.endswith(ext):
test_files += [f]
test_counts[rel_base] = len(test_files)

for base_dir, dir_names, files in os.walk(meta_root):
if base_dir == meta_root:
continue

rel_base = os.path.relpath(base_dir, meta_root)
num_files = len(files)
if '__dir__.ini' in files:
num_files -= 1
meta_counts[rel_base] = num_files

final_counts = []
for (test_dir, test_count) in test_counts.items():
if not test_count:
continue
meta_count = meta_counts.get(test_dir, 0)
final_counts += [(test_dir, test_count, meta_count)]

print('Test counts')
print('dir: %% failed (num tests / num failures)')
s = sorted(final_counts, key=lambda x: x[2] / x[1])
for (test_dir, test_count, meta_count) in reversed(sorted(s, key=lambda x: x[2])):
if not meta_count:
continue
print('%s: %.2f%% (%d / %d)' % (test_dir, meta_count / test_count * 100, test_count, meta_count))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.