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 28 matching lines...) Expand all Loading... | |
| 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 # TODO(ngeoffray): do something meaningful for debug. | 42 # TODO(ngeoffray): do something meaningful for debug. |
| 43 testpy_mode = 'release' | 43 testpy_mode = 'release' |
| 44 flags = None | 44 flags = None |
| 45 if mode == 'debug': | 45 if mode == 'debug': |
| 46 flags = '--checked' | 46 flags = '--checked' |
| 47 return (testpy_mode, flags) | 47 return (testpy_mode, flags) |
| 48 | 48 |
| 49 def TestStep(message, mode, component, targets, flags): | |
| 50 print '@@@BUILD_STEP %s: %s@@@' % (message, component) | |
| 51 if component == 'frogium': | |
| 52 cmd = ['xvfb-run'] | |
| 53 else: | |
| 54 cmd = [] | |
| 55 | |
| 56 cmd = (cmd | |
| 57 + [sys.executable, | |
| 58 '../tools/test.py', | |
| 59 '--mode=' + mode, | |
| 60 '--component=' + component, | |
| 61 '--time', | |
| 62 '--report', | |
| 63 '--progress=buildbot', | |
| 64 '-v'] | |
| 65 + targets) | |
| 66 if flags: | |
| 67 cmd.append(flags) | |
| 68 return subprocess.call(cmd) | |
| 69 | |
| 49 def TestFrog(arch, mode): | 70 def TestFrog(arch, mode): |
| 50 """ build and test frog. | 71 """ build and test frog. |
| 51 Args: | 72 Args: |
| 52 - arch: either 'frog' or 'frogsh' (frog self-hosted) | 73 - arch: either 'frog' or 'frogsh' (frog self-hosted) |
| 53 - mode: either 'debug' (with type checks) or 'release' (without) | 74 - mode: either 'debug' (with type checks) or 'release' (without) |
| 54 """ | 75 """ |
| 55 | 76 |
| 56 # Make sure we are in the frog directory | 77 # Make sure we are in the frog directory |
| 57 os.chdir(FROG_PATH) | 78 os.chdir(FROG_PATH) |
| 58 | |
| 59 testpy_mode, flags = ConvertConfiguration(arch, mode) | 79 testpy_mode, flags = ConvertConfiguration(arch, mode) |
| 60 | 80 |
| 61 print '@@@BUILD_STEP build frog@@@' | 81 print '@@@BUILD_STEP build frog@@@' |
| 62 status = subprocess.call( | 82 if subprocess.call( |
| 63 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode]) | 83 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode]) != 0: |
| 64 if status != 0: | 84 return 1 |
| 65 return status; | |
| 66 | 85 |
| 67 print ('@@@BUILD_STEP frog tests: %s@@@' % arch) | 86 if TestStep("frog tests", testpy_mode, arch, |
|
Emily Fortuna
2011/11/11 21:49:57
nit: move the word "tests" up into TestStep?
Siggi Cherem (dart-lang)
2011/11/11 22:20:19
:) Done
| |
| 68 cmd = [sys.executable, | 87 ['language', 'corelib', 'isolate', 'frog'], flags) != 0: |
| 69 '../tools/test.py', | 88 return 1 |
| 70 '--mode=' + testpy_mode, | |
| 71 '--component=' + arch, | |
| 72 '--time', | |
| 73 '--report', | |
| 74 '--progress=buildbot', | |
| 75 '-v', | |
| 76 'language', | |
| 77 'corelib', | |
| 78 'isolate', | |
| 79 'frog'] | |
| 80 if flags: | |
| 81 cmd.append(flags) | |
| 82 | 89 |
| 83 status = subprocess.call(cmd) | 90 if TestStep("leg only tests", testpy_mode, 'leg', ['leg_only'], flags) != 0: |
| 84 if status != 0: | 91 return 1 |
| 85 return status | |
| 86 | 92 |
| 87 print ('@@@BUILD_STEP leg only tests@@@') | 93 if (arch == 'frogsh' and |
| 88 cmd = [sys.executable, | 94 TestStep("client tests", testpy_mode, 'frogium', ['client'], flags) != 0): |
| 89 '../tools/test.py', | 95 return 1 |
| 90 '--mode=' + testpy_mode, | |
| 91 '--component=leg', | |
| 92 '--time', | |
| 93 '--report', | |
| 94 '--progress=buildbot', | |
| 95 '-v', | |
| 96 'leg_only'] | |
| 97 if flags: | |
| 98 cmd.append(flags) | |
| 99 | 96 |
| 100 status = subprocess.call(cmd) | 97 if TestStep("frog co19 tests", testpy_mode, arch, ['co19'], flags) != 0: |
| 101 if status != 0: | 98 return 1 |
| 102 return status | |
| 103 | 99 |
| 104 if arch == 'frogsh': | 100 return 0 |
| 105 print ('@@@BUILD_STEP client browser tests@@@') | |
| 106 cmd = ['xvfb-run', sys.executable, | |
| 107 '../tools/test.py', | |
| 108 '--mode=' + testpy_mode, | |
| 109 '--component=frogium', | |
| 110 '--time', | |
| 111 '--report', | |
| 112 '--progress=buildbot', | |
| 113 '-v', | |
| 114 'client'] | |
| 115 if flags: | |
| 116 cmd.append(flags) | |
| 117 | |
| 118 status = subprocess.call(cmd) | |
| 119 if status != 0: | |
| 120 return status | |
| 121 | |
| 122 print ('@@@BUILD_STEP frog co19 tests: %s@@@' %arch) | |
| 123 cmd = [sys.executable, | |
| 124 '../tools/test.py', | |
| 125 '--mode=' + testpy_mode, | |
| 126 '--component=' + arch, | |
| 127 '--time', | |
| 128 '--report', | |
| 129 '--progress=buildbot', | |
| 130 '-v', | |
| 131 'co19'] | |
| 132 if flags: | |
| 133 cmd.append(flags) | |
| 134 | |
| 135 return subprocess.call(cmd) | |
| 136 | 101 |
| 137 def main(): | 102 def main(): |
| 138 print 'main' | 103 print 'main' |
| 139 if len(sys.argv) == 0: | 104 if len(sys.argv) == 0: |
| 140 print 'Script pathname not known, giving up.' | 105 print 'Script pathname not known, giving up.' |
| 141 return 1 | 106 return 1 |
| 142 | 107 |
| 143 arch, mode = GetBuildInfo() | 108 arch, mode = GetBuildInfo() |
| 144 print "arch: %s, mode: %s" % (arch, mode) | 109 print "arch: %s, mode: %s" % (arch, mode) |
| 145 if arch is None: | 110 if arch is None: |
| 146 return 1 | 111 return 1 |
| 147 | 112 |
| 148 status = TestFrog(arch, mode) | 113 status = TestFrog(arch, mode) |
| 149 if status != 0: | 114 if status != 0: |
| 150 print '@@@STEP_FAILURE@@@' | 115 print '@@@STEP_FAILURE@@@' |
| 151 return status | 116 return status |
| 152 | 117 |
| 153 | 118 |
| 154 if __name__ == '__main__': | 119 if __name__ == '__main__': |
| 155 sys.exit(main()) | 120 sys.exit(main()) |
| OLD | NEW |