OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Wrapper for tests that are run on builders.""" | 7 """Wrapper for tests that are run on builders.""" |
8 | 8 |
9 import fileinput | 9 import fileinput |
10 import optparse | 10 import optparse |
11 import os | 11 import os |
12 import re | 12 import re |
13 import sys | 13 import sys |
14 import traceback | 14 import traceback |
15 import urllib | 15 import urllib |
16 import HTMLParser | 16 import HTMLParser |
17 | 17 |
18 sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) | 18 sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) |
19 from cros_build_lib import Info | 19 from cros_build_lib import Info |
20 from cros_build_lib import ReinterpretPathForChroot | 20 from cros_build_lib import ReinterpretPathForChroot |
21 from cros_build_lib import RunCommand | 21 from cros_build_lib import RunCommand |
22 from cros_build_lib import Warning | 22 from cros_build_lib import Warning |
23 | 23 |
24 _IMAGE_TO_EXTRACT = 'chromiumos_test_image.bin' | 24 _IMAGE_TO_EXTRACT = 'chromiumos_test_image.bin' |
| 25 _NEW_STYLE_VERSION = '0.9.131.0' |
25 | 26 |
26 class HTMLDirectoryParser(HTMLParser.HTMLParser): | 27 class HTMLDirectoryParser(HTMLParser.HTMLParser): |
27 """HTMLParser for parsing the default apache file index.""" | 28 """HTMLParser for parsing the default apache file index.""" |
28 | 29 |
29 def __init__(self, regex): | 30 def __init__(self, regex): |
30 HTMLParser.HTMLParser.__init__(self) | 31 HTMLParser.HTMLParser.__init__(self) |
31 self.regex_object = re.compile(regex) | 32 self.regex_object = re.compile(regex) |
32 self.link_list = [] | 33 self.link_list = [] |
33 | 34 |
34 def handle_starttag(self, tag, attrs): | 35 def handle_starttag(self, tag, attrs): |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 RunCommand(['unzip', '-d', download_folder, zip_path], | 210 RunCommand(['unzip', '-d', download_folder, zip_path], |
210 print_cmd=False, error_message='Failed to download %s' % zip_url) | 211 print_cmd=False, error_message='Failed to download %s' % zip_url) |
211 | 212 |
212 ModifyBootDesc(download_folder) | 213 ModifyBootDesc(download_folder) |
213 | 214 |
214 # Put url in version file so we don't have to do this every time. | 215 # Put url in version file so we don't have to do this every time. |
215 fh = open(versioned_url_path, 'w+') | 216 fh = open(versioned_url_path, 'w+') |
216 fh.write(zip_url) | 217 fh.write(zip_url) |
217 fh.close() | 218 fh.close() |
218 | 219 |
| 220 version = zip_url.split('/')[-2] |
| 221 if not _GreaterVersion(version, _NEW_STYLE_VERSION) == version: |
| 222 # If the version isn't ready for new style, touch file to use old style. |
| 223 old_style_touch_path = os.path.join(download_folder, '.use_e1000') |
| 224 fh = open(old_style_touch_path, 'w+') |
| 225 fh.close() |
| 226 |
219 | 227 |
220 def RunAUTestHarness(board, channel, latest_url_base, zip_server_base, | 228 def RunAUTestHarness(board, channel, latest_url_base, zip_server_base, |
221 no_graphics, type, remote): | 229 no_graphics, type, remote): |
222 """Runs the auto update test harness. | 230 """Runs the auto update test harness. |
223 | 231 |
224 The auto update test harness encapsulates testing the auto-update mechanism | 232 The auto update test harness encapsulates testing the auto-update mechanism |
225 for the latest image against the latest official image from the channel. This | 233 for the latest image against the latest official image from the channel. This |
226 also tests images with suite_Smoke (built-in as part of its verification | 234 also tests images with suite_Smoke (built-in as part of its verification |
227 process). | 235 process). |
228 | 236 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 options.remote) | 306 options.remote) |
299 | 307 |
300 | 308 |
301 if __name__ == '__main__': | 309 if __name__ == '__main__': |
302 try: | 310 try: |
303 main() | 311 main() |
304 except Exception: | 312 except Exception: |
305 print "Got exception." | 313 print "Got exception." |
306 traceback.print_exc(file=sys.stdout) | 314 traceback.print_exc(file=sys.stdout) |
307 | 315 |
OLD | NEW |