| OLD | NEW |
| 1 # Copyright (c) 2009 Google Inc. All rights reserved. | 1 # Copyright (c) 2009 Google Inc. All rights reserved. |
| 2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
| 3 # Copyright (c) 2012 Intel Corporation. All rights reserved. | 3 # Copyright (c) 2012 Intel Corporation. All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 files = default_port.expectations_files() | 103 files = default_port.expectations_files() |
| 104 layout_tests_dir = default_port.layout_tests_dir() | 104 layout_tests_dir = default_port.layout_tests_dir() |
| 105 for file in files: | 105 for file in files: |
| 106 if file.startswith(layout_tests_dir): | 106 if file.startswith(layout_tests_dir): |
| 107 file = file.replace(layout_tests_dir, 'LayoutTests') | 107 file = file.replace(layout_tests_dir, 'LayoutTests') |
| 108 print file | 108 print file |
| 109 return | 109 return |
| 110 | 110 |
| 111 tests = set(default_port.tests(args)) | 111 tests = set(default_port.tests(args)) |
| 112 for port_name in port_names: | 112 for port_name in port_names: |
| 113 model = self._model(options, port_name, tests) | 113 port = tool.port_factory.get(port_name, options) |
| 114 model = TestExpectations(port, tests).model() |
| 114 tests_to_print = self._filter_tests(options, model, tests) | 115 tests_to_print = self._filter_tests(options, model, tests) |
| 115 lines = [model.get_expectation_line(test) for test in sorted(tests_t
o_print)] | 116 lines = [model.get_expectation_line(test) for test in sorted(tests_t
o_print)] |
| 116 if port_name != port_names[0]: | 117 if port_name != port_names[0]: |
| 117 print | 118 print |
| 118 print '\n'.join(self._format_lines(options, port_name, lines)) | 119 print '\n'.join(self._format_lines(options, port_name, lines)) |
| 119 | 120 |
| 120 def _filter_tests(self, options, model, tests): | 121 def _filter_tests(self, options, model, tests): |
| 121 filtered_tests = set() | 122 filtered_tests = set() |
| 122 if options.include_keyword: | 123 if options.include_keyword: |
| 123 for keyword in options.include_keyword: | 124 for keyword in options.include_keyword: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 135 for line in lines: | 136 for line in lines: |
| 136 output.append("%s,%s" % (port_name, line.to_csv())) | 137 output.append("%s,%s" % (port_name, line.to_csv())) |
| 137 elif lines: | 138 elif lines: |
| 138 include_modifiers = options.full | 139 include_modifiers = options.full |
| 139 include_expectations = options.full or len(options.include_keyword)
!= 1 or len(options.exclude_keyword) | 140 include_expectations = options.full or len(options.include_keyword)
!= 1 or len(options.exclude_keyword) |
| 140 output.append("// For %s" % port_name) | 141 output.append("// For %s" % port_name) |
| 141 for line in lines: | 142 for line in lines: |
| 142 output.append("%s" % line.to_string(None, include_modifiers, inc
lude_expectations, include_comment=False)) | 143 output.append("%s" % line.to_string(None, include_modifiers, inc
lude_expectations, include_comment=False)) |
| 143 return output | 144 return output |
| 144 | 145 |
| 145 def _model(self, options, port_name, tests): | |
| 146 port = self._tool.port_factory.get(port_name, options) | |
| 147 return TestExpectations(port, tests).model() | |
| 148 | |
| 149 | 146 |
| 150 class PrintBaselines(Command): | 147 class PrintBaselines(Command): |
| 151 name = 'print-baselines' | 148 name = 'print-baselines' |
| 152 help_text = 'Prints the baseline locations for given test(s) on the given po
rt(s)' | 149 help_text = 'Prints the baseline locations for given test(s) on the given po
rt(s)' |
| 153 show_in_main_help = True | 150 show_in_main_help = True |
| 154 | 151 |
| 155 def __init__(self): | 152 def __init__(self): |
| 156 options = [ | 153 options = [ |
| 157 make_option('--all', action='store_true', default=False, | 154 make_option('--all', action='store_true', default=False, |
| 158 help='display the baselines for *all* tests'), | 155 help='display the baselines for *all* tests'), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 print "%s,%s,%s,%s,%s,%s" % (port_name, test_name, self._pla
tform_for_path(test_name), | 196 print "%s,%s,%s,%s,%s,%s" % (port_name, test_name, self._pla
tform_for_path(test_name), |
| 200 extension[1:], baseline_locatio
n, self._platform_for_path(baseline_location)) | 197 extension[1:], baseline_locatio
n, self._platform_for_path(baseline_location)) |
| 201 else: | 198 else: |
| 202 print baseline_location | 199 print baseline_location |
| 203 | 200 |
| 204 def _platform_for_path(self, relpath): | 201 def _platform_for_path(self, relpath): |
| 205 platform_matchobj = self._platform_regexp.match(relpath) | 202 platform_matchobj = self._platform_regexp.match(relpath) |
| 206 if platform_matchobj: | 203 if platform_matchobj: |
| 207 return platform_matchobj.group(1) | 204 return platform_matchobj.group(1) |
| 208 return None | 205 return None |
| OLD | NEW |