OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 import imp | 7 import imp |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 shutil.copy(dart_controller, test_controller) | 297 shutil.copy(dart_controller, test_controller) |
298 else: | 298 else: |
299 print "No unittest to patch, do you even have tests" | 299 print "No unittest to patch, do you even have tests" |
300 | 300 |
301 JS_RUNTIMES = { | 301 JS_RUNTIMES = { |
302 'windows': ['ff', 'chrome', 'ie10'], | 302 'windows': ['ff', 'chrome', 'ie10'], |
303 'linux': ['d8', 'jsshell', 'ff', 'chrome'], | 303 'linux': ['d8', 'jsshell', 'ff', 'chrome'], |
304 'mac': ['safari'], | 304 'mac': ['safari'], |
305 } | 305 } |
306 | 306 |
| 307 is_first_test_run = True |
| 308 def LogsArgument(): |
| 309 global is_first_test_run |
| 310 if is_first_test_run: |
| 311 is_first_test_run = False |
| 312 return [] |
| 313 return ['--append_logs'] |
| 314 |
307 def RunPackageTesting(bot_info, package_path, folder='test'): | 315 def RunPackageTesting(bot_info, package_path, folder='test'): |
308 package_name = os.path.basename(package_path) | 316 package_name = os.path.basename(package_path) |
309 if package_name == '': | 317 if package_name == '': |
310 # when package_path had a trailing slash | 318 # when package_path had a trailing slash |
311 package_name = os.path.basename(os.path.dirname(package_path)) | 319 package_name = os.path.basename(os.path.dirname(package_path)) |
312 package_root = os.path.join(package_path, folder, 'packages') | 320 package_root = os.path.join(package_path, folder, 'packages') |
313 | 321 |
314 # Note: we use package_name/package_name/folder and not package_name/folder on | 322 # Note: we use package_name/package_name/folder and not package_name/folder on |
315 # purpose. The first package_name denotes the suite, the second is part of the | 323 # purpose. The first package_name denotes the suite, the second is part of the |
316 # path we want to match. Without the second package_name, we may match tests | 324 # path we want to match. Without the second package_name, we may match tests |
317 # that contain "folder" further down. So if folder is "test", | 325 # that contain "folder" further down. So if folder is "test", |
318 # "package_name/test" matches "package_name/build/test", but | 326 # "package_name/test" matches "package_name/build/test", but |
319 # "package_name/package_name/test" does not. | 327 # "package_name/package_name/test" does not. |
320 standard_args = ['--suite-dir=%s' % package_path, | 328 standard_args = ['--suite-dir=%s' % package_path, |
321 '--use-sdk', '--report', '--progress=buildbot', | 329 '--use-sdk', '--report', '--progress=buildbot', |
322 '--clear_browser_cache', | 330 '--clear_browser_cache', |
323 '--package-root=%s' % package_root, | 331 '--package-root=%s' % package_root, |
324 '--write-debug-log', '-v', | 332 '--write-debug-log', '-v', |
325 '--time', | 333 '--time', |
326 '%s/%s/%s/' % (package_name, package_name, folder)] | 334 '%s/%s/%s/' % (package_name, package_name, folder)] |
327 system = bot_info.system | 335 system = bot_info.system |
328 xvfb_command = ['xvfb-run', '-a', '--server-args=-screen 0 1024x768x24'] | 336 xvfb_command = ['xvfb-run', '-a', '--server-args=-screen 0 1024x768x24'] |
329 xvfb_args = xvfb_command if system == 'linux' else [] | 337 xvfb_args = xvfb_command if system == 'linux' else [] |
330 suffix = ' under build' if folder == 'build/test' else '' | 338 suffix = ' under build' if folder == 'build/test' else '' |
331 with BuildStep('Test vm release mode%s' % suffix, swallow_error=True): | 339 with BuildStep('Test vm release mode%s' % suffix, swallow_error=True): |
332 args = [sys.executable, 'tools/test.py', | 340 args = [sys.executable, 'tools/test.py', |
333 '-mrelease', '-rvm', '-cnone'] + standard_args | 341 '-mrelease', '-rvm', '-cnone'] + standard_args |
| 342 args.extend(LogsArgument()) |
334 RunProcess(args) | 343 RunProcess(args) |
335 with BuildStep('Test analyzer%s' % suffix, swallow_error=True): | 344 with BuildStep('Test analyzer%s' % suffix, swallow_error=True): |
336 args = [sys.executable, 'tools/test.py', | 345 args = [sys.executable, 'tools/test.py', |
337 '-mrelease', '-rnone', '-cdart2analyzer'] + standard_args | 346 '-mrelease', '-rnone', '-cdart2analyzer'] + standard_args |
| 347 args.extend(LogsArgument()) |
338 RunProcess(args) | 348 RunProcess(args) |
339 if bot_info.system != 'windows': | 349 if bot_info.system != 'windows': |
340 with BuildStep('Test dartium%s' % suffix, swallow_error=True): | 350 with BuildStep('Test dartium%s' % suffix, swallow_error=True): |
341 test_args = [sys.executable, 'tools/test.py', | 351 test_args = [sys.executable, 'tools/test.py', |
342 '-mrelease', '-rdartium', '-cnone', '-j4'] | 352 '-mrelease', '-rdartium', '-cnone', '-j4'] |
343 args = xvfb_args + test_args + standard_args | 353 args = xvfb_args + test_args + standard_args |
| 354 args.extend(LogsArgument()) |
344 RunProcess(args) | 355 RunProcess(args) |
345 | 356 |
346 for runtime in JS_RUNTIMES[system]: | 357 for runtime in JS_RUNTIMES[system]: |
347 with BuildStep('dart2js-%s%s' % (runtime, suffix), swallow_error=True): | 358 with BuildStep('dart2js-%s%s' % (runtime, suffix), swallow_error=True): |
348 test_args = [sys.executable, 'tools/test.py', | 359 test_args = [sys.executable, 'tools/test.py', |
349 '-mrelease', '-r%s' % runtime, '-cdart2js', '-j4', | 360 '-mrelease', '-r%s' % runtime, '-cdart2js', '-j4', |
350 '--dart2js-batch'] | 361 '--dart2js-batch'] |
351 args = xvfb_args + test_args + standard_args | 362 args = xvfb_args + test_args + standard_args |
| 363 args.extend(LogsArgument()) |
352 RunProcess(args) | 364 RunProcess(args) |
353 | 365 |
354 | 366 |
355 def RunHooks(hooks, section_name): | 367 def RunHooks(hooks, section_name): |
356 for name, command in hooks.iteritems(): | 368 for name, command in hooks.iteritems(): |
357 with BuildStep('%s: %s' % (section_name, name), swallow_error=True): | 369 with BuildStep('%s: %s' % (section_name, name), swallow_error=True): |
358 RunProcess(command, shell=True) | 370 RunProcess(command, shell=True) |
359 | 371 |
360 def RunPrePubUpgradeHooks(test_config): | 372 def RunPrePubUpgradeHooks(test_config): |
361 RunHooks(test_config.get_pre_pub_upgrade_hooks(), "Pre pub upgrade hooks") | 373 RunHooks(test_config.get_pre_pub_upgrade_hooks(), "Pre pub upgrade hooks") |
(...skipping 26 matching lines...) Expand all Loading... |
388 RunPrePubBuildHooks(test_config) | 400 RunPrePubBuildHooks(test_config) |
389 RunPubBuild(bot_info, copy_path, 'web') | 401 RunPubBuild(bot_info, copy_path, 'web') |
390 RunPubBuild(bot_info, copy_path, 'test', 'debug') | 402 RunPubBuild(bot_info, copy_path, 'test', 'debug') |
391 RunPostPubBuildHooks(test_config) | 403 RunPostPubBuildHooks(test_config) |
392 FixupTestControllerJS(copy_path) | 404 FixupTestControllerJS(copy_path) |
393 | 405 |
394 RunPreTestHooks(test_config) | 406 RunPreTestHooks(test_config) |
395 RunPackageTesting(bot_info, copy_path, 'test') | 407 RunPackageTesting(bot_info, copy_path, 'test') |
396 RunPackageTesting(bot_info, copy_path, 'build/test') | 408 RunPackageTesting(bot_info, copy_path, 'build/test') |
397 RunPostTestHooks(test_config) | 409 RunPostTestHooks(test_config) |
OLD | NEW |