OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, 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 """ | 7 """ |
8 Pub buildbot steps. | 8 Pub buildbot steps. |
9 | 9 |
10 Runs tests for pub and the pub packages that are hosted in the main Dart repo. | 10 Runs tests for pub and the pub packages that are hosted in the main Dart repo. |
11 """ | 11 """ |
12 | 12 |
13 import os | |
13 import re | 14 import re |
15 import shutil | |
14 import sys | 16 import sys |
15 | 17 |
16 import bot | 18 import bot |
19 import bot_utils | |
17 | 20 |
18 PUB_BUILDER = r'pub-(linux|mac|win)(-(russian))?(-(debug))?' | 21 utils = bot_utils.GetUtils() |
22 | |
23 BUILD_OS = utils.GuessOS() | |
24 | |
25 PUB_BUILDER = r'pub-(linux|mac|win)' | |
19 | 26 |
20 def PubConfig(name, is_buildbot): | 27 def PubConfig(name, is_buildbot): |
21 """Returns info for the current buildbot based on the name of the builder. | 28 """Returns info for the current buildbot based on the name of the builder. |
22 | 29 |
23 Currently, this is just: | 30 Currently, this is just: |
24 - mode: "debug", "release" | 31 - mode: always release, we don't run pub in debug mode |
25 - system: "linux", "mac", or "win" | 32 - system: "linux", "mac", or "win" |
33 - checked: always true | |
26 """ | 34 """ |
27 pub_pattern = re.match(PUB_BUILDER, name) | 35 pub_pattern = re.match(PUB_BUILDER, name) |
28 if not pub_pattern: | 36 if not pub_pattern: |
29 return None | 37 return None |
30 | 38 |
31 system = pub_pattern.group(1) | 39 system = pub_pattern.group(1) |
32 locale = pub_pattern.group(3) | 40 mode = 'release' |
33 mode = pub_pattern.group(5) or 'release' | |
34 if system == 'win': system = 'windows' | 41 if system == 'win': system = 'windows' |
35 | 42 |
36 return bot.BuildInfo('none', 'vm', mode, system, checked=True, | 43 return bot.BuildInfo('none', 'vm', mode, system, checked=True) |
37 builder_tag=locale) | 44 |
45 def Run(command): | |
46 print "Running %s" % ' '.join(command) | |
47 return bot.RunProcess(command) | |
38 | 48 |
39 def PubSteps(build_info): | 49 def PubSteps(build_info): |
40 with bot.BuildStep('Build package-root'): | 50 sdk_bin = os.path.join( |
41 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, | 51 bot_utils.DART_DIR, |
42 'packages'] | 52 utils.GetBuildSdkBin(BUILD_OS, build_info.mode, build_info.arch)) |
43 print 'Building package-root: %s' % (' '.join(args)) | 53 pub_script_name = 'pub.bat' if build_info.system == 'windows' else 'pub' |
44 bot.RunProcess(args) | 54 pub_bin = os.path.join(sdk_bin, pub_script_name) |
45 | 55 |
46 common_args = ['--write-test-outcome-log'] | 56 pub_copy = os.path.join(utils.GetBuildRoot('linux'), 'pub_copy') |
47 if build_info.builder_tag: | 57 pub_location = os.path.join('third_party', 'pkg', 'pub') |
48 common_args.append('--builder-tag=%s' % build_info.builder_tag) | |
49 | 58 |
50 # There are a number of big/integration tests in pkg, run with bigger timeout | 59 with bot.BuildStep('Make copy of pub for testing'): |
51 common_args.append('--timeout=120') | 60 print 'Removing old copy %s' % pub_copy |
52 # We have some unreproducible vm crashes on these bots | 61 shutil.rmtree(pub_copy, ignore_errors=True) |
53 common_args.append('--copy-coredumps') | 62 print 'Copying %s to %s' % (pub_location, pub_copy) |
63 shutil.copytree(pub_location, pub_copy) | |
54 | 64 |
55 if build_info.system == 'windows': | 65 # TODO(nweiz): add logic for testing pub. |
56 common_args.append('-j1') | 66 with bot.BuildStep('Doing the magic ls'): |
57 if build_info.mode == 'release': | 67 with utils.ChangedWorkingDirectory(pub_copy): |
ricow1
2015/06/09 06:12:33
Added this, it is pretty useful instead of manuall
| |
58 bot.RunTest('pub and pkg ', build_info, | 68 Run(['ls', '-l']) |
59 common_args + ['pub', 'pkg', 'docs', 'pkg_tested'], | |
60 swallow_error=True) | |
61 else: | |
62 # Pub tests currently have a lot of timeouts when run in debug mode. | |
63 # See issue 18479 | |
64 bot.RunTest('pub and pkg', build_info, common_args + ['pkg', 'docs'], | |
65 swallow_error=True) | |
66 | 69 |
67 if build_info.mode == 'release': | 70 with bot.BuildStep('Running pub'): |
68 pkgbuild_build_info = bot.BuildInfo('none', 'vm', build_info.mode, | 71 Run([pub_bin, '--version']) |
69 build_info.system, checked=False) | |
70 bot.RunTest('pkgbuild_repo_pkgs', pkgbuild_build_info, | |
71 common_args + ['--append_logs', '--use-repository-packages', | |
72 'pkgbuild'], | |
73 swallow_error=True) | |
74 | 72 |
75 # We are seeing issues with pub get calls on the windows bots. | |
76 # Experiment with not running concurrent calls. | |
77 public_args = (common_args + | |
78 ['--append_logs', '--use-public-packages', 'pkgbuild']) | |
79 bot.RunTest('pkgbuild_public_pkgs', pkgbuild_build_info, public_args) | |
80 | 73 |
81 if __name__ == '__main__': | 74 if __name__ == '__main__': |
82 bot.RunBot(PubConfig, PubSteps) | 75 bot.RunBot(PubConfig, PubSteps) |
OLD | NEW |