def PerfTest(options): """Call run-perf-tests.py, using Python from the tree.""" build_dir = os.path.abspath(options.build_dir) webkit_scripts_dir = chromium_utils.FindUpward(build_dir, 'third_party', 'WebKit', 'Tools', 'Scripts') run_perf_tests = os.path.join(webkit_scripts_dir, 'run-perf-tests') command = [ run_perf_tests, '--time-out-ms=90000', '--no-results', '--force', 'inspector', ] command.append('--' + options.target.lower()) if options.platform: command.extend(['--platform', options.platform]) # Nuke anything that appears to be stale chrome items in the temporary # directory from previous test runs (i.e. from crashes or unittest leaks). slave_utils.RemoveChromeTemporaryFiles() # Run the the tests return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, command)
def layout_test(options, args): """Parse options and call run_webkit_tests.py, using Python from the tree.""" build_dir = os.path.abspath(options.build_dir) webkit_tests_dir = chromium_utils.FindUpward(build_dir, 'webkit', 'tools', 'layout_tests') run_webkit_tests = os.path.join(webkit_tests_dir, 'run_webkit_tests.py') command = [run_webkit_tests, '--lint-test-files', '--chromium'] return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, command)
def layout_test(options, args): """Parse options and call run-webkit-tests, using Python from the tree.""" build_dir = os.path.abspath(options.build_dir) blink_scripts_dir = chromium_utils.FindUpward(build_dir, 'third_party', 'WebKit', 'Tools', 'Scripts') lint_tests_script = os.path.join(blink_scripts_dir, 'lint-test-expectations') return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, [lint_tests_script])
def main(): option_parser = optparse.OptionParser() option_parser.add_option('', '--build-dir', default='webkit', help='path to main build directory (the parent of ' 'the Release or Debug directory)') # Note that --target isn't needed for --lint-test-files, but the # RunPythonCommandInBuildDir() will get upset if we don't say something. option_parser.add_option('', '--target', default='release', help='DumpRenderTree build configuration (Release or Debug)') options, _ = option_parser.parse_args() build_dir = os.path.abspath(options.build_dir) webkit_tests_dir = chromium_utils.FindUpward(build_dir, 'third_party', 'WebKit', 'Tools', 'Scripts') command = [os.path.join(webkit_tests_dir, 'test-webkitpy')] return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, command)
def layout_test(options, args): """Parse options and call run-webkit-tests, using Python from the tree.""" build_dir = os.path.abspath(options.build_dir) dumprendertree_exe = 'DumpRenderTree.exe' if options.driver_name: dumprendertree_exe = '%s.exe' % options.driver_name # Disable the page heap in case it got left enabled by some previous process. try: slave_utils.SetPageHeap(build_dir, dumprendertree_exe, False) except chromium_utils.PathNotFound: # If we don't have gflags.exe, report it but don't worry about it. print 'Warning: Couldn\'t disable page heap, if it was already enabled.' blink_scripts_dir = chromium_utils.FindUpward(build_dir, 'third_party', 'WebKit', 'Tools', 'Scripts') run_blink_tests = os.path.join(blink_scripts_dir, 'run-webkit-tests') slave_name = slave_utils.SlaveBuildName(build_dir) command = [ run_blink_tests, '--no-show-results', '--no-new-test-results', '--full-results-html', # For the dashboards. '--clobber-old-results', # Clobber test results before each run. '--exit-after-n-failures', '5000', '--exit-after-n-crashes-or-timeouts', '100', ] # TODO(dpranke): we can switch to always using --debug-rwt-logging # after all the bots have WebKit r124789 or later. capture_obj = slave_utils.RunCommandCaptureFilter() slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, [run_blink_tests, '--help'], filter_obj=capture_obj) if '--debug-rwt-logging' in ''.join(capture_obj.lines): command.append('--debug-rwt-logging') else: command.append('--verbose') if options.results_directory: # Prior to the fix in https://bugs.webkit.org/show_bug.cgi?id=58272, # run_blink_tests expects the results directory to be relative to # the configuration directory (e.g., src/webkit/Release). The # parameter is given to us relative to build_dir, which is where we # will run the command from. # # When 58272 is landed, run_blink_tests will support absolute file # paths as well as paths relative to CWD for non-Chromium ports and # paths relative to the configuration dir for Chromium ports. As # a transitional fix, we convert to an absolute dir, but once the # hack in 58272 is removed, we can use results_dir as-is. if not os.path.isabs(options.results_directory): if options.results_directory.startswith('../../'): options.results_directory = options.results_directory[6:] options.results_directory = os.path.abspath( os.path.join(os.getcwd(), options.results_directory)) chromium_utils.RemoveDirectory(options.results_directory) command.extend(['--results-directory', options.results_directory]) if options.target: command.extend(['--target', options.target]) if options.platform: command.extend(['--platform', options.platform]) if options.skipped: command.extend(['--skipped', options.skipped]) if options.no_pixel_tests: command.append('--no-pixel-tests') if options.batch_size: command.extend(['--batch-size', options.batch_size]) if options.run_part: command.extend(['--run-part', options.run_part]) if options.builder_name: command.extend(['--builder-name', options.builder_name]) if options.build_number: command.extend(['--build-number', options.build_number]) command.extend(['--master-name', slave_utils.GetActiveMaster() or '']) command.extend(['--build-name', slave_name]) if options.step_name: command.extend(['--step-name', options.step_name]) # On Windows, look for the target in an exact location. if sys.platform == 'win32': command.extend(['--build-directory', build_dir]) if options.test_results_server: command.extend(['--test-results-server', options.test_results_server]) if options.enable_pageheap: command.append('--time-out-ms=120000') if options.time_out_ms: command.extend(['--time-out-ms', options.time_out_ms]) for filename in options.additional_expectations: command.append('--additional-expectations=%s' % filename) if options.driver_name: command.append('--driver-name=%s' % options.driver_name) for additional_drt_flag in options.additional_drt_flag: command.append('--additional-drt-flag=%s' % additional_drt_flag) for test_list in options.test_list: command += ['--test-list', test_list] if options.enable_leak_detection: command.append('--enable-leak-detection') # The list of tests is given as arguments. if options.options: command.extend(options.options.split(' ')) command.extend(args) # Nuke anything that appears to be stale chrome items in the temporary # directory from previous test runs (i.e.- from crashes or unittest leaks). slave_utils.RemoveChromeTemporaryFiles() try: if options.enable_pageheap: slave_utils.SetPageHeap(build_dir, dumprendertree_exe, True) # Run the the tests return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, command) finally: if options.enable_pageheap: slave_utils.SetPageHeap(build_dir, dumprendertree_exe, False) if options.json_test_results: results_dir = options.results_directory results_json = os.path.join(results_dir, "failing_results.json") # If the json results file was not produced, then we produce no output # file too and rely on a recipe to handle this as invalid result. if os.path.isfile(results_json): with open(results_json, 'rb') as f: data = f.read() # data is in the form of: # ADD_RESULTS(<json object>); # but use a regex match to also support a raw json object. m = re.match( r'[^({]*' # From the beginning, take any except '(' or '{' r'(?:' r'\((.*)\);' # Expect '(<json>);' r'|' # or r'({.*})' # '<json object>' r')$', data) assert m is not None data = m.group(1) or m.group(2) json_data = json.loads(data) assert isinstance(json_data, dict) with open(options.json_test_results, 'wb') as f: f.write(data)
def layout_test(options, args): """Parse options and call run_webkit_tests.py, using Python from the tree.""" build_dir = os.path.abspath(options.build_dir) # Disable the page heap in case it got left enabled by some previous process. try: slave_utils.SetPageHeap(build_dir, 'DumpRenderTree.exe', False) except chromium_utils.PathNotFound: # If we don't have gflags.exe, report it but don't worry about it. print 'Warning: Couldn\'t disable page heap, if it was already enabled.' webkit_tests_dir = chromium_utils.FindUpward(build_dir, 'webkit', 'tools', 'layout_tests') run_webkit_tests = os.path.join(webkit_tests_dir, 'run_webkit_tests.py') slave_name = slave_utils.SlaveBuildName(build_dir) command = [ run_webkit_tests, '--no-show-results', '--no-new-test-results', '--verbose', # Verbose output is enabled to support the dashboard. '--full-results-html', # To make debugging failures easier. '--clobber-old-results', # Clobber test results before each run. '--exit-after-n-failures', '5000', '--exit-after-n-crashes-or-timeouts', '100', ] if options.results_directory: # Prior to the fix in https://bugs.webkit.org/show_bug.cgi?id=58272, # run_webkit_tests expects the results directory to be relative to # the configuration directory (e.g., src/webkit/Release). The # parameter is given to us relative to build_dir, which is where we # will run the command from. # # When 58272 is landed, run_webkit_tests will support absolute file # paths as well as paths relative to CWD for non-Chromium ports and # paths relative to the configuration dir for Chromium ports. As # a transitional fix, we convert to an absolute dir, but once the # hack in 58272 is removed, we can use results_dir as-is. if not os.path.isabs(options.results_directory): if options.results_directory.startswith('../../'): options.results_directory = options.results_directory[6:] options.results_directory = os.path.abspath( os.path.join(os.getcwd(), options.results_directory)) chromium_utils.RemoveDirectory(options.results_directory) command.extend(['--results-directory', options.results_directory]) if options.target: command.extend(['--target', options.target]) if options.platform: command.extend(['--platform', options.platform]) if options.no_pixel_tests: command.append('--no-pixel-tests') if options.batch_size: command.extend(['--batch-size', options.batch_size]) if options.run_part: command.extend(['--run-part', options.run_part]) if options.builder_name: command.extend(['--builder-name', options.builder_name]) if options.build_number: command.extend(['--build-number', options.build_number]) command.extend(['--master-name', slave_utils.GetActiveMaster() or '']) command.extend(['--build-name', slave_name]) # On Windows, look for the target in an exact location. if sys.platform == 'win32': command.extend(['--build-directory', build_dir]) if options.test_results_server: command.extend(['--test-results-server', options.test_results_server]) if options.enable_pageheap: command.append('--time-out-ms=120000') for filename in options.additional_expectations: command.append('--additional-expectations=%s' % filename) # The list of tests is given as arguments. command.extend(options.options.split(' ')) command.extend(args) # Nuke anything that appears to be stale chrome items in the temporary # directory from previous test runs (i.e.- from crashes or unittest leaks). slave_utils.RemoveChromeTemporaryFiles() try: if options.enable_pageheap: slave_utils.SetPageHeap(build_dir, 'DumpRenderTree.exe', True) # Run the the tests return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target, command) finally: if options.enable_pageheap: slave_utils.SetPageHeap(build_dir, 'DumpRenderTree.exe', False)