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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

Issue 2644783003: Regenerate MANIFEST.json when WPT tests are run (Closed)
Patch Set: Regenerate MANIFEST.json from template in run-webkit-tests Created 3 years, 9 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
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 The Manager object has a constructor and one main method called run. 37 The Manager object has a constructor and one main method called run.
38 """ 38 """
39 39
40 import json 40 import json
41 import logging 41 import logging
42 import random 42 import random
43 import sys 43 import sys
44 import time 44 import time
45 45
46 from webkitpy.common.net.file_uploader import FileUploader 46 from webkitpy.common.net.file_uploader import FileUploader
47 from webkitpy.common.webkit_finder import WebKitFinder
47 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinde r 48 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinde r
48 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne r 49 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne r
49 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite r 50 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite r
50 from webkitpy.layout_tests.layout_package import json_results_generator 51 from webkitpy.layout_tests.layout_package import json_results_generator
51 from webkitpy.layout_tests.models import test_expectations 52 from webkitpy.layout_tests.models import test_expectations
52 from webkitpy.layout_tests.models import test_failures 53 from webkitpy.layout_tests.models import test_failures
53 from webkitpy.layout_tests.models import test_run_results 54 from webkitpy.layout_tests.models import test_run_results
54 from webkitpy.layout_tests.models.test_input import TestInput 55 from webkitpy.layout_tests.models.test_input import TestInput
55 from webkitpy.tool import grammar 56 from webkitpy.tool import grammar
56 57
57 _log = logging.getLogger(__name__) 58 _log = logging.getLogger(__name__)
58 59
59 TestExpectations = test_expectations.TestExpectations 60 TestExpectations = test_expectations.TestExpectations
60 61
61 62
62 class Manager(object): 63 class Manager(object):
63 """A class for managing running a series of layout tests.""" 64 """A class for managing running a series of layout tests."""
64 65
65 def __init__(self, port, options, printer): 66 def __init__(self, port, options, printer):
66 """Initialize test runner data structures. 67 """Initialize test runner data structures.
67 68
68 Args: 69 Args:
69 port: An object implementing platform-specific functionality. 70 port: An object implementing platform-specific functionality.
70 options: An options argument which contains command line options. 71 options: An options argument which contains command line options.
71 printer: A Printer object to record updates to. 72 printer: A Printer object to record updates to.
72 """ 73 """
73 self._port = port 74 self._port = port
75 self._executive = port.host.executive
74 self._filesystem = port.host.filesystem 76 self._filesystem = port.host.filesystem
75 self._options = options 77 self._options = options
76 self._printer = printer 78 self._printer = printer
77 self._expectations = None 79 self._expectations = None
78 80
79 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR 81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR
80 self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR 82 self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR
81 self.PERF_SUBDIR = 'perf' 83 self.PERF_SUBDIR = 'perf'
82 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR 84 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR
83 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' 85 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
84 self.ARCHIVED_RESULTS_LIMIT = 25 86 self.ARCHIVED_RESULTS_LIMIT = 25
85 self._http_server_started = False 87 self._http_server_started = False
86 self._wptserve_started = False 88 self._wptserve_started = False
87 self._websockets_server_started = False 89 self._websockets_server_started = False
88 90
89 self._results_directory = self._port.results_directory() 91 self._results_directory = self._port.results_directory()
90 self._finder = LayoutTestFinder(self._port, self._options) 92 self._finder = LayoutTestFinder(self._port, self._options)
93 self._webkit_finder = WebKitFinder(port.host.filesystem)
91 self._runner = LayoutTestRunner(self._options, self._port, self._printer , self._results_directory, self._test_is_slow) 94 self._runner = LayoutTestRunner(self._options, self._port, self._printer , self._results_directory, self._test_is_slow)
92 95
93 def run(self, args): 96 def run(self, args):
94 """Run the tests and return a RunDetails object with the results.""" 97 """Run the tests and return a RunDetails object with the results."""
95 start_time = time.time() 98 start_time = time.time()
96 self._printer.write_update("Collecting tests ...") 99 self._printer.write_update("Collecting tests ...")
97 running_all_tests = False 100 running_all_tests = False
101
102 # Regenerate MANIFEST.json from template, necessary for WPT metadata
qyearsley 2017/02/28 18:54:45 Nit: period at end of comment. Could also spell ou
jeffcarp 2017/02/28 21:57:39 Done
103 self._ensure_manifest()
104
98 try: 105 try:
99 paths, all_test_names, running_all_tests = self._collect_tests(args) 106 paths, all_test_names, running_all_tests = self._collect_tests(args)
100 except IOError: 107 except IOError:
101 # This is raised if --test-list doesn't exist 108 # This is raised if --test-list doesn't exist
102 return test_run_results.RunDetails(exit_code=test_run_results.NO_TES TS_EXIT_STATUS) 109 return test_run_results.RunDetails(exit_code=test_run_results.NO_TES TS_EXIT_STATUS)
103 110
104 # Create a sorted list of test files so the subset chunk, 111 # Create a sorted list of test files so the subset chunk,
105 # if used, contains alphabetically consecutive tests. 112 # if used, contains alphabetically consecutive tests.
106 if self._options.order == 'natural': 113 if self._options.order == 'natural':
107 all_test_names.sort(key=self._port.test_key) 114 all_test_names.sort(key=self._port.test_key)
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 545
539 stats = {} 546 stats = {}
540 for result in initial_results.results_by_name.values(): 547 for result in initial_results.results_by_name.values():
541 if result.type != test_expectations.SKIP: 548 if result.type != test_expectations.SKIP:
542 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int( 549 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int(
543 result.test_run_time * 1000), int(result.total_run_time * 10 00))} 550 result.test_run_time * 1000), int(result.total_run_time * 10 00))}
544 stats_trie = {} 551 stats_trie = {}
545 for name, value in stats.iteritems(): 552 for name, value in stats.iteritems():
546 json_results_generator.add_path_to_trie(name, value, stats_trie) 553 json_results_generator.add_path_to_trie(name, value, stats_trie)
547 return stats_trie 554 return stats_trie
555
556 def _ensure_manifest(self):
qyearsley 2017/02/28 18:54:45 Do you think it makes sense to make this a public
jeffcarp 2017/02/28 21:57:39 My one reservation with that is that this method i
qyearsley 2017/02/28 22:04:31 Yep, follow-up CL would be fine, definitely.
557 manifest_path = self._webkit_finder.path_from_webkit_base(
558 'LayoutTests', 'external', 'wpt', 'MANIFEST.json')
qyearsley 2017/02/28 18:54:45 Optional idea: These paths relative to webkit base
559 manifest_base_path = self._webkit_finder.path_from_webkit_base(
560 'LayoutTests', 'external', 'WPT_BASE_MANIFEST.json')
qyearsley 2017/02/28 18:54:44 Here we're assuming that WPT_BASE_MANIFEST.json al
jeffcarp 2017/02/28 21:57:39 I think it's OK to assume it always exists because
qyearsley 2017/02/28 22:04:31 Alright; optionally you could still add an assert
561
562 if not self._filesystem.exists(manifest_path):
563 self._filesystem.copyfile(manifest_base_path, manifest_path)
564
565 manifest_tool_path = self._webkit_finder.path_from_webkit_base(
566 'Tools', 'Scripts', 'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifes t')
567 wpt_path = self._webkit_finder.path_from_webkit_base('LayoutTests', 'ext ernal', 'wpt')
568
569 self._printer.write_update('Generating MANIFEST.json for web-platform-te sts ...')
570 self._executive.run_command(['python', manifest_tool_path, '--work', '-- tests-root', wpt_path])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698