Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Dart frog buildbot steps | 7 """Dart frog buildbot steps |
| 8 | 8 |
| 9 Runs tests for the frog compiler (running on the vm or the self-hosting version) | 9 Runs tests for the frog compiler (running on the vm or the self-hosting version) |
| 10 """ | 10 """ |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 pattern = re.match(BUILDER_PATTERN, builder_name) | 32 pattern = re.match(BUILDER_PATTERN, builder_name) |
| 33 if pattern: | 33 if pattern: |
| 34 name = pattern.group(1) | 34 name = pattern.group(1) |
| 35 mode = pattern.group(2) | 35 mode = pattern.group(2) |
| 36 return (name, mode) | 36 return (name, mode) |
| 37 | 37 |
| 38 # TODO(sigmund): delete this convertion when test.py uses the same | 38 # TODO(sigmund): delete this convertion when test.py uses the same |
| 39 # configuration we do here. | 39 # configuration we do here. |
| 40 def ConvertConfiguration(arch, mode): | 40 def ConvertConfiguration(arch, mode): |
| 41 ''' Convert arch/mode into modes/flags for test.py ''' | 41 ''' Convert arch/mode into modes/flags for test.py ''' |
| 42 if arch == 'frog': | 42 # TODO(ngeoffray): do something meaningful for debug. |
| 43 testpy_mode = 'debug' | 43 testpy_mode = 'release' |
| 44 else: | |
| 45 testpy_mode = 'release' | |
| 46 flags = None | 44 flags = None |
| 47 if mode == 'debug': | 45 if mode == 'debug': |
| 48 flags = '--enable_asserts --enable_type_checks' | 46 flags = '--enable_asserts --enable_type_checks' |
| 49 return (testpy_mode, flags) | 47 return (testpy_mode, flags) |
| 50 | 48 |
| 51 def TestFrog(arch, mode): | 49 def TestFrog(arch, mode): |
| 52 """ build and test frog. | 50 """ build and test frog. |
| 53 Args: | 51 Args: |
| 54 - arch: either 'frog' or 'frogsh' (frog self-hosted) | 52 - arch: either 'frog' or 'frogsh' (frog self-hosted) |
| 55 - mode: either 'debug' (with type checks) or 'release' (without) | 53 - mode: either 'debug' (with type checks) or 'release' (without) |
| 56 """ | 54 """ |
| 57 | 55 |
| 58 # first build the vm, so we can build and run frog: | 56 # Make sure we are in the frog directory |
| 59 PROJECT_PATH = os.path.dirname(FROG_PATH) | |
| 60 os.chdir(PROJECT_PATH) | |
| 61 print '@@@BUILD_STEP build vm@@@' | |
| 62 status = subprocess.call([sys.executable, | |
| 63 './tools/build.py', '--mode=release', '--arch=ia32', 'dart_bin']) | |
| 64 if status != 0: | |
| 65 return status; | |
| 66 | |
| 67 os.chdir(FROG_PATH) | 57 os.chdir(FROG_PATH) |
| 68 | 58 |
| 69 testpy_mode, flags = ConvertConfiguration(arch, mode) | 59 testpy_mode, flags = ConvertConfiguration(arch, mode) |
| 70 | 60 |
| 71 # create the sym link to the vm, if needed | |
| 72 if not os.path.exists('bin/dart_bin'): | |
| 73 print '@@@BUILD_STEP link vm@@@' | |
| 74 if not os.path.exists('bin'): | |
| 75 os.mkdir('bin') | |
| 76 status = subprocess.call( | |
| 77 ['ln', '-s', | |
| 78 os.path.abspath( | |
| 79 os.path.join(PROJECT_PATH, 'out', 'Release_ia32', 'dart_bin')), | |
| 80 os.path.join(FROG_PATH, 'bin', 'dart_bin')]) | |
| 81 if status != 0: | |
| 82 return status; | |
| 83 | |
| 84 print '@@@BUILD_STEP build frog@@@' | 61 print '@@@BUILD_STEP build frog@@@' |
| 85 # delete old copy to ensure that we rebuild it when the vm changes. | |
| 86 if testpy_mode == 'release': | |
| 87 old_binary = 'out/Release_ia32/dart_bin' | |
| 88 else: | |
| 89 old_binary = 'out/Debug_ia32/dart_bin' | |
| 90 print 'deleting ' + old_binary | |
| 91 status = subprocess.call(['rm', old_binary]) | |
|
Siggi Cherem (dart-lang)
2011/11/03 15:58:18
just to make sure I follow - this is not needed be
ngeoffray
2011/11/03 16:12:55
Yes, that's correct :)
| |
| 92 status = subprocess.call( | 62 status = subprocess.call( |
| 93 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode]) | 63 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode]) |
| 94 if status != 0: | 64 if status != 0: |
| 95 return status; | 65 return status; |
| 96 | 66 |
| 97 print ('@@@BUILD_STEP frog tests: %s@@@' % arch) | 67 print ('@@@BUILD_STEP frog tests: %s@@@' % arch) |
| 98 cmd = [sys.executable, '../tools/test.py', | 68 cmd = [sys.executable, |
| 99 '--mode=' + testpy_mode, | 69 '../tools/test.py', |
| 100 '--time', '--report', '--progress=buildbot', '-v', 'frog'] | 70 '--mode=' + testpy_mode, |
| 71 '--component=' + arch, | |
| 72 '--time', | |
| 73 '--report', | |
| 74 '--progress=buildbot', | |
| 75 '-v', | |
| 76 'language', | |
| 77 'corelib'] | |
| 101 if flags: | 78 if flags: |
| 102 cmd.append('--flag=' + flags) | 79 cmd.append('--flag=' + flags) |
| 103 return subprocess.call(cmd) | 80 return subprocess.call(cmd) |
| 104 | 81 |
| 105 def main(): | 82 def main(): |
| 106 print 'main' | 83 print 'main' |
| 107 if len(sys.argv) == 0: | 84 if len(sys.argv) == 0: |
| 108 print 'Script pathname not known, giving up.' | 85 print 'Script pathname not known, giving up.' |
| 109 return 1 | 86 return 1 |
| 110 | 87 |
| 111 arch, mode = GetBuildInfo() | 88 arch, mode = GetBuildInfo() |
| 112 print "arch: %s, mode: %s" % (arch, mode) | 89 print "arch: %s, mode: %s" % (arch, mode) |
| 113 if arch is None: | 90 if arch is None: |
| 114 return 1 | 91 return 1 |
| 115 | 92 |
| 116 status = TestFrog(arch, mode) | 93 status = TestFrog(arch, mode) |
| 117 if status != 0: | 94 if status != 0: |
| 118 print '@@@STEP_FAILURE@@@' | 95 print '@@@STEP_FAILURE@@@' |
| 119 return status | 96 return status |
| 120 | 97 |
| 121 | 98 |
| 122 if __name__ == '__main__': | 99 if __name__ == '__main__': |
| 123 sys.exit(main()) | 100 sys.exit(main()) |
| OLD | NEW |