Chromium Code Reviews| Index: tools/bots/cross-vm.py |
| diff --git a/tools/bots/cross-vm.py b/tools/bots/cross-vm.py |
| index e58c6c0f73f82e521bc0536f727e7daefc87e75a..e18a75b41398c02eecf742ec0a8d39353b906360 100644 |
| --- a/tools/bots/cross-vm.py |
| +++ b/tools/bots/cross-vm.py |
| @@ -26,10 +26,19 @@ def run(args): |
| sys.stdout.flush() |
| bot.RunProcess(args) |
| +def tarball_name(arch, mode): |
| + return 'cross_build_%s_%s.tar.bz2' % (arch, mode) |
| + |
| +def record_names(name, arch, mode): |
| + return ('record_%s_%s_%s.json' % (name, arch, mode), |
| + 'record_output_%s_%s_%s.json' % (name, arch, mode)) |
|
ricow1
2013/05/28 13:25:52
add blank line
kustermann
2013/05/28 13:39:09
Done.
|
| def main(): |
| name, is_buildbot = bot.GetBotName() |
| build_py = os.path.join('tools', 'build.py') |
| test_py = os.path.join('tools', 'test.py') |
| + execute_testcases_py = os.path.join('tools', 'execute_recorded_testcases.py') |
| + test_args = [sys.executable, test_py, '--progress=line', '--report', |
| + '--time', '--compiler=none', '--runtime=vm', '--write-debug-log'] |
| cross_vm_pattern_match = re.match(CROSS_VM, name) |
| target_vm_pattern_match = re.match(TARGET_VM, name) |
| @@ -37,36 +46,81 @@ def main(): |
| arch = cross_vm_pattern_match.group(1) |
| mode = cross_vm_pattern_match.group(2) |
| - bot.Clobber() |
| - with bot.BuildStep('Build %s %s' % (arch, mode)): |
| - args = [sys.executable, build_py, |
| - '-m%s' % mode, '--arch=%s' % arch, 'runtime'] |
| - run(args) |
| + tarball = tarball_name(arch, mode) |
| + (recording, recording_out) = record_names('tests', arch, mode) |
| + (checked_recording, checked_recording_out) = record_names( |
| + 'checked_tests', arch, mode) |
| - tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) |
| + temporary_files = [tarball, recording, recording_out, checked_recording, |
| + checked_recording_out] |
| + bot.Clobber() |
| try: |
| - with bot.BuildStep('Create build tarball'): |
| - run(['tar', '-cjf', tarball, '--exclude=**/obj', |
| - '--exclude=**/obj.host', '--exclude=**/obj.target', |
| - '--exclude=**/*analyzer*', 'out/']) |
| - |
| - with bot.BuildStep('Upload build tarball'): |
| - uri = "%s/%s" % (GCS_BUCKET, tarball) |
| - run([GSUTIL, 'cp', tarball, uri]) |
| - run([GSUTIL, 'setacl', 'public-read', uri]) |
| + num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN']) |
| + if num_run == 1: |
| + # FIXME(kustermann/ricow): Remove this hack as soon as our bots are |
|
ricow1
2013/05/28 13:25:52
how about extracting the body of both the branches
kustermann
2013/05/28 13:39:09
Done.
|
| + # running on precise (i.e. then we can install the normal crosscompiler) |
| + os.environ['TARGET_TOOLCHAIN_PREFIX'] = ('/home/chrome-bot/codesourcery' |
| + '/bin/arm-none-linux-gnueabi') |
| + with bot.BuildStep('Build %s %s' % (arch, mode)): |
| + args = [sys.executable, build_py, |
| + '-m%s' % mode, '--arch=%s' % arch, 'runtime'] |
| + |
| + run(args) |
| + with bot.BuildStep('Create build tarball'): |
| + run(['tar', '-cjf', tarball, '--exclude=**/obj', |
| + '--exclude=**/obj.host', '--exclude=**/obj.target', |
| + '--exclude=**/*analyzer*', 'out/']) |
| + |
| + with bot.BuildStep('Upload build tarball'): |
| + uri = "%s/%s" % (GCS_BUCKET, tarball) |
| + run([GSUTIL, 'cp', tarball, uri]) |
| + run([GSUTIL, 'setacl', 'public-read', uri]) |
| + |
| + with bot.BuildStep('prepare tests'): |
| + uri = "%s/%s" % (GCS_BUCKET, recording) |
| + run(test_args + ['--mode=' + mode, '--arch=' + arch, |
| + '--record_to_file=' + recording]) |
| + run([GSUTIL, 'cp', recording, uri]) |
| + run([GSUTIL, 'setacl', 'public-read', uri]) |
| + |
| + with bot.BuildStep('prepare checked_tests'): |
| + uri = "%s/%s" % (GCS_BUCKET, checked_recording) |
| + run(test_args + ['--mode=' + mode, '--arch=' + arch, '--checked', |
| + '--record_to_file=' + checked_recording]) |
| + run([GSUTIL, 'cp', checked_recording, uri]) |
| + run([GSUTIL, 'setacl', 'public-read', uri]) |
| + elif num_run == 2: |
| + with bot.BuildStep('tests'): |
| + uri = "%s/%s" % (GCS_BUCKET, recording) |
| + run([GSUTIL, 'cp', uri, recording]) |
| + run(test_args + ['--mode=' + mode, '--arch=' + arch, |
| + '--replay_from_file=' + recording_out]) |
| + |
| + with bot.BuildStep('checked_tests'): |
| + uri = "%s/%s" % (GCS_BUCKET, checked_recording) |
| + run([GSUTIL, 'cp', uri, checked_recording]) |
| + run(test_args + ['--mode=' + mode, '--arch=' + arch, '--checked', |
| + '--replay_from_file=' + checked_recording_out]) |
| + else: |
| + raise Exception("Invalid annotated steps run") |
| finally: |
| - if os.path.exists(tarball): |
| - os.remove(tarball) |
| + for path in temporary_files: |
| + if os.path.exists(path): |
| + pass |
| + os.remove(path) |
| elif target_vm_pattern_match: |
| arch = target_vm_pattern_match.group(1) |
| mode = target_vm_pattern_match.group(2) |
| + tarball = tarball_name(arch, mode) |
| + (recording, recording_out) = record_names('tests', arch, mode) |
| + (checked_recording, checked_recording_out) = record_names( |
| + 'checked_tests', arch, mode) |
| + |
| + temporary_files = [tarball, recording, recording_out, checked_recording, |
| + checked_recording_out] |
| bot.Clobber() |
| - tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) |
| try: |
| - test_args = [sys.executable, test_py, '--progress=line', '--report', |
| - '--time', '--mode=' + mode, '--arch=' + arch, '--compiler=none', |
| - '--runtime=vm', '--write-debug-log'] |
| with bot.BuildStep('Fetch build tarball'): |
| run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) |
| @@ -74,14 +128,27 @@ def main(): |
| with bot.BuildStep('Unpack build tarball'): |
| run(['tar', '-xjf', tarball]) |
| - with bot.BuildStep('tests'): |
| - run(test_args) |
| - |
| - with bot.BuildStep('checked_tests'): |
| - run(test_args + ['--checked']) |
| + with bot.BuildStep('execute tests'): |
| + uri = "%s/%s" % (GCS_BUCKET, recording) |
| + uri_out = "%s/%s" % (GCS_BUCKET, recording_out) |
| + run([GSUTIL, 'cp', uri, recording]) |
| + run(['python', execute_testcases_py, recording, recording_out]) |
| + run([GSUTIL, 'cp', recording_out, uri_out]) |
| + run([GSUTIL, 'setacl', 'public-read', uri_out]) |
| + |
| + with bot.BuildStep('execute checked_tests'): |
| + uri = "%s/%s" % (GCS_BUCKET, checked_recording) |
| + uri_out = "%s/%s" % (GCS_BUCKET, checked_recording_out) |
| + run([GSUTIL, 'cp', uri, checked_recording]) |
| + run(['python', execute_testcases_py, checked_recording, |
| + checked_recording_out]) |
| + run([GSUTIL, 'cp', recording_out, uri_out]) |
| + run([GSUTIL, 'setacl', 'public-read', uri_out]) |
| finally: |
| - if os.path.exists(tarball): |
| - os.remove(tarball) |
| + for path in : |
| + if os.path.exists(path): |
| + pass |
| + os.remove(path) |
| else: |
| raise Exception("Unknown builder name %s" % name) |