OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, the Fletch 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 Buildbot steps for fletch testing | 8 Buildbot steps for fletch testing |
9 """ | 9 """ |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 Run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) | 215 Run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) |
216 | 216 |
217 with bot.BuildStep('Unpack build tarball'): | 217 with bot.BuildStep('Unpack build tarball'): |
218 Run(['tar', '-xjf', tarball]) | 218 Run(['tar', '-xjf', tarball]) |
219 | 219 |
220 # Run tests on all necessary configurations. | 220 # Run tests on all necessary configurations. |
221 configurations = GetBuildConfigurations(system, [mode], [arch], [False]) | 221 configurations = GetBuildConfigurations(system, [mode], [arch], [False]) |
222 for snapshot_run in [True, False]: | 222 for snapshot_run in [True, False]: |
223 for configuration in configurations: | 223 for configuration in configurations: |
224 if not ShouldSkipConfiguration(snapshot_run, configuration): | 224 if not ShouldSkipConfiguration(snapshot_run, configuration): |
225 build_conf = configuration['build_conf'] | |
225 build_dir = configuration['build_dir'] | 226 build_dir = configuration['build_dir'] |
226 | 227 |
227 # Sanity check we got build artifacts which we expect. | 228 # Sanity check we got build artifacts which we expect. |
228 assert os.path.exists(os.path.join(build_dir, 'fletch-vm')) | 229 assert os.path.exists(os.path.join(build_dir, 'fletch-vm')) |
229 | 230 |
230 # TODO(kustermann): This is hackisch, but our current copying of the | 231 # TODO(kustermann): This is hackisch, but our current copying of the |
231 # dart binary makes this a requirement. | 232 # dart binary makes this a requirement. |
232 dart_arm = 'third_party/bin/linux/dart-arm' | 233 dart_arm = 'third_party/bin/linux/dart-arm' |
233 destination = os.path.join(build_dir, 'dart') | 234 destination = os.path.join(build_dir, 'dart') |
234 shutil.copyfile(dart_arm, destination) | 235 shutil.copyfile(dart_arm, destination) |
235 shutil.copymode(dart_arm, destination) | 236 shutil.copymode(dart_arm, destination) |
236 | 237 |
237 StepTest( | 238 def run(): |
238 configuration['build_conf'], | 239 StepTest( |
239 configuration['mode'], | 240 build_conf, |
240 configuration['arch'], | 241 configuration['mode'], |
241 clang=configuration['clang'], | 242 configuration['arch'], |
242 asan=configuration['asan'], | 243 clang=configuration['clang'], |
243 snapshot_run=snapshot_run, | 244 asan=configuration['asan'], |
244 debug_log=debug_log, | 245 snapshot_run=snapshot_run, |
245 configuration=configuration) | 246 debug_log=debug_log, |
247 configuration=configuration) | |
248 | |
249 RunWithCoreDumpArchiving(run, build_dir, build_conf) | |
246 finally: | 250 finally: |
247 if os.path.exists(tarball): | 251 if os.path.exists(tarball): |
248 os.remove(tarball) | 252 os.remove(tarball) |
249 | 253 |
250 # We always clobber this to save disk on the arm board. | 254 # We always clobber this to save disk on the arm board. |
251 bot.Clobber(force=True) | 255 bot.Clobber(force=True) |
252 | 256 |
253 | 257 |
254 #### Buildbot steps helper | 258 #### Buildbot steps helper |
255 | 259 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 def __exit__(self, *_): | 404 def __exit__(self, *_): |
401 resource.setrlimit(resource.RLIMIT_CORE, self._old_limits) | 405 resource.setrlimit(resource.RLIMIT_CORE, self._old_limits) |
402 | 406 |
403 class CoredumpArchiver(object): | 407 class CoredumpArchiver(object): |
404 def __init__(self, bucket, build_dir, conf): | 408 def __init__(self, bucket, build_dir, conf): |
405 self._bucket = bucket | 409 self._bucket = bucket |
406 self._build_dir = build_dir | 410 self._build_dir = build_dir |
407 self._conf = conf | 411 self._conf = conf |
408 | 412 |
409 def __enter__(self): | 413 def __enter__(self): |
410 # TODO(kustermann): Assert that the core pattern is correctly set (at least | 414 if utils.GuessOS() == 'linux': |
411 # on linux) | 415 core_pattern = open('/proc/sys/kernel/core_pattern').read() |
412 pass | 416 core_pattern_uses_pid = open('/proc/sys/kernel/core_uses_pid').read() |
417 | |
418 assert core_pattern == 'core' | |
kustermann
2015/08/25 09:08:25
I'm aware that the pattern could be made to includ
kustermann
2015/08/25 11:14:48
Also account for the newline in the file now.
| |
419 assert core_pattern_uses_pid == '1' | |
ricow1
2015/08/25 09:10:09
should we gracefully fail here, and just tell peop
kustermann
2015/08/25 11:14:48
I thought about it as well, but
* users are not ru
| |
413 | 420 |
414 def __exit__(self, *_): | 421 def __exit__(self, *_): |
415 coredumps = self._find_coredumps() | 422 coredumps = self._find_coredumps() |
416 if coredumps: | 423 if coredumps: |
417 print 'Archiving coredumps: %s' % ', '.join(coredumps) | 424 print 'Archiving coredumps: %s' % ', '.join(coredumps) |
418 sys.stdout.flush() | 425 sys.stdout.flush() |
419 self._archive(os.path.join(self._build_dir, 'fletch-vm'), coredumps) | 426 self._archive(os.path.join(self._build_dir, 'fletch-vm'), coredumps) |
420 | 427 |
421 def _find_coredumps(self): | 428 def _find_coredumps(self): |
422 # TODO(kustermann): Make this work for mac as well. | 429 # TODO(kustermann): Make this work for mac as well. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 print '@@@STEP_FAILURE@@@' | 542 print '@@@STEP_FAILURE@@@' |
536 else: | 543 else: |
537 print '@@@STEP_WARNINGS@@@' | 544 print '@@@STEP_WARNINGS@@@' |
538 sys.stdout.flush() | 545 sys.stdout.flush() |
539 | 546 |
540 if __name__ == '__main__': | 547 if __name__ == '__main__': |
541 # If main raises an exception we will get a very useful error message with | 548 # If main raises an exception we will get a very useful error message with |
542 # traceback written to stderr. We therefore intentionally do not catch | 549 # traceback written to stderr. We therefore intentionally do not catch |
543 # exceptions. | 550 # exceptions. |
544 Main() | 551 Main() |
OLD | NEW |