From 5af96e2c7b73ebc627c6894727826a7576d31758 Mon Sep 17 00:00:00 2001 From: Leon Clarke Date: Thu, 3 Jun 2010 14:33:32 +0100 Subject: Merge webkit.org at r60469 : Initial merge by git. Change-Id: I66a0047aa2af802f66bb0c7f2a8b02247a596234 --- WebKitTools/Scripts/new-run-webkit-tests | 7 +- WebKitTools/Scripts/old-run-webkit-tests | 4 + WebKitTools/Scripts/test-html5-parser | 89 ++++++++++++++++++++++ .../Scripts/webkitpy/common/checkout/scm.py | 2 +- .../webkitpy/common/checkout/scm_unittest.py | 15 +++- .../Scripts/webkitpy/common/config/committers.py | 2 +- .../Scripts/webkitpy/common/net/rietveld.py | 7 -- WebKitTools/Scripts/webkitpy/common/system/user.py | 13 ++++ .../layout_package/dump_render_tree_thread.py | 5 +- .../layout_tests/layout_package/printing.py | 23 ++++-- .../layout_package/printing_unittest.py | 17 +++-- .../Scripts/webkitpy/layout_tests/port/chromium.py | 29 +++---- .../webkitpy/layout_tests/port/chromium_win.py | 15 +++- .../webkitpy/layout_tests/run_webkit_tests.py | 62 +++++++++------ WebKitTools/Scripts/webkitpy/style/checker.py | 1 + WebKitTools/Scripts/webkitpy/style/checkers/cpp.py | 8 +- .../webkitpy/style/checkers/cpp_unittest.py | 15 ++++ .../webkitpy/tool/commands/download_unittest.py | 8 +- WebKitTools/Scripts/webkitpy/tool/mocktool.py | 3 + .../Scripts/webkitpy/tool/steps/editchangelog.py | 2 +- .../tool/steps/updatechangelogswithreviewer.py | 2 +- .../webkitpy/tool/steps/validatereviewer.py | 2 +- 22 files changed, 256 insertions(+), 75 deletions(-) create mode 100755 WebKitTools/Scripts/test-html5-parser (limited to 'WebKitTools/Scripts') diff --git a/WebKitTools/Scripts/new-run-webkit-tests b/WebKitTools/Scripts/new-run-webkit-tests index 0728ee0..9fcacaa 100755 --- a/WebKitTools/Scripts/new-run-webkit-tests +++ b/WebKitTools/Scripts/new-run-webkit-tests @@ -28,9 +28,14 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Wrapper around webkitpy/layout_tests/run_webkit_tests.py""" +import signal import sys import webkitpy.layout_tests.run_webkit_tests as run_webkit_tests if __name__ == '__main__': - sys.exit(run_webkit_tests.main()) + try: + sys.exit(run_webkit_tests.main()) + except KeyboardInterrupt: + # this mirrors what the shell normally does + sys.exit(signal.SIGINT + 128) diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests index 783606d..ac73c00 100755 --- a/WebKitTools/Scripts/old-run-webkit-tests +++ b/WebKitTools/Scripts/old-run-webkit-tests @@ -154,6 +154,7 @@ my $tmpDir = "/tmp"; my $testResultsDirectory = File::Spec->catfile($tmpDir, "layout-test-results"); my $testsPerDumpTool = 1000; my $threaded = 0; +my $html5parser = 0; # DumpRenderTree has an internal timeout of 30 seconds, so this must be > 30. my $timeoutSeconds = 35; my $tolerance = 0; @@ -265,6 +266,7 @@ Usage: $programName [options] [testdir|testpath ...] --ignore-metrics Ignore metrics in tests --[no-]strip-editing-callbacks Remove editing callbacks from expected results -t|--threaded Run a concurrent JavaScript thead with each test + --html5-parser Run the tests using the HTML5 parser --timeout t Sets the number of seconds before a test times out (default: $timeoutSeconds) --valgrind Run DumpRenderTree inside valgrind (Qt/Linux only) -v|--verbose More verbose output (overrides --quiet) @@ -306,6 +308,7 @@ my $getOptionsResult = GetOptions( 'slowest' => \$report10Slowest, 'strip-editing-callbacks!' => \$stripEditingCallbacks, 'threaded|t' => \$threaded, + 'html5-parser' => \$html5parser, 'timeout=i' => \$timeoutSeconds, 'tolerance=f' => \$tolerance, 'use-remote-links-to-tests' => \$useRemoteLinksToTests, @@ -538,6 +541,7 @@ my $totalLeaks = 0; my @toolArgs = (); push @toolArgs, "--pixel-tests" if $pixelTests; push @toolArgs, "--threaded" if $threaded; +push @toolArgs, "--html5-parser" if $html5parser; push @toolArgs, "--complex-text" if $complexText; push @toolArgs, "-"; diff --git a/WebKitTools/Scripts/test-html5-parser b/WebKitTools/Scripts/test-html5-parser new file mode 100755 index 0000000..5b935b8 --- /dev/null +++ b/WebKitTools/Scripts/test-html5-parser @@ -0,0 +1,89 @@ +#!/usr/bin/perl +# Copyright (C) 2010 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of Google, Inc. nor the names of +# its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY GOOGLE AND ITS CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL GOOGLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Temporary script to test the HTML5 parser until it is able to +# run enough LayoutTests so that we know what changes we'll need +# to make to run-webkit-tests to support testing with the new parser. + +# NOTE: This script is a total hack and should be rolled into +# run-webkit-tests instead of being improved further. + +use strict; +use warnings; + +use FindBin; +use lib $FindBin::Bin; +use webkitdirs; +use VCSUtils; + +sub writeToFile($$) +{ + my ($filePath, $contents) = @_; + open NEWFILE, ">", "$filePath" or die "Could not create $filePath. $!\n"; + print NEWFILE $contents; + close NEWFILE; +} + +setConfiguration(); + +my $productDir = productDir(); +my $dumpTool = "$productDir/DumpRenderTree"; + +chdirWebKit(); + +my @args = argumentsForConfiguration(); +system("WebKitTools/Scripts/build-dumprendertree", @args) == 0 or die "Failed to build DumpRenderTree"; + +my @tests = ( + "html5lib/runner", + "html5lib/webkit-resumer", +); + +foreach my $test (@tests) { + # This logic is super-dumb. Instead of making it smarter, we should + # roll this into run-webkit-tests once we can run enough of the layout tests. + my $testPath = "LayoutTests/$test.html"; + my $expectedPath = "LayoutTests/$test-expected-html5.txt"; + my $actualPath = "LayoutTests/$test-actual-html5.txt"; + my $command = "DYLD_FRAMEWORK_PATH=$productDir $dumpTool --html5-parser $testPath"; + print $command, "\n"; + my $output = `$command`; + writeToFile($actualPath, $output); + if (-r $expectedPath) { + my $expectedOutput = `cat $expectedPath`; + if ($expectedOutput eq $output) { + print "$test -> PASS\n"; + } else { + print "$test -> FAIL, diff:\n"; + system("diff -u $expectedPath $actualPath"); + } + } else { + print "$test -> NEW, results:\n"; + writeToFile($expectedPath, $output); + print $output; + } +} diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py index e68ccfa..eea76be 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py @@ -609,7 +609,7 @@ class Git(SCM): return squash def _svn_branch_has_extra_commits(self): - return len(run_command(['git', 'rev-list', '--max-count=1', self.svn_branch_name(), '^head'])) + return len(run_command(['git', 'rev-list', '--max-count=1', self.svn_branch_name(), '^HEAD'])) def commit_with_message(self, message, username=None, git_commit=None, squash=None): # Username is ignored during Git commits. diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py index b6ae388..8eea4d8 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py @@ -813,6 +813,12 @@ class GitTest(SCMTest): run_command(['git', 'add', 'test_file_commit2']) self.scm.commit_locally_with_message("yet another test commit") + def _three_local_commits(self): + write_into_file_at_path('test_file_commit0', 'more test content') + run_command(['git', 'add', 'test_file_commit0']) + self.scm.commit_locally_with_message("another test commit") + self._two_local_commits() + def test_commit_with_message_git_commit(self): self._two_local_commits() @@ -825,13 +831,14 @@ class GitTest(SCMTest): self.assertFalse(re.search(r'test_file_commit2', svn_log)) def test_commit_with_message_git_commit_range(self): - self._two_local_commits() + self._three_local_commits() scm = detect_scm_system(self.git_checkout_path) commit_text = scm.commit_with_message("another test commit", git_commit="HEAD~2..HEAD") self.assertEqual(scm.svn_revision_from_commit_text(commit_text), '6') svn_log = run_command(['git', 'svn', 'log', '--limit=1', '--verbose']) + self.assertFalse(re.search(r'test_file_commit0', svn_log)) self.assertTrue(re.search(r'test_file_commit1', svn_log)) self.assertTrue(re.search(r'test_file_commit2', svn_log)) @@ -922,9 +929,10 @@ class GitTest(SCMTest): self.assertFalse(re.search(r'test_file_commit2', patch)) def test_create_patch_git_commit_range(self): - self._two_local_commits() + self._three_local_commits() scm = detect_scm_system(self.git_checkout_path) patch = scm.create_patch(git_commit="HEAD~2..HEAD") + self.assertFalse(re.search(r'test_file_commit0', patch)) self.assertTrue(re.search(r'test_file_commit2', patch)) self.assertTrue(re.search(r'test_file_commit1', patch)) @@ -1007,9 +1015,10 @@ class GitTest(SCMTest): self.assertFalse('test_file_commit2' in files) def test_changed_files_git_commit_range(self): - self._two_local_commits() + self._three_local_commits() scm = detect_scm_system(self.git_checkout_path) files = scm.changed_files(git_commit="HEAD~2..HEAD") + self.assertTrue('test_file_commit0' not in files) self.assertTrue('test_file_commit1' in files) self.assertTrue('test_file_commit2' in files) diff --git a/WebKitTools/Scripts/webkitpy/common/config/committers.py b/WebKitTools/Scripts/webkitpy/common/config/committers.py index 02f1aed..d9c541f 100644 --- a/WebKitTools/Scripts/webkitpy/common/config/committers.py +++ b/WebKitTools/Scripts/webkitpy/common/config/committers.py @@ -86,7 +86,6 @@ committers_unable_to_review = [ Committer("Carol Szabo", "carol.szabo@nokia.com"), Committer("Chang Shu", "Chang.Shu@nokia.com"), Committer("Chris Evans", "cevans@google.com"), - Committer("Chris Fleizach", "cfleizach@apple.com"), Committer("Chris Marrin", "cmarrin@apple.com", "cmarrin"), Committer("Chris Petersen", "cpetersen@apple.com", "cpetersen"), Committer("Christian Dywan", ["christian@twotoasts.de", "christian@webkit.org"]), @@ -193,6 +192,7 @@ reviewers_list = [ Reviewer("Brady Eidson", "beidson@apple.com", "bradee-oh"), Reviewer("Cameron Zwarich", ["zwarich@apple.com", "cwzwarich@apple.com", "cwzwarich@webkit.org"]), Reviewer("Chris Blumenberg", "cblu@apple.com", "cblu"), + Reviewer("Chris Fleizach", "cfleizach@apple.com", "cfleizach"), Reviewer("Chris Jerdonek", "cjerdonek@webkit.org", "cjerdonek"), Reviewer("Dan Bernstein", ["mitz@webkit.org", "mitz@apple.com"], "mitzpettel"), Reviewer("Daniel Bates", "dbates@webkit.org", "dydz"), diff --git a/WebKitTools/Scripts/webkitpy/common/net/rietveld.py b/WebKitTools/Scripts/webkitpy/common/net/rietveld.py index c0d6119..572d1fd 100644 --- a/WebKitTools/Scripts/webkitpy/common/net/rietveld.py +++ b/WebKitTools/Scripts/webkitpy/common/net/rietveld.py @@ -67,15 +67,8 @@ class Rietveld(object): log("Would have run %s" % args) return - # Set logging level to avoid rietveld's logging spew. - old_level_name = logging.getLogger().getEffectiveLevel() - logging.getLogger().setLevel(logging.ERROR) - # Use RealMain instead of calling upload from the commandline so that # we can pass in the diff ourselves. Otherwise, upload will just use # git diff for git checkouts, which doesn't respect --squash and --git-commit. issue, patchset = upload.RealMain(args[1:], data=diff) - - # Reset logging level to the original value. - logging.getLogger().setLevel(old_level_name) return issue diff --git a/WebKitTools/Scripts/webkitpy/common/system/user.py b/WebKitTools/Scripts/webkitpy/common/system/user.py index 4fa2fa3..82fa0d3 100644 --- a/WebKitTools/Scripts/webkitpy/common/system/user.py +++ b/WebKitTools/Scripts/webkitpy/common/system/user.py @@ -76,6 +76,19 @@ class User(object): # Note: Not thread safe: http://bugs.python.org/issue2320 subprocess.call(args + files) + def edit_changelog(self, files): + edit_application = os.environ.get("CHANGE_LOG_EDIT_APPLICATION") + if edit_application and sys.platform == "darwin": + # On Mac we support editing ChangeLogs using an application. + args = shlex.split(edit_application) + print "Using editor in the CHANGE_LOG_EDIT_APPLICATION environment variable." + print "Please quit the editor application when done editing." + if edit_application.find("Xcode.app"): + print "Instead of using Xcode.app, consider using EDITOR=\"xed --wait\"." + subprocess.call(["open", "-W", "-n", "-a"] + args + files) + return + self.edit(files) + def page(self, message): pager = os.environ.get("PAGER") or "less" try: diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py index 09f9ac7..a2e2091 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py @@ -258,6 +258,9 @@ class TestShellThread(threading.Thread): self._run(test_runner=None, result_summary=None) _log.debug('%s done (%d tests)' % (self.getName(), self.get_num_tests())) + except KeyboardInterrupt: + self._exception_info = sys.exc_info() + _log.debug("%s interrupted" % self.getName()) except: # Save the exception for our caller to see. self._exception_info = sys.exc_info() @@ -298,7 +301,7 @@ class TestShellThread(threading.Thread): while True: if self._canceled: - _log.info('Testing canceled') + _log.debug('Testing cancelled') tests_run_file.close() return diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py index 77de2e0..f838a7b 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py @@ -272,24 +272,35 @@ class Printer(object): def print_timing(self, msg): self.write(msg, 'timing') - def print_one_line_summary(self, total, expected): + def print_one_line_summary(self, total, expected, unexpected): """Print a one-line summary of the test run to stdout. Args: total: total number of tests run expected: number of expected results + unexpected: number of unexpected results """ if self.disabled('one-line-summary'): return - unexpected = total - expected + incomplete = total - expected - unexpected + if incomplete: + self._write("") + incomplete_str = " (%d didn't run)" % incomplete + expected_str = str(expected) + else: + incomplete_str = "" + expected_str = "All %d" % expected + if unexpected == 0: - self._write("All %d tests ran as expected." % expected) + self._write("%s tests ran as expected%s." % + (expected_str, incomplete_str)) elif expected == 1: - self._write("1 test ran as expected, %d didn't:" % unexpected) + self._write("1 test ran as expected, %d didn't%s:" % + (unexpected, incomplete_str)) else: - self._write("%d tests ran as expected, %d didn't:" % - (expected, unexpected)) + self._write("%d tests ran as expected, %d didn't%s:" % + (expected, unexpected, incomplete_str)) self._write("") def print_test_result(self, result, expected, exp_str, got_str): diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py index 3804210..c8648bc 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py @@ -215,27 +215,34 @@ class Testprinter(unittest.TestCase): def test_print_one_line_summary(self): printer, err, out = self.get_printer(['--print', 'nothing']) - printer.print_one_line_summary(1, 1) + printer.print_one_line_summary(1, 1, 0) self.assertTrue(err.empty()) printer, err, out = self.get_printer(['--print', 'one-line-summary']) - printer.print_one_line_summary(1, 1) + printer.print_one_line_summary(1, 1, 0) self.assertEquals(err.get(), ["All 1 tests ran as expected.\n", "\n"]) printer, err, out = self.get_printer(['--print', 'everything']) - printer.print_one_line_summary(1, 1) + printer.print_one_line_summary(1, 1, 0) self.assertEquals(err.get(), ["All 1 tests ran as expected.\n", "\n"]) err.reset() - printer.print_one_line_summary(2, 1) + printer.print_one_line_summary(2, 1, 1) self.assertEquals(err.get(), ["1 test ran as expected, 1 didn't:\n", "\n"]) err.reset() - printer.print_one_line_summary(3, 2) + printer.print_one_line_summary(3, 2, 1) self.assertEquals(err.get(), ["2 tests ran as expected, 1 didn't:\n", "\n"]) + err.reset() + printer.print_one_line_summary(3, 2, 0) + self.assertEquals(err.get(), + ['\n', "2 tests ran as expected (1 didn't run).\n", + '\n']) + + def test_print_test_result(self): result = get_result('foo.html') printer, err, out = self.get_printer(['--print', 'nothing']) diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py index b715f7b..db23eb8 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -46,10 +46,7 @@ import http_server from webkitpy.common.system.executive import Executive -# FIXME: To use the DRT-based version of this file, we need to be able to -# run the webkit code, which uses server_process, which requires UNIX-style -# non-blocking I/O with selects(), which requires fcntl() which doesn't exist -# on Windows. +# Chromium DRT on non-Windows uses WebKitDriver. if sys.platform not in ('win32', 'cygwin'): import webkit @@ -92,13 +89,6 @@ class ChromiumPort(base.Port): def check_build(self, needs_http): result = True - # FIXME: see comment above re: import webkit - if (sys.platform in ('win32', 'cygwin') and self._options and - hasattr(self._options, 'use_drt') and self._options.use_drt): - _log.error('--use-drt is not supported on Windows yet') - _log.error('') - result = False - dump_render_tree_binary_path = self._path_to_driver() result = check_file_exists(dump_render_tree_binary_path, 'test driver') and result @@ -143,10 +133,11 @@ class ChromiumPort(base.Port): abspath = os.path.abspath(__file__) offset = abspath.find('third_party') if offset == -1: - # FIXME: This seems like the wrong error to throw. - raise AssertionError('could not find Chromium base dir from ' + - abspath) - self._chromium_base_dir = abspath[0:offset] + self._chromium_base_dir = os.path.join( + abspath[0:abspath.find('WebKitTools')], + 'WebKit', 'chromium') + else: + self._chromium_base_dir = abspath[0:offset] return os.path.join(self._chromium_base_dir, *comps) def path_to_test_expectations_file(self): @@ -180,8 +171,12 @@ class ChromiumPort(base.Port): def create_driver(self, image_path, options): """Starts a new Driver and returns a handle to it.""" - if self._options.use_drt: + if self._options.use_drt and sys.platform not in ('win32', 'cygwin'): return webkit.WebKitDriver(self, image_path, options, executive=self._executive) + if self._options.use_drt: + options += ['--test-shell'] + else: + options += ['--layout-tests'] return ChromiumDriver(self, image_path, options, executive=self._executive) def start_helper(self): @@ -297,7 +292,7 @@ class ChromiumDriver(base.Driver): cmd = [] # FIXME: We should not be grabbing at self._port._options.wrapper directly. cmd += self._command_wrapper(self._port._options.wrapper) - cmd += [self._port._path_to_driver(), '--layout-tests'] + cmd += [self._port._path_to_driver()] if self._options: cmd += self._options diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py index 3b11429..ec1c33c 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py @@ -149,13 +149,22 @@ class ChromiumWinPort(chromium.ChromiumPort): def _path_to_driver(self, configuration=None): if not configuration: configuration = self._options.configuration - return self._build_path(configuration, 'test_shell.exe') + binary_name = 'test_shell.exe' + if self._options.use_drt: + binary_name = 'DumpRenderTree.exe' + return self._build_path(configuration, binary_name) def _path_to_helper(self): - return self._build_path(self._options.configuration, 'layout_test_helper.exe') + binary_name = 'layout_test_helper.exe' + if self._options.use_drt: + binary_name = 'LayoutTestHelper.exe' + return self._build_path(self._options.configuration, binary_name) def _path_to_image_diff(self): - return self._build_path(self._options.configuration, 'image_diff.exe') + binary_name = 'image_diff.exe' + if self._options.use_drt: + binary_name = 'ImageDiff.exe' + return self._build_path(self._options.configuration, binary_name) def _path_to_wdiff(self): return self.path_from_chromium_base('third_party', 'cygwin', 'bin', diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 6d5543d..a4a92c7 100755 --- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -58,6 +58,7 @@ import Queue import random import re import shutil +import signal import sys import time import traceback @@ -680,6 +681,7 @@ class TestRunner: test_timings = {} individual_test_timings = [] thread_timings = [] + keyboard_interrupted = False try: # Loop through all the threads waiting for them to finish. for thread in threads: @@ -697,30 +699,30 @@ class TestRunner: self._dump_thread_states_if_necessary() self.update_summary(result_summary) - # This thread is done, save off the timing information. - thread_timings.append({'name': thread.getName(), - 'num_tests': thread.get_num_tests(), - 'total_time': thread.get_total_time()}) - test_timings.update(thread.get_directory_timing_stats()) - individual_test_timings.extend(thread.get_test_results()) except KeyboardInterrupt: + keyboard_interrupted = True for thread in threads: thread.cancel() - raise + + if not keyboard_interrupted: + for thread in threads: + # Check whether a thread died before normal completion. + exception_info = thread.get_exception_info() + if exception_info is not None: + # Re-raise the thread's exception here to make it clear + # something went wrong. Otherwise, the tests that did not + # run would be assumed to have passed. + raise (exception_info[0], exception_info[1], + exception_info[2]) + for thread in threads: - # Check whether a TestShellThread died before normal completion. - exception_info = thread.get_exception_info() - if exception_info is not None: - # Re-raise the thread's exception here to make it clear that - # testing was aborted. Otherwise, the tests that did not run - # would be assumed to have passed. - raise exception_info[0], exception_info[1], exception_info[2] - - # FIXME: This update_summary call seems unecessary. - # Calls are already made right after join() above, - # as well as from the individual threads themselves. - self.update_summary(result_summary) - return (thread_timings, test_timings, individual_test_timings) + thread_timings.append({'name': thread.getName(), + 'num_tests': thread.get_num_tests(), + 'total_time': thread.get_total_time()}) + test_timings.update(thread.get_directory_timing_stats()) + individual_test_timings.extend(thread.get_test_results()) + return (keyboard_interrupted, thread_timings, test_timings, + individual_test_timings) def needs_http(self): """Returns whether the test runner needs an HTTP server.""" @@ -752,7 +754,8 @@ class TestRunner: self._port.start_websocket_server() # self._websocket_secure_server.Start() - thread_timings, test_timings, individual_test_timings = ( + keyboard_interrupted, thread_timings, test_timings, \ + individual_test_timings = ( self._run_tests(self._test_files_list, result_summary)) # We exclude the crashes from the list of results to retry, because @@ -760,12 +763,13 @@ class TestRunner: failures = self._get_failures(result_summary, include_crashes=False) retry_summary = result_summary while (len(failures) and self._options.retry_failures and - not self._retrying): + not self._retrying and not keyboard_interrupted): _log.info('') _log.info("Retrying %d unexpected failure(s) ..." % len(failures)) _log.info('') self._retrying = True retry_summary = ResultSummary(self._expectations, failures.keys()) + # Note that we intentionally ignore the return value here. self._run_tests(failures.keys(), retry_summary) failures = self._get_failures(retry_summary, include_crashes=True) @@ -782,7 +786,8 @@ class TestRunner: sys.stderr.flush() self._printer.print_one_line_summary(result_summary.total, - result_summary.expected) + result_summary.expected, + result_summary.unexpected) unexpected_results = summarize_unexpected_results(self._port, self._expectations, result_summary, retry_summary) @@ -800,6 +805,11 @@ class TestRunner: if self._options.show_results and wrote_results: self._show_results_html_file() + # Now that we've completed all the processing we can, we re-raise + # a KeyboardInterrupt if necessary so the caller can handle it. + if keyboard_interrupted: + raise KeyboardInterrupt + # Ignore flaky failures and unexpected passes so we don't turn the # bot red for those. return unexpected_results['num_regressions'] @@ -1665,4 +1675,8 @@ def main(): return run(port_obj, options, args) if '__main__' == __name__: - sys.exit(main()) + try: + sys.exit(main()) + except KeyboardInterrupt: + # this mirrors what the shell normally does + sys.exit(signal.SIGINT + 128) diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py index 8fc86c3..5d75a1b 100644 --- a/WebKitTools/Scripts/webkitpy/style/checker.py +++ b/WebKitTools/Scripts/webkitpy/style/checker.py @@ -210,6 +210,7 @@ _SKIPPED_FILES_WITH_WARNING = [ "WebKit/gtk/tests/", "WebKit/qt/Api/", "WebKit/qt/tests/", + "WebKit/qt/examples/", ] diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py index 3e787d6..a77bff0 100644 --- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py +++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py @@ -1868,8 +1868,12 @@ def check_for_null(file_extension, clean_lines, line_number, error): line = clean_lines.elided[line_number] - # Don't warn about NULL usage in g_object_{get,set}(). See Bug 32858 - if search(r'\bg_object_[sg]et\b', line): + # Don't warn about NULL usage in g_*(). See Bug 32858 and 39372. + if search(r'\bg(_[a-z]+)+\b', line): + return + + # Don't warn about NULL usage in gst_*_many(). See Bug 39740 + if search(r'\bgst_\w+_many\b', line): return # Don't warn about NULL usage in g_str{join,concat}(). See Bug 34834 diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py index 5a5aabd..d7cb876 100644 --- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py @@ -3437,6 +3437,21 @@ class WebKitStyleTest(CppStyleTestBase): 'g_object_set(foo, "prop", bar, NULL);', '') self.assert_lint( + 'g_build_filename(foo, bar, NULL);', + '') + self.assert_lint( + 'gst_bin_add_many(foo, bar, boo, NULL);', + '') + self.assert_lint( + 'gst_bin_remove_many(foo, bar, boo, NULL);', + '') + self.assert_lint( + 'gst_element_link_many(foo, bar, boo, NULL);', + '') + self.assert_lint( + 'gst_element_unlink_many(foo, bar, boo, NULL);', + '') + self.assert_lint( 'gchar* result = g_strconcat("part1", "part2", "part3", NULL);', '') self.assert_lint( diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/download_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/download_unittest.py index 4dd9d7f..08a4377 100644 --- a/WebKitTools/Scripts/webkitpy/tool/commands/download_unittest.py +++ b/WebKitTools/Scripts/webkitpy/tool/commands/download_unittest.py @@ -92,7 +92,13 @@ class DownloadCommandsTest(CommandsTest): def test_land_diff(self): expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning run-webkit-tests\nUpdating bug 42\n" - self.assert_execute_outputs(Land(), [42], options=self._default_options(), expected_stderr=expected_stderr) + mock_tool = MockTool() + mock_tool.scm().create_patch = Mock() + mock_tool.checkout().modified_changelogs = Mock(return_value=[]) + self.assert_execute_outputs(Land(), [42], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool) + # Make sure we're not calling expensive calls too often. + self.assertEqual(mock_tool.scm().create_patch.call_count, 0) + self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1) def test_check_style(self): expected_stderr = "Processing 1 patch from 1 bug.\nUpdating working directory\nProcessing patch 197 from bug 42.\nRunning check-webkit-style\n" diff --git a/WebKitTools/Scripts/webkitpy/tool/mocktool.py b/WebKitTools/Scripts/webkitpy/tool/mocktool.py index 2f192d9..3934ea3 100644 --- a/WebKitTools/Scripts/webkitpy/tool/mocktool.py +++ b/WebKitTools/Scripts/webkitpy/tool/mocktool.py @@ -444,6 +444,9 @@ class MockUser(object): def edit(self, files): pass + def edit_changelog(self, files): + pass + def page(self, message): pass diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py b/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py index 69c8732..de9b4e4 100644 --- a/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py +++ b/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py @@ -34,4 +34,4 @@ from webkitpy.tool.steps.abstractstep import AbstractStep class EditChangeLog(AbstractStep): def run(self, state): os.chdir(self._tool.scm().checkout_root) - self._tool.user.edit(self.cached_lookup(state, "changelogs")) + self._tool.user.edit_changelog(self.cached_lookup(state, "changelogs")) diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py b/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py index 9740013..ef4baa2 100644 --- a/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py +++ b/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreviewer.py @@ -70,5 +70,5 @@ class UpdateChangeLogsWithReviewer(AbstractStep): return os.chdir(self._tool.scm().checkout_root) - for changelog_path in self._tool.checkout().modified_changelogs(self._options.git_commit, self._options.squash): + for changelog_path in self.cached_lookup(state, "changelogs"): ChangeLog(changelog_path).set_reviewer(reviewer) diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/validatereviewer.py b/WebKitTools/Scripts/webkitpy/tool/steps/validatereviewer.py index 66ee5b7..9f4d44e 100644 --- a/WebKitTools/Scripts/webkitpy/tool/steps/validatereviewer.py +++ b/WebKitTools/Scripts/webkitpy/tool/steps/validatereviewer.py @@ -63,7 +63,7 @@ class ValidateReviewer(AbstractStep): # FIXME: We should figure out how to handle the current working # directory issue more globally. os.chdir(self._tool.scm().checkout_root) - for changelog_path in self._tool.checkout().modified_changelogs(self._options.git_commit, self._options.squash): + for changelog_path in self.cached_lookup(state, "changelogs"): changelog_entry = ChangeLog(changelog_path).latest_entry() if self._has_valid_reviewer(changelog_entry): continue -- cgit v1.1