[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Wed Jan 6 00:21:49 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 0723c2127203ed0b78cab30485ca10c51d7c19ab
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 5 08:47:34 2010 +0000
2010-01-05 Chris Jerdonek <chris.jerdonek at gmail.com>
Reviewed by Eric Seidel.
Minor improvements to test-webkit-scripts, as suggested
by an earlier review.
https://bugs.webkit.org/show_bug.cgi?id=33125
* Scripts/test-webkit-scripts:
- Used OptionParser class instead of getopt.getopt().
- Created main() method for __main__ block.
- Enclosed functions in a class.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c6459f8..98afbf7 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-05 Chris Jerdonek <chris.jerdonek at gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ Minor improvements to test-webkit-scripts, as suggested
+ by an earlier review.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33125
+
+ * Scripts/test-webkit-scripts:
+ - Used OptionParser class instead of getopt.getopt().
+ - Created main() method for __main__ block.
+ - Enclosed functions in a class.
+
2010-01-05 Chris Fleizach <cfleizach at apple.com>
No review. Fix DRT breakage on Tiger/Leopard.
diff --git a/WebKitTools/Scripts/test-webkit-scripts b/WebKitTools/Scripts/test-webkit-scripts
index af8cd20..781e8ce 100755
--- a/WebKitTools/Scripts/test-webkit-scripts
+++ b/WebKitTools/Scripts/test-webkit-scripts
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright (C) 2009 Chris Jerdonek (chris.jerdonek at gmail.com)
+# Copyright (C) 2009, 2010 Chris Jerdonek (chris.jerdonek at gmail.com)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -28,56 +28,58 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Tests WebKit Perl and Python scripts.
+"""Run unit tests of WebKit's Perl and Python scripts."""
-Syntax: test-webkit-scripts [--all]
-
- --all Runs all available tests, including those suppressed
- by default.
-"""
+# The docstring above is passed as the "description" to the OptionParser
+# used in this script's __main__ block.
+#
+# For the command options supported by this script, see the code below
+# that instantiates the OptionParser class, or else pass --help
+# while running this script (since argument help is auto-generated).
-import getopt
import os
import subprocess
import sys
+from optparse import OptionParser
-def test_script(title, script_path, args=None):
- """Run the given test command."""
- print('Testing %s:' % title)
+class ScriptsTester(object):
- call_args = [script_path]
- if args is not None:
- call_args.extend(args)
- subprocess.call(call_args)
- print(70 * "*") # dividing line
+ """Supports running unit tests of WebKit scripts."""
-if __name__ == '__main__':
+ def __init__(self, scripts_directory):
+ self.scripts_directory = scripts_directory
- try:
- (opts, filenames) = getopt.getopt(sys.argv[1:], '', ['help', 'all'])
- except getopt.GetoptError:
- print(__doc__)
- sys.exit('Error: invalid option.')
+ def script_path(self, script_file_name):
+ """Return an absolute path to the given script."""
+ return os.path.join(self.scripts_directory, script_file_name)
- should_include_all = False
+ def run_test_script(self, script_title, script_path, args=None):
+ """Run the given test script."""
+ print('Testing %s:' % script_title)
+ call_args = [script_path]
+ if args:
+ call_args.extend(args)
+ subprocess.call(call_args)
+ print(70 * "*") # dividing line
- for (opt, val) in opts:
- if opt == '--help':
- print(__doc__)
- sys.exit()
- elif opt == '--all':
- should_include_all = True
+ def main(self):
+ parser = OptionParser(description=__doc__)
+ parser.add_option('-a', '--all', dest='all', action='store_true',
+ default=False, help='run all available tests, '
+ 'including those suppressed by default')
+ (options, args) = parser.parse_args()
- # Use absolute paths so this script can be run from any directory.
- scripts_directory = sys.path[0]
+ self.run_test_script('Perl scripts', self.script_path('test-webkitperl'))
+ self.run_test_script('Python scripts', self.script_path('test-webkitpy'),
+ ['--all'] if options.all else None)
- test_script('Perl scripts', os.path.join(scripts_directory, 'test-webkitperl'))
+ # FIXME: Display a cumulative indication of success or failure.
+ # In addition, call sys.exit() with 0 or 1 depending on that
+ # cumulative success or failure.
+ print('Note: Perl and Python results appear separately above.')
- test_script('Python scripts',
- os.path.join(scripts_directory, 'test-webkitpy'),
- ['--all'] if should_include_all else None)
- # FIXME: Display a cumulative indication of success or failure.
- # In addition, call sys.exit() with 0 or 1 depending on that
- # cumulative success or failure.
- print('Note: Perl and Python results appear separately above.')
+if __name__ == '__main__':
+ # The scripts directory is the directory containing this file.
+ tester = ScriptsTester(os.path.dirname(__file__))
+ tester.main()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list