WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed patch
patch-tools6-1.txt (text/plain), 5.13 KB, created by
Chris Jerdonek
on 2010-01-04 21:39:53 PST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Chris Jerdonek
Created:
2010-01-04 21:39:53 PST
Size:
5.13 KB
patch
obsolete
>Index: WebKitTools/ChangeLog >=================================================================== >--- WebKitTools/ChangeLog (revision 52784) >+++ WebKitTools/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2010-01-04 Chris Jerdonek <chris.jerdonek@gmail.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-04 Jon Honeycutt <jhoneycutt@apple.com> > > MSAA: <select> elements should broadcast value change events >Index: WebKitTools/Scripts/test-webkit-scripts >=================================================================== >--- WebKitTools/Scripts/test-webkit-scripts (revision 52782) >+++ WebKitTools/Scripts/test-webkit-scripts (working copy) >@@ -1,6 +1,6 @@ > #!/usr/bin/python > # >-# Copyright (C) 2009 Chris Jerdonek (chris.jerdonek@gmail.com) >+# Copyright (C) 2009, 2010 Chris Jerdonek (chris.jerdonek@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,59 @@ > # (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) >- >- call_args = [script_path] >- if args is not None: >- call_args.extend(args) >- subprocess.call(call_args) >- print(70 * "*") # dividing line >+class ScriptsTester(object): > >-if __name__ == '__main__': >+ """Supports running unit tests of WebKit scripts.""" >+ >+ 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.') >- >- should_include_all = False >- >- for (opt, val) in opts: >- if opt == '--help': >- print(__doc__) >- sys.exit() >- elif opt == '--all': >- should_include_all = True >- >- # Use absolute paths so this script can be run from any directory. >- scripts_directory = sys.path[0] >- >- test_script('Perl scripts', os.path.join(scripts_directory, 'test-webkitperl')) >- >- 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.') >+ 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) >+ >+ 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 is not None: >+ call_args.extend(args) >+ subprocess.call(call_args) >+ print(70 * "*") # dividing line >+ >+ 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() >+ >+ 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) >+ >+ # 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__': >+ # Providing an absolute path to the scripts directory allows this >+ # script to be run from any directory. >+ tester = ScriptsTester(sys.path[0]) >+ tester.main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 33125
:
45861
|
45864