OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 3 # Copyright (C) 2013 Adobe Systems Incorporated. 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 | 6 # modification, are permitted provided that the following conditions |
7 # are met: | 7 # are met: |
8 # | 8 # |
9 # 1. Redistributions of source code must retain the above | 9 # 1. Redistributions of source code must retain the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 import datetime | 91 import datetime |
92 import logging | 92 import logging |
93 import mimetypes | 93 import mimetypes |
94 import optparse | 94 import optparse |
95 import os | 95 import os |
96 import shutil | 96 import shutil |
97 import sys | 97 import sys |
98 | 98 |
99 from webkitpy.common.host import Host | 99 from webkitpy.common.host import Host |
| 100 from webkitpy.common.webkit_finder import WebKitFinder |
100 from webkitpy.common.system.executive import ScriptError | 101 from webkitpy.common.system.executive import ScriptError |
101 from webkitpy.w3c.test_parser import TestParser | 102 from webkitpy.w3c.test_parser import TestParser |
102 from webkitpy.w3c.test_converter import W3CTestConverter | 103 from webkitpy.w3c.test_converter import W3CTestConverter |
103 | 104 |
104 | 105 |
105 TEST_STATUS_UNKNOWN = 'unknown' | 106 TEST_STATUS_UNKNOWN = 'unknown' |
106 TEST_STATUS_APPROVED = 'approved' | 107 TEST_STATUS_APPROVED = 'approved' |
107 TEST_STATUS_SUBMITTED = 'submitted' | 108 TEST_STATUS_SUBMITTED = 'submitted' |
108 | 109 |
109 CHANGESET_NOT_AVAILABLE = 'Not Available' | 110 CHANGESET_NOT_AVAILABLE = 'Not Available' |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 166 |
166 class TestImporter(object): | 167 class TestImporter(object): |
167 | 168 |
168 def __init__(self, host, source_directory, repo_dir, options): | 169 def __init__(self, host, source_directory, repo_dir, options): |
169 self.host = host | 170 self.host = host |
170 self.source_directory = source_directory | 171 self.source_directory = source_directory |
171 self.options = options | 172 self.options = options |
172 | 173 |
173 self.filesystem = self.host.filesystem | 174 self.filesystem = self.host.filesystem |
174 | 175 |
175 self._webkit_root = __file__.split(self.filesystem.sep + 'Tools')[0] | 176 webkit_finder = WebKitFinder(self.filesystem) |
| 177 self._webkit_root = webkit_finder.webkit_base() |
176 self.repo_dir = repo_dir | 178 self.repo_dir = repo_dir |
177 subdirs = os.path.dirname(os.path.relpath(source_directory, repo_dir)) | 179 subdirs = os.path.dirname(os.path.relpath(source_directory, repo_dir)) |
178 | 180 |
179 self.destination_directory = os.path.join(self.path_from_webkit_root("La
youtTests"), 'w3c', subdirs) | 181 self.destination_directory = webkit_finder.path_from_webkit_base("Layout
Tests", 'w3c', *subdirs) |
180 | 182 |
181 self.changeset = CHANGESET_NOT_AVAILABLE | 183 self.changeset = CHANGESET_NOT_AVAILABLE |
182 self.test_status = TEST_STATUS_UNKNOWN | 184 self.test_status = TEST_STATUS_UNKNOWN |
183 | 185 |
184 self.import_list = [] | 186 self.import_list = [] |
185 | 187 |
186 def path_from_webkit_root(self, *comps): | |
187 return self.filesystem.abspath(self.filesystem.join(self._webkit_root, *
comps)) | |
188 | |
189 def do_import(self): | 188 def do_import(self): |
190 self.find_importable_tests(self.source_directory) | 189 self.find_importable_tests(self.source_directory) |
191 self.load_changeset() | 190 self.load_changeset() |
192 self.import_tests() | 191 self.import_tests() |
193 | 192 |
194 def load_changeset(self): | 193 def load_changeset(self): |
195 """Returns the current changeset from mercurial or "Not Available".""" | 194 """Returns the current changeset from mercurial or "Not Available".""" |
196 try: | 195 try: |
197 self.changeset = self.host.executive.run_command(['hg', 'tip']).spli
t('changeset:')[1] | 196 self.changeset = self.host.executive.run_command(['hg', 'tip']).spli
t('changeset:')[1] |
198 except (OSError, ScriptError): | 197 except (OSError, ScriptError): |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 for prop in prop_list: | 441 for prop in prop_list: |
443 import_log.write(prop + '\n') | 442 import_log.write(prop + '\n') |
444 else: | 443 else: |
445 import_log.write('None\n') | 444 import_log.write('None\n') |
446 import_log.write('------------------------------------------------------
------------------\n') | 445 import_log.write('------------------------------------------------------
------------------\n') |
447 import_log.write('List of files:\n') | 446 import_log.write('List of files:\n') |
448 for item in file_list: | 447 for item in file_list: |
449 import_log.write(item + '\n') | 448 import_log.write(item + '\n') |
450 | 449 |
451 import_log.close() | 450 import_log.close() |
OLD | NEW |