| 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 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 fh.close() | 218 fh.close() |
| 219 | 219 |
| 220 version = zip_url.split('/')[-2] | 220 version = zip_url.split('/')[-2] |
| 221 if not _GreaterVersion(version, _NEW_STYLE_VERSION) == version: | 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. | 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') | 223 old_style_touch_path = os.path.join(download_folder, '.use_e1000') |
| 224 fh = open(old_style_touch_path, 'w+') | 224 fh = open(old_style_touch_path, 'w+') |
| 225 fh.close() | 225 fh.close() |
| 226 | 226 |
| 227 | 227 |
| 228 def WipeDevServerCache(): |
| 229 """Wipes the cache of the dev server.""" |
| 230 RunCommand(['sudo', |
| 231 './start_devserver', |
| 232 '--clear_cache', |
| 233 '--exit', |
| 234 ], enter_chroot=True) |
| 235 |
| 236 |
| 228 def RunAUTestHarness(board, channel, latest_url_base, zip_server_base, | 237 def RunAUTestHarness(board, channel, latest_url_base, zip_server_base, |
| 229 no_graphics, type, remote): | 238 no_graphics, type, remote): |
| 230 """Runs the auto update test harness. | 239 """Runs the auto update test harness. |
| 231 | 240 |
| 232 The auto update test harness encapsulates testing the auto-update mechanism | 241 The auto update test harness encapsulates testing the auto-update mechanism |
| 233 for the latest image against the latest official image from the channel. This | 242 for the latest image against the latest official image from the channel. This |
| 234 also tests images with suite_Smoke (built-in as part of its verification | 243 also tests images with suite_Smoke (built-in as part of its verification |
| 235 process). | 244 process). |
| 236 | 245 |
| 237 Args: | 246 Args: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 267 '--remote=%s' % remote, | 276 '--remote=%s' % remote, |
| 268 ], cwd=crosutils_root) | 277 ], cwd=crosutils_root) |
| 269 | 278 |
| 270 | 279 |
| 271 def main(): | 280 def main(): |
| 272 parser = optparse.OptionParser() | 281 parser = optparse.OptionParser() |
| 273 parser.add_option('-b', '--board', | 282 parser.add_option('-b', '--board', |
| 274 help='board for the image to compare against.') | 283 help='board for the image to compare against.') |
| 275 parser.add_option('-c', '--channel', | 284 parser.add_option('-c', '--channel', |
| 276 help='channel for the image to compare against.') | 285 help='channel for the image to compare against.') |
| 286 parser.add_option('--cache', default=False, action='store_true', |
| 287 help='Cache payloads') |
| 277 parser.add_option('-l', '--latestbase', | 288 parser.add_option('-l', '--latestbase', |
| 278 help='Base url for latest links.') | 289 help='Base url for latest links.') |
| 279 parser.add_option('-z', '--zipbase', | 290 parser.add_option('-z', '--zipbase', |
| 280 help='Base url for hosted images.') | 291 help='Base url for hosted images.') |
| 281 parser.add_option('--no_graphics', action='store_true', default=False, | 292 parser.add_option('--no_graphics', action='store_true', default=False, |
| 282 help='Disable graphics for the vm test.') | 293 help='Disable graphics for the vm test.') |
| 283 parser.add_option('--type', default='vm', | 294 parser.add_option('--type', default='vm', |
| 284 help='type of test to run: [vm, real]. Default: vm.') | 295 help='type of test to run: [vm, real]. Default: vm.') |
| 285 parser.add_option('--remote', default='0.0.0.0', | 296 parser.add_option('--remote', default='0.0.0.0', |
| 286 help='For real tests, ip address of the target machine.') | 297 help='For real tests, ip address of the target machine.') |
| 287 | 298 |
| 288 # Set the usage to include flags. | 299 # Set the usage to include flags. |
| 289 parser.set_usage(parser.format_help()) | 300 parser.set_usage(parser.format_help()) |
| 290 (options, args) = parser.parse_args() | 301 (options, args) = parser.parse_args() |
| 291 | 302 |
| 292 if args: | 303 if args: |
| 293 parser.error('Extra args found %s.' % args) | 304 parser.error('Extra args found %s.' % args) |
| 294 | 305 |
| 295 if not options.board: | 306 if not options.board: |
| 296 parser.error('Need board for image to compare against.') | 307 parser.error('Need board for image to compare against.') |
| 297 | 308 |
| 298 if not options.channel: | 309 if not options.channel: |
| 299 parser.error('Need channel for image to compare against.') | 310 parser.error('Need channel for image to compare against.') |
| 300 | 311 |
| 301 if not options.zipbase: | 312 if not options.zipbase: |
| 302 parser.error('Need zip url base to get images.') | 313 parser.error('Need zip url base to get images.') |
| 303 | 314 |
| 315 if not options.cache: |
| 316 Info('Wiping dev server cache.') |
| 317 WipeDevServerCache() |
| 318 |
| 304 RunAUTestHarness(options.board, options.channel, options.latestbase, | 319 RunAUTestHarness(options.board, options.channel, options.latestbase, |
| 305 options.zipbase, options.no_graphics, options.type, | 320 options.zipbase, options.no_graphics, options.type, |
| 306 options.remote) | 321 options.remote) |
| 307 | 322 |
| 308 | 323 |
| 309 if __name__ == '__main__': | 324 if __name__ == '__main__': |
| 310 main() | 325 main() |
| 311 | 326 |
| OLD | NEW |