ba57b8898d
Now that we've got a checked-in binary for ARM we can directly drive the tests on the ARM buildbot. R=ricow@google.com Review URL: https://codereview.chromium.org//23441037 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27049 260f80e4-7a28-3924-810f-c04153c831b5
120 lines
3.7 KiB
Python
120 lines
3.7 KiB
Python
#!/usr/bin/python
|
|
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
import os
|
|
import re
|
|
import sys
|
|
|
|
import bot
|
|
|
|
GCS_BUCKET = 'gs://dart-cross-compiled-binaries'
|
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.append(os.path.join(SCRIPT_DIR, '..'))
|
|
|
|
import utils
|
|
|
|
CROSS_VM = r'cross-(arm)-vm-linux-(release)'
|
|
TARGET_VM = r'target-(arm)-vm-linux-(release)'
|
|
GSUTIL = utils.GetBuildbotGSUtilPath()
|
|
|
|
def run(args):
|
|
print 'Running: %s' % (' '.join(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))
|
|
|
|
def cross_compiling_builder(arch, mode):
|
|
build_py = os.path.join('tools', 'build.py')
|
|
|
|
tarball = tarball_name(arch, mode)
|
|
temporary_files = [tarball]
|
|
bot.Clobber()
|
|
try:
|
|
num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN'])
|
|
if num_run == 1:
|
|
with bot.BuildStep('Build %s %s' % (arch, mode)):
|
|
run([sys.executable, build_py,
|
|
'-m%s' % mode, '--arch=%s' % arch, 'runtime'])
|
|
# We need to build 'run_vm_tests.host' as well to enable
|
|
# test.py to list the VM tests.
|
|
run([sys.executable, build_py,
|
|
'-m%s' % mode, '--arch=%s' % arch, 'run_vm_tests.host'])
|
|
|
|
with bot.BuildStep('Create build tarball'):
|
|
run(['tar', '-cjf', tarball, '--exclude=**/obj',
|
|
'--exclude=**/obj.host', '--exclude=**/obj.target',
|
|
'--exclude=**/*analyzer*', '--exclude=**/run_vm_tests.host',
|
|
'out/'])
|
|
|
|
with bot.BuildStep('Upload build tarball'):
|
|
uri = "%s/%s" % (GCS_BUCKET, tarball)
|
|
run([GSUTIL, 'cp', tarball, uri])
|
|
run([GSUTIL, 'setacl', 'public-read', uri])
|
|
|
|
elif num_run == 2:
|
|
with bot.BuildStep('tests'):
|
|
print "Please see the target device for results."
|
|
print "We no longer record/replay tests."
|
|
else:
|
|
raise Exception("Invalid annotated steps run")
|
|
finally:
|
|
for path in temporary_files:
|
|
if os.path.exists(path):
|
|
os.remove(path)
|
|
|
|
def target_builder(arch, mode):
|
|
test_py = os.path.join('tools', 'test.py')
|
|
test_args = [sys.executable, test_py, '--progress=line', '--report',
|
|
'--time', '--compiler=none', '--runtime=vm', '--write-debug-log',
|
|
'--mode=' + mode, '--arch=' + arch]
|
|
|
|
tarball = tarball_name(arch, mode)
|
|
temporary_files = [tarball]
|
|
bot.Clobber()
|
|
try:
|
|
with bot.BuildStep('Fetch build tarball'):
|
|
run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball])
|
|
|
|
with bot.BuildStep('Unpack build tarball'):
|
|
run(['tar', '-xjf', tarball])
|
|
|
|
with bot.BuildStep('execute tests'):
|
|
run(test_args)
|
|
|
|
with bot.BuildStep('execute checked_tests'):
|
|
run(test_args + ['--checked'])
|
|
finally:
|
|
for path in temporary_files:
|
|
if os.path.exists(path):
|
|
os.remove(path)
|
|
|
|
def main():
|
|
name, is_buildbot = bot.GetBotName()
|
|
|
|
cross_vm_pattern_match = re.match(CROSS_VM, name)
|
|
target_vm_pattern_match = re.match(TARGET_VM, name)
|
|
if cross_vm_pattern_match:
|
|
arch = cross_vm_pattern_match.group(1)
|
|
mode = cross_vm_pattern_match.group(2)
|
|
cross_compiling_builder(arch, mode)
|
|
elif target_vm_pattern_match:
|
|
arch = target_vm_pattern_match.group(1)
|
|
mode = target_vm_pattern_match.group(2)
|
|
target_builder(arch, mode)
|
|
else:
|
|
raise Exception("Unknown builder name %s" % name)
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
sys.exit(main())
|
|
except OSError as e:
|
|
sys.exit(e.errno)
|