Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: tools/bots/fletch.py

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/bots/dartino_namer.py ('k') | tools/bots/fletch_namer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file 3 # Copyright (c) 2014, the Dartino 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 dartino testing
9 """ 9 """
10 10
11 import glob 11 import glob
12 import os 12 import os
13 import re 13 import re
14 import shutil 14 import shutil
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 import tempfile 17 import tempfile
18 import time 18 import time
19 import uuid 19 import uuid
20 20
21 # The resource package does not exist on Windows but its functionality is not 21 # The resource package does not exist on Windows but its functionality is not
22 # used there, either. 22 # used there, either.
23 try: 23 try:
24 import resource 24 import resource
25 except ImportError: 25 except ImportError:
26 resource = None; 26 resource = None;
27 27
28 import bot 28 import bot
29 import bot_utils 29 import bot_utils
30 import fletch_namer 30 import dartino_namer
31 31
32 from os.path import dirname 32 from os.path import dirname
33 33
34 utils = bot_utils.GetUtils() 34 utils = bot_utils.GetUtils()
35 35
36 DEBUG_LOG=".debug.log" 36 DEBUG_LOG=".debug.log"
37 37
38 GCS_COREDUMP_BUCKET = 'fletch-buildbot-coredumps' 38 GCS_COREDUMP_BUCKET = 'fletch-buildbot-coredumps'
39 39
40 FLETCH_REGEXP = (r'fletch-' 40 DARTINO_REGEXP = (r'fletch-'
41 r'(?P<system>linux|mac|win|lk|free-rtos)' 41 r'(?P<system>linux|mac|win|lk|free-rtos)'
42 r'(?P<partial_configuration>' 42 r'(?P<partial_configuration>'
43 r'-(?P<mode>debug|release)' 43 r'-(?P<mode>debug|release)'
44 r'(?P<asan>-asan)?' 44 r'(?P<asan>-asan)?'
45 r'(?P<embedded_libs>-embedded-libs)?' 45 r'(?P<embedded_libs>-embedded-libs)?'
46 r'-(?P<architecture>x86|arm|x64|ia32)' 46 r'-(?P<architecture>x86|arm|x64|ia32)'
47 r')?' 47 r')?'
48 r'(?P<sdk>-sdk)?') 48 r'(?P<sdk>-sdk)?')
49 CROSS_REGEXP = r'cross-fletch-(linux)-(arm)' 49 CROSS_REGEXP = r'cross-fletch-(linux)-(arm)'
50 TARGET_REGEXP = r'target-fletch-(linux)-(debug|release)-(arm)' 50 TARGET_REGEXP = r'target-fletch-(linux)-(debug|release)-(arm)'
51 51
52 FLETCH_PATH = dirname(dirname(dirname(os.path.abspath(__file__)))) 52 DARTINO_PATH = dirname(dirname(dirname(os.path.abspath(__file__))))
53 GSUTIL = utils.GetBuildbotGSUtilPath() 53 GSUTIL = utils.GetBuildbotGSUtilPath()
54 54
55 GCS_BUCKET = 'gs://fletch-cross-compiled-binaries' 55 GCS_BUCKET = 'gs://dartino-cross-compiled-binaries'
56 56
57 MACOS_NUMBER_OF_FILES = 10000 57 MACOS_NUMBER_OF_FILES = 10000
58 58
59 def Run(args): 59 def Run(args):
60 print "Running: %s" % ' '.join(args) 60 print "Running: %s" % ' '.join(args)
61 sys.stdout.flush() 61 sys.stdout.flush()
62 bot.RunProcess(args) 62 bot.RunProcess(args)
63 63
64 def SetupClangEnvironment(system): 64 def SetupClangEnvironment(system):
65 if system != 'win32': 65 if system != 'win32':
66 os.environ['PATH'] = '%s/third_party/clang/%s/bin:%s' % ( 66 os.environ['PATH'] = '%s/third_party/clang/%s/bin:%s' % (
67 FLETCH_PATH, system, os.environ['PATH']) 67 DARTINO_PATH, system, os.environ['PATH'])
68 if system == 'macos': 68 if system == 'macos':
69 mac_library_path = "third_party/clang/mac/lib/clang/3.6.0/lib/darwin" 69 mac_library_path = "third_party/clang/mac/lib/clang/3.6.0/lib/darwin"
70 os.environ['DYLD_LIBRARY_PATH'] = '%s/%s' % (FLETCH_PATH, mac_library_path) 70 os.environ['DYLD_LIBRARY_PATH'] = '%s/%s' % (DARTINO_PATH, mac_library_path)
71 71
72 def SetupJavaEnvironment(system): 72 def SetupJavaEnvironment(system):
73 if system == 'macos': 73 if system == 'macos':
74 os.environ['JAVA_HOME'] = ( 74 os.environ['JAVA_HOME'] = (
75 '/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home') 75 '/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home')
76 elif system == 'linux': 76 elif system == 'linux':
77 os.environ['JAVA_HOME'] = '/usr/lib/jvm/java-7-openjdk-amd64' 77 os.environ['JAVA_HOME'] = '/usr/lib/jvm/java-7-openjdk-amd64'
78 78
79 def Main(): 79 def Main():
80 name, _ = bot.GetBotName() 80 name, _ = bot.GetBotName()
81 81
82 fletch_match = re.match(FLETCH_REGEXP, name) 82 dartino_match = re.match(DARTINO_REGEXP, name)
83 cross_match = re.match(CROSS_REGEXP, name) 83 cross_match = re.match(CROSS_REGEXP, name)
84 target_match = re.match(TARGET_REGEXP, name) 84 target_match = re.match(TARGET_REGEXP, name)
85 85
86 if not fletch_match and not cross_match and not target_match: 86 if not dartino_match and not cross_match and not target_match:
87 raise Exception('Invalid buildername') 87 raise Exception('Invalid buildername')
88 88
89 SetupClangEnvironment(utils.GuessOS()) 89 SetupClangEnvironment(utils.GuessOS())
90 SetupJavaEnvironment(utils.GuessOS()) 90 SetupJavaEnvironment(utils.GuessOS())
91 91
92 # Clobber build directory if the checkbox was pressed on the BB. 92 # Clobber build directory if the checkbox was pressed on the BB.
93 with utils.ChangedWorkingDirectory(FLETCH_PATH): 93 with utils.ChangedWorkingDirectory(DARTINO_PATH):
94 bot.Clobber() 94 bot.Clobber()
95 95
96 # Accumulate daemon logs messages in '.debug.log' to be displayed on the 96 # Accumulate daemon logs messages in '.debug.log' to be displayed on the
97 # buildbot.Log 97 # buildbot.Log
98 with open(DEBUG_LOG, 'w') as debug_log: 98 with open(DEBUG_LOG, 'w') as debug_log:
99 with utils.ChangedWorkingDirectory(FLETCH_PATH): 99 with utils.ChangedWorkingDirectory(DARTINO_PATH):
100 100
101 if fletch_match: 101 if dartino_match:
102 system = fletch_match.group('system') 102 system = dartino_match.group('system')
103 103
104 if system == 'lk': 104 if system == 'lk':
105 StepsLK(debug_log) 105 StepsLK(debug_log)
106 return 106 return
107 107
108 if system == 'free-rtos': 108 if system == 'free-rtos':
109 StepsFreeRtos(debug_log) 109 StepsFreeRtos(debug_log)
110 return 110 return
111 111
112 modes = ['debug', 'release'] 112 modes = ['debug', 'release']
113 archs = ['ia32', 'x64'] 113 archs = ['ia32', 'x64']
114 asans = [False] 114 asans = [False]
115 embedded_libs = [False] 115 embedded_libs = [False]
116 116
117 # Split configurations? 117 # Split configurations?
118 partial_configuration =\ 118 partial_configuration =\
119 fletch_match.group('partial_configuration') != None 119 dartino_match.group('partial_configuration') != None
120 if partial_configuration: 120 if partial_configuration:
121 architecture_match = fletch_match.group('architecture') 121 architecture_match = dartino_match.group('architecture')
122 archs = { 122 archs = {
123 'x86' : ['ia32', 'x64'], 123 'x86' : ['ia32', 'x64'],
124 'x64' : ['x64'], 124 'x64' : ['x64'],
125 'ia32' : ['ia32'], 125 'ia32' : ['ia32'],
126 }[architecture_match] 126 }[architecture_match]
127 127
128 modes = [fletch_match.group('mode')] 128 modes = [dartino_match.group('mode')]
129 asans = [bool(fletch_match.group('asan'))] 129 asans = [bool(dartino_match.group('asan'))]
130 embedded_libs =[bool(fletch_match.group('embedded_libs'))] 130 embedded_libs =[bool(dartino_match.group('embedded_libs'))]
131 131
132 sdk_build = fletch_match.group('sdk') 132 sdk_build = dartino_match.group('sdk')
133 if sdk_build: 133 if sdk_build:
134 StepsSDK(debug_log, system, modes, archs, embedded_libs) 134 StepsSDK(debug_log, system, modes, archs, embedded_libs)
135 else: 135 else:
136 StepsNormal(debug_log, system, modes, archs, asans, embedded_libs) 136 StepsNormal(debug_log, system, modes, archs, asans, embedded_libs)
137 elif cross_match: 137 elif cross_match:
138 system = cross_match.group(1) 138 system = cross_match.group(1)
139 arch = cross_match.group(2) 139 arch = cross_match.group(2)
140 assert system == 'linux' 140 assert system == 'linux'
141 assert arch == 'arm' 141 assert arch == 'arm'
142 142
(...skipping 23 matching lines...) Expand all
166 bot.Clobber(force=True) 166 bot.Clobber(force=True)
167 StepGyp() 167 StepGyp()
168 168
169 cross_mode = 'release' 169 cross_mode = 'release'
170 cross_archs = ['xarm', 'stm'] 170 cross_archs = ['xarm', 'stm']
171 cross_system = 'linux' 171 cross_system = 'linux'
172 # We only cross compile on linux 172 # We only cross compile on linux
173 if system == 'linux': 173 if system == 'linux':
174 StepsCreateDebianPackage() 174 StepsCreateDebianPackage()
175 StepsArchiveDebianPackage() 175 StepsArchiveDebianPackage()
176 # We need the fletch daemon process to compile snapshots. 176 # We need the dartino daemon process to compile snapshots.
177 host_configuration = GetBuildConfigurations( 177 host_configuration = GetBuildConfigurations(
178 system=utils.GuessOS(), 178 system=utils.GuessOS(),
179 modes=['release'], 179 modes=['release'],
180 archs=['x64'], 180 archs=['x64'],
181 asans=[False], 181 asans=[False],
182 embedded_libs=[False], 182 embedded_libs=[False],
183 use_sdks=[False])[0] 183 use_sdks=[False])[0]
184 StepBuild(host_configuration['build_conf'], host_configuration['build_dir']) 184 StepBuild(host_configuration['build_conf'], host_configuration['build_dir'])
185 185
186 for cross_arch in cross_archs: 186 for cross_arch in cross_archs:
(...skipping 28 matching lines...) Expand all
215 215
216 def run(): 216 def run():
217 StepTest(configuration=configuration, 217 StepTest(configuration=configuration,
218 snapshot_run=False, 218 snapshot_run=False,
219 debug_log=debug_log) 219 debug_log=debug_log)
220 220
221 RunWithCoreDumpArchiving(run, build_dir, build_conf) 221 RunWithCoreDumpArchiving(run, build_dir, build_conf)
222 222
223 def StepsSanityChecking(build_dir): 223 def StepsSanityChecking(build_dir):
224 version = utils.GetSemanticSDKVersion() 224 version = utils.GetSemanticSDKVersion()
225 fletch = os.path.join(build_dir, 'dartino-sdk', 'bin', 'fletch') 225 dartino = os.path.join(build_dir, 'dartino-sdk', 'bin', 'dartino')
226 # TODO(ricow): we should test this as a normal test, see issue 232. 226 # TODO(ricow): we should test this as a normal test, see issue 232.
227 fletch_version = subprocess.check_output([fletch, '--version']).strip() 227 dartino_version = subprocess.check_output([dartino, '--version']).strip()
228 subprocess.check_call([fletch, 'quit']) 228 subprocess.check_call([dartino, 'quit'])
229 if fletch_version != version: 229 if dartino_version != version:
230 raise Exception('Version mismatch, VERSION file has %s, fletch has %s' % 230 raise Exception('Version mismatch, VERSION file has %s, dartino has %s' %
231 (version, fletch_version)) 231 (version, dartino_version))
232 fletch_vm = os.path.join(build_dir, 'dartino-sdk', 'bin', 'fletch-vm') 232 dartino_vm = os.path.join(build_dir, 'dartino-sdk', 'bin', 'dartino-vm')
233 fletch_vm_version = subprocess.check_output([fletch_vm, '--version']).strip() 233 dartino_vm_version = subprocess.check_output([dartino_vm, '--version']).strip( )
234 if fletch_vm_version != version: 234 if dartino_vm_version != version:
235 raise Exception('Version mismatch, VERSION file has %s, fletch vm has %s' % 235 raise Exception('Version mismatch, VERSION file has %s, dartino vm has %s' %
236 (version, fletch_vm_version)) 236 (version, dartino_vm_version))
237 237
238 def StepsCreateDebianPackage(): 238 def StepsCreateDebianPackage():
239 with bot.BuildStep('Create arm agent deb'): 239 with bot.BuildStep('Create arm agent deb'):
240 Run(['python', os.path.join('tools', 'create_tarball.py')]) 240 Run(['python', os.path.join('tools', 'create_tarball.py')])
241 Run(['python', os.path.join('tools', 'create_debian_packages.py')]) 241 Run(['python', os.path.join('tools', 'create_debian_packages.py')])
242 242
243 def StepsArchiveDebianPackage(): 243 def StepsArchiveDebianPackage():
244 with bot.BuildStep('Archive arm agent deb'): 244 with bot.BuildStep('Archive arm agent deb'):
245 version = utils.GetSemanticSDKVersion() 245 version = utils.GetSemanticSDKVersion()
246 namer = GetNamer() 246 namer = GetNamer()
247 gsutil = bot_utils.GSUtil() 247 gsutil = bot_utils.GSUtil()
248 deb_file = os.path.join('out', namer.arm_agent_filename(version)) 248 deb_file = os.path.join('out', namer.arm_agent_filename(version))
249 gs_path = namer.arm_agent_filepath(version) 249 gs_path = namer.arm_agent_filepath(version)
250 http_path = GetDownloadLink(gs_path) 250 http_path = GetDownloadLink(gs_path)
251 gsutil.upload(deb_file, gs_path, public=True) 251 gsutil.upload(deb_file, gs_path, public=True)
252 print '@@@STEP_LINK@download@%s@@@' % http_path 252 print '@@@STEP_LINK@download@%s@@@' % http_path
253 253
254 def GetDownloadLink(gs_path): 254 def GetDownloadLink(gs_path):
255 return gs_path.replace('gs://', 'https://storage.googleapis.com/') 255 return gs_path.replace('gs://', 'https://storage.googleapis.com/')
256 256
257 def GetNamer(temporary=False): 257 def GetNamer(temporary=False):
258 name, _ = bot.GetBotName() 258 name, _ = bot.GetBotName()
259 channel = bot_utils.GetChannelFromName(name) 259 channel = bot_utils.GetChannelFromName(name)
260 return fletch_namer.FletchGCSNamer(channel, temporary=temporary) 260 return dartino_namer.DartinoGCSNamer(channel, temporary=temporary)
261 261
262 def IsBleedingEdge(): 262 def IsBleedingEdge():
263 name, _ = bot.GetBotName() 263 name, _ = bot.GetBotName()
264 channel = bot_utils.GetChannelFromName(name) 264 channel = bot_utils.GetChannelFromName(name)
265 return channel == bot_utils.Channel.BLEEDING_EDGE 265 return channel == bot_utils.Channel.BLEEDING_EDGE
266 266
267 def StepsBundleSDK(build_dir, system): 267 def StepsBundleSDK(build_dir, system):
268 with bot.BuildStep('Bundle sdk %s' % build_dir): 268 with bot.BuildStep('Bundle sdk %s' % build_dir):
269 version = utils.GetSemanticSDKVersion() 269 version = utils.GetSemanticSDKVersion()
270 namer = GetNamer() 270 namer = GetNamer()
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 modes=modes, 432 modes=modes,
433 archs=archs, 433 archs=archs,
434 asans=asans, 434 asans=asans,
435 embedded_libs=embedded_libs, 435 embedded_libs=embedded_libs,
436 use_sdks=[False]) 436 use_sdks=[False])
437 437
438 # Generate ninja files. 438 # Generate ninja files.
439 StepGyp() 439 StepGyp()
440 440
441 # TODO(herhut): Remove once Windows port is complete. 441 # TODO(herhut): Remove once Windows port is complete.
442 args = ['fletch-vm'] if system == 'win' else () 442 args = ['dartino-vm'] if system == 'win' else ()
443 443
444 # Build all necessary configurations. 444 # Build all necessary configurations.
445 for configuration in configurations: 445 for configuration in configurations:
446 StepBuild(configuration['build_conf'], configuration['build_dir'], args) 446 StepBuild(configuration['build_conf'], configuration['build_dir'], args)
447 447
448 # TODO(herhut): Remove once Windows port is complete. 448 # TODO(herhut): Remove once Windows port is complete.
449 if system == 'win': 449 if system == 'win':
450 return 450 return
451 451
452 # Run tests on all necessary configurations. 452 # Run tests on all necessary configurations.
453 for snapshot_run in [True, False]: 453 for snapshot_run in [True, False]:
454 for configuration in configurations: 454 for configuration in configurations:
455 if not ShouldSkipConfiguration(snapshot_run, configuration): 455 if not ShouldSkipConfiguration(snapshot_run, configuration):
456 build_conf = configuration['build_conf'] 456 build_conf = configuration['build_conf']
457 build_dir = configuration['build_dir'] 457 build_dir = configuration['build_dir']
458 458
459 def run(): 459 def run():
460 StepTest( 460 StepTest(
461 configuration=configuration, 461 configuration=configuration,
462 snapshot_run=snapshot_run, 462 snapshot_run=snapshot_run,
463 debug_log=debug_log) 463 debug_log=debug_log)
464 464
465 RunWithCoreDumpArchiving(run, build_dir, build_conf) 465 RunWithCoreDumpArchiving(run, build_dir, build_conf)
466 466
467 def StepsFreeRtos(debug_log): 467 def StepsFreeRtos(debug_log):
468 StepGyp() 468 StepGyp()
469 469
470 # We need the fletch daemon process to compile snapshots. 470 # We need the dartino daemon process to compile snapshots.
471 host_configuration = GetBuildConfigurations( 471 host_configuration = GetBuildConfigurations(
472 system=utils.GuessOS(), 472 system=utils.GuessOS(),
473 modes=['release'], 473 modes=['release'],
474 archs=['x64'], 474 archs=['x64'],
475 asans=[False], 475 asans=[False],
476 embedded_libs=[False], 476 embedded_libs=[False],
477 use_sdks=[False])[0] 477 use_sdks=[False])[0]
478 StepBuild(host_configuration['build_conf'], host_configuration['build_dir']) 478 StepBuild(host_configuration['build_conf'], host_configuration['build_dir'])
479 479
480 configuration = GetBuildConfigurations( 480 configuration = GetBuildConfigurations(
481 system=utils.GuessOS(), 481 system=utils.GuessOS(),
482 modes=['debug'], 482 modes=['debug'],
483 archs=['STM'], 483 archs=['STM'],
484 asans=[False], 484 asans=[False],
485 embedded_libs=[False], 485 embedded_libs=[False],
486 use_sdks=[False])[0] 486 use_sdks=[False])[0]
487 StepBuild(configuration['build_conf'], configuration['build_dir']) 487 StepBuild(configuration['build_conf'], configuration['build_dir'])
488 488
489 489
490 def StepsLK(debug_log): 490 def StepsLK(debug_log):
491 # We need the fletch daemon process to compile snapshots. 491 # We need the dartino daemon process to compile snapshots.
492 host_configuration = GetBuildConfigurations( 492 host_configuration = GetBuildConfigurations(
493 system=utils.GuessOS(), 493 system=utils.GuessOS(),
494 modes=['debug'], 494 modes=['debug'],
495 archs=['ia32'], 495 archs=['ia32'],
496 asans=[False], 496 asans=[False],
497 embedded_libs=[False], 497 embedded_libs=[False],
498 use_sdks=[False])[0] 498 use_sdks=[False])[0]
499 499
500 # Generate ninja files. 500 # Generate ninja files.
501 StepGyp() 501 StepGyp()
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 archs=[arch], 584 archs=[arch],
585 asans=[False], 585 asans=[False],
586 embedded_libs=[False], 586 embedded_libs=[False],
587 use_sdks=[False]) 587 use_sdks=[False])
588 for snapshot_run in [True, False]: 588 for snapshot_run in [True, False]:
589 for configuration in configurations: 589 for configuration in configurations:
590 if not ShouldSkipConfiguration(snapshot_run, configuration): 590 if not ShouldSkipConfiguration(snapshot_run, configuration):
591 build_dir = configuration['build_dir'] 591 build_dir = configuration['build_dir']
592 592
593 # Sanity check we got build artifacts which we expect. 593 # Sanity check we got build artifacts which we expect.
594 assert os.path.exists(os.path.join(build_dir, 'fletch-vm')) 594 assert os.path.exists(os.path.join(build_dir, 'dartino-vm'))
595 595
596 # TODO(kustermann): This is hackisch, but our current copying of the 596 # TODO(kustermann): This is hackisch, but our current copying of the
597 # dart binary makes this a requirement. 597 # dart binary makes this a requirement.
598 dart_arm = 'third_party/bin/linux/dart-arm' 598 dart_arm = 'third_party/bin/linux/dart-arm'
599 destination = os.path.join(build_dir, 'dart') 599 destination = os.path.join(build_dir, 'dart')
600 shutil.copyfile(dart_arm, destination) 600 shutil.copyfile(dart_arm, destination)
601 shutil.copymode(dart_arm, destination) 601 shutil.copymode(dart_arm, destination)
602 602
603 def run(): 603 def run():
604 StepTest( 604 StepTest(
(...skipping 11 matching lines...) Expand all
616 bot.Clobber(force=True) 616 bot.Clobber(force=True)
617 617
618 618
619 #### Buildbot steps helper 619 #### Buildbot steps helper
620 620
621 def StepGyp(): 621 def StepGyp():
622 with bot.BuildStep('GYP'): 622 with bot.BuildStep('GYP'):
623 Run(['python', 'tools/run-ninja.py', '-v']) 623 Run(['python', 'tools/run-ninja.py', '-v'])
624 624
625 def AnalyzeLog(log_file): 625 def AnalyzeLog(log_file):
626 # pkg/fletchc/lib/src/hub/hub_main.dart will, in its log file, print 626 # pkg/dartino_compiler/lib/src/hub/hub_main.dart will, in its log file, print
627 # "1234: Crash (..." when an exception is thrown after shutting down a 627 # "1234: Crash (..." when an exception is thrown after shutting down a
628 # client. In this case, there's no obvious place to report the exception, so 628 # client. In this case, there's no obvious place to report the exception, so
629 # the build bot must look for these crashes. 629 # the build bot must look for these crashes.
630 pattern=re.compile(r"^[0-9]+: Crash \(") 630 pattern=re.compile(r"^[0-9]+: Crash \(")
631 undiagnosed_crashes = False 631 undiagnosed_crashes = False
632 for line in log_file: 632 for line in log_file:
633 if pattern.match(line): 633 if pattern.match(line):
634 undiagnosed_crashes = True 634 undiagnosed_crashes = True
635 # For information about build bot annotations below, see 635 # For information about build bot annotations below, see
636 # https://chromium.googlesource.com/chromium/tools/build/+/c63ec51491a8e47 b724b5206a76f8b5e137ff1e7/scripts/master/chromium_step.py#472 636 # https://chromium.googlesource.com/chromium/tools/build/+/c63ec51491a8e47 b724b5206a76f8b5e137ff1e7/scripts/master/chromium_step.py#472
637 print '@@@STEP_LOG_LINE@undiagnosed_crashes@%s@@@' % line.rstrip() 637 print '@@@STEP_LOG_LINE@undiagnosed_crashes@%s@@@' % line.rstrip()
638 if undiagnosed_crashes: 638 if undiagnosed_crashes:
639 print '@@@STEP_LOG_END@undiagnosed_crashes@@@' 639 print '@@@STEP_LOG_END@undiagnosed_crashes@@@'
640 MarkCurrentStep(fatal=True) 640 MarkCurrentStep(fatal=True)
641 641
642 def ProcessFletchLog(fletch_log, debug_log): 642 def ProcessDartinoLog(dartino_log, debug_log):
643 fletch_log.flush() 643 dartino_log.flush()
644 fletch_log.seek(0) 644 dartino_log.seek(0)
645 AnalyzeLog(fletch_log) 645 AnalyzeLog(dartino_log)
646 fletch_log.seek(0) 646 dartino_log.seek(0)
647 while True: 647 while True:
648 buffer = fletch_log.read(1014*1024) 648 buffer = dartino_log.read(1014*1024)
649 if not buffer: 649 if not buffer:
650 break 650 break
651 debug_log.write(buffer) 651 debug_log.write(buffer)
652 652
653 def StepBuild(build_config, build_dir, args=()): 653 def StepBuild(build_config, build_dir, args=()):
654 with bot.BuildStep('Build %s' % build_config): 654 with bot.BuildStep('Build %s' % build_config):
655 Run(['ninja', '-v', '-C', build_dir] + list(args)) 655 Run(['ninja', '-v', '-C', build_dir] + list(args))
656 656
657 def StepTest( 657 def StepTest(
658 configuration=None, 658 configuration=None,
(...skipping 16 matching lines...) Expand all
675 '--kill-persistent-process=0', 675 '--kill-persistent-process=0',
676 '--run-gclient-hooks=0', 676 '--run-gclient-hooks=0',
677 '--build-before-testing=0', 677 '--build-before-testing=0',
678 '--host-checked'] 678 '--host-checked']
679 679
680 if system: 680 if system:
681 system_argument = 'macos' if system == 'mac' else system 681 system_argument = 'macos' if system == 'mac' else system
682 args.append('-s%s' % system_argument) 682 args.append('-s%s' % system_argument)
683 683
684 if snapshot_run: 684 if snapshot_run:
685 # We let the fletch compiler compile tests to snapshots. 685 # We let the dartino compiler compile tests to snapshots.
686 # Afterwards we run the snapshot with 686 # Afterwards we run the snapshot with
687 # - normal fletch VM 687 # - normal dartino VM
688 # - fletch VM with -Xunfold-program enabled 688 # - dartino VM with -Xunfold-program enabled
689 args.extend(['-cfletchc', '-rfletchvm']) 689 args.extend(['-cdartino_compiler', '-rdartinovm'])
690 690
691 if use_sdk: 691 if use_sdk:
692 args.append('--use-sdk') 692 args.append('--use-sdk')
693 693
694 if asan: 694 if asan:
695 args.append('--asan') 695 args.append('--asan')
696 696
697 if clang: 697 if clang:
698 args.append('--clang') 698 args.append('--clang')
699 699
700 if embedded_libs: 700 if embedded_libs:
701 args.append('--fletch-settings-file=embedded.fletch-settings') 701 args.append('--dartino-settings-file=embedded.dartino-settings')
702 702
703 with TemporaryHomeDirectory(): 703 with TemporaryHomeDirectory():
704 with open(os.path.expanduser("~/.fletch.log"), 'w+') as fletch_log: 704 with open(os.path.expanduser("~/.dartino.log"), 'w+') as dartino_log:
705 # Use a new persistent daemon for every test run. 705 # Use a new persistent daemon for every test run.
706 # Append it's stdout/stderr to the "~/.fletch.log" file. 706 # Append it's stdout/stderr to the "~/.dartino.log" file.
707 try: 707 try:
708 with PersistentFletchDaemon(configuration, fletch_log): 708 with PersistentDartinoDaemon(configuration, dartino_log):
709 Run(args) 709 Run(args)
710 finally: 710 finally:
711 # Copy "~/.fletch.log" to ".debug.log" and look for crashes. 711 # Copy "~/.dartino.log" to ".debug.log" and look for crashes.
712 ProcessFletchLog(fletch_log, debug_log) 712 ProcessDartinoLog(dartino_log, debug_log)
713 713
714 714
715 #### Helper functionality 715 #### Helper functionality
716 716
717 class PersistentFletchDaemon(object): 717 class PersistentDartinoDaemon(object):
718 def __init__(self, configuration, log_file): 718 def __init__(self, configuration, log_file):
719 self._configuration = configuration 719 self._configuration = configuration
720 self._log_file = log_file 720 self._log_file = log_file
721 self._persistent = None 721 self._persistent = None
722 722
723 def __enter__(self): 723 def __enter__(self):
724 print "Starting new persistent fletch daemon" 724 print "Starting new persistent dartino daemon"
725 version = utils.GetSemanticSDKVersion() 725 version = utils.GetSemanticSDKVersion()
726 fletchrc = os.path.join(os.path.abspath(os.environ['HOME']), '.fletch') 726 dartinorc = os.path.join(os.path.abspath(os.environ['HOME']), '.dartino')
727 self._persistent = subprocess.Popen( 727 self._persistent = subprocess.Popen(
728 [os.path.join(os.path.abspath(self._configuration['build_dir']), 'dart'), 728 [os.path.join(os.path.abspath(self._configuration['build_dir']), 'dart'),
729 '-c', 729 '-c',
730 # TODO(kustermann): Issue(396): Remove this --enable-dumpcore flag again. 730 # TODO(kustermann): Issue(396): Remove this --enable-dumpcore flag again.
731 '--abort-on-assertion-errors', 731 '--abort-on-assertion-errors',
732 '--packages=%s' % os.path.abspath('pkg/fletchc/.packages'), 732 '--packages=%s' % os.path.abspath('pkg/dartino_compiler/.packages'),
733 '-Dfletch.version=%s' % version, 733 '-Ddartino.version=%s' % version,
734 'package:fletchc/src/hub/hub_main.dart', 734 'package:dartino/src/hub/hub_main.dart',
735 fletchrc], 735 dartinorc],
736 stdout=self._log_file, 736 stdout=self._log_file,
737 stderr=subprocess.STDOUT, 737 stderr=subprocess.STDOUT,
738 close_fds=True, 738 close_fds=True,
739 # Launch the persistent process in a new process group. When shutting 739 # Launch the persistent process in a new process group. When shutting
740 # down in response to a signal, the persistent process will kill its 740 # down in response to a signal, the persistent process will kill its
741 # process group to ensure that any processes it has spawned also exit. If 741 # process group to ensure that any processes it has spawned also exit. If
742 # we don't use a new process group, that will also kill this process. 742 # we don't use a new process group, that will also kill this process.
743 preexec_fn=os.setsid 743 preexec_fn=os.setsid
744 # TODO(kustermann): Issue(396): Make the cwd=/ again. 744 # TODO(kustermann): Issue(396): Make the cwd=/ again.
745 ## We change the current directory of the persistent process to ensure 745 ## We change the current directory of the persistent process to ensure
746 ## that we read files relative to the C++ client's current directory, not 746 ## that we read files relative to the C++ client's current directory, not
747 ## the persistent process'. 747 ## the persistent process'.
748 #, cwd='/') 748 #, cwd='/')
749 ) 749 )
750 750
751 while not self._log_file.tell(): 751 while not self._log_file.tell():
752 # We're waiting for the persistent process to write a line on stdout. It 752 # We're waiting for the persistent process to write a line on stdout. It
753 # always does so as it is part of a handshake when started by the 753 # always does so as it is part of a handshake when started by the
754 # "fletch" program. 754 # "dartino" program.
755 print "Waiting for persistent process to start" 755 print "Waiting for persistent process to start"
756 time.sleep(0.5) 756 time.sleep(0.5)
757 self._log_file.seek(0, os.SEEK_END) 757 self._log_file.seek(0, os.SEEK_END)
758 758
759 def __exit__(self, *_): 759 def __exit__(self, *_):
760 print "Trying to wait for existing fletch daemon." 760 print "Trying to wait for existing dartino daemon."
761 self._persistent.terminate() 761 self._persistent.terminate()
762 self._persistent.wait() 762 self._persistent.wait()
763 763
764 class TemporaryHomeDirectory(object): 764 class TemporaryHomeDirectory(object):
765 """Creates a temporary directory and uses that as the home directory. 765 """Creates a temporary directory and uses that as the home directory.
766 766
767 This works by setting the environment variable HOME. 767 This works by setting the environment variable HOME.
768 """ 768 """
769 769
770 def __init__(self): 770 def __init__(self):
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 coredumps = self._find_coredumps() 807 coredumps = self._find_coredumps()
808 assert not coredumps 808 assert not coredumps
809 809
810 def __exit__(self, *_): 810 def __exit__(self, *_):
811 coredumps = self._find_coredumps() 811 coredumps = self._find_coredumps()
812 if coredumps: 812 if coredumps:
813 # If we get a ton of crashes, only archive 10 dumps. 813 # If we get a ton of crashes, only archive 10 dumps.
814 archive_coredumps = coredumps[:10] 814 archive_coredumps = coredumps[:10]
815 print 'Archiving coredumps: %s' % ', '.join(archive_coredumps) 815 print 'Archiving coredumps: %s' % ', '.join(archive_coredumps)
816 sys.stdout.flush() 816 sys.stdout.flush()
817 self._archive(os.path.join(self._build_dir, 'fletch'), 817 self._archive(os.path.join(self._build_dir, 'dartino'),
818 os.path.join(self._build_dir, 'fletch-vm'), 818 os.path.join(self._build_dir, 'dartino-vm'),
819 archive_coredumps) 819 archive_coredumps)
820 for filename in coredumps: 820 for filename in coredumps:
821 print 'Removing core: %s' % filename 821 print 'Removing core: %s' % filename
822 os.remove(filename) 822 os.remove(filename)
823 coredumps = self._find_coredumps() 823 coredumps = self._find_coredumps()
824 assert not coredumps 824 assert not coredumps
825 825
826 def _find_coredumps(self): 826 def _find_coredumps(self):
827 # Finds all files named 'core.*' in the search directory. 827 # Finds all files named 'core.*' in the search directory.
828 return glob.glob(os.path.join(self._search_dir, 'core.*')) 828 return glob.glob(os.path.join(self._search_dir, 'core.*'))
829 829
830 def _archive(self, driver, fletch_vm, coredumps): 830 def _archive(self, driver, dartino_vm, coredumps):
831 assert coredumps 831 assert coredumps
832 files = [driver, fletch_vm] + coredumps 832 files = [driver, dartino_vm] + coredumps
833 833
834 for filename in files: 834 for filename in files:
835 assert os.path.exists(filename) 835 assert os.path.exists(filename)
836 836
837 gsutil = bot_utils.GSUtil() 837 gsutil = bot_utils.GSUtil()
838 storage_path = '%s/%s/' % (self._bucket, uuid.uuid4()) 838 storage_path = '%s/%s/' % (self._bucket, uuid.uuid4())
839 gs_prefix = 'gs://%s' % storage_path 839 gs_prefix = 'gs://%s' % storage_path
840 http_prefix = 'https://storage.cloud.google.com/%s' % storage_path 840 http_prefix = 'https://storage.cloud.google.com/%s' % storage_path
841 841
842 for filename in files: 842 for filename in files:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 expected_core_pattern = 'core' 887 expected_core_pattern = 'core'
888 expected_core_pattern_uses_pid = '1' 888 expected_core_pattern_uses_pid = '1'
889 if (core_pattern.strip() != expected_core_pattern or 889 if (core_pattern.strip() != expected_core_pattern or
890 core_pattern_uses_pid.strip() != expected_core_pattern_uses_pid): 890 core_pattern_uses_pid.strip() != expected_core_pattern_uses_pid):
891 message = ("Invalid core_pattern and/or core_uses_pid configuration. " 891 message = ("Invalid core_pattern and/or core_uses_pid configuration. "
892 "The configuration of core dump handling is *not* correct for " 892 "The configuration of core dump handling is *not* correct for "
893 "a buildbot. The content of {0} must be '{1}' and the content " 893 "a buildbot. The content of {0} must be '{1}' and the content "
894 "of {2} must be '{3}'." 894 "of {2} must be '{3}'."
895 .format(core_pattern_file, expected_core_pattern, 895 .format(core_pattern_file, expected_core_pattern,
896 core_pattern_uses_pid_file, expected_core_pattern_uses_pid)) 896 core_pattern_uses_pid_file, expected_core_pattern_uses_pid))
897 raise Exception(message) 897 # raise Exception(message)
898 898
899 class MacosCoredumpArchiver(CoredumpArchiver): 899 class MacosCoredumpArchiver(CoredumpArchiver):
900 def __init__(self, *args): 900 def __init__(self, *args):
901 super(MacosCoredumpArchiver, self).__init__('/cores', *args) 901 super(MacosCoredumpArchiver, self).__init__('/cores', *args)
902 902
903 def __enter__(self): 903 def __enter__(self):
904 super(MacosCoredumpArchiver, self).__enter__() 904 super(MacosCoredumpArchiver, self).__enter__()
905 905
906 assert os.path.exists(self._search_dir) 906 assert os.path.exists(self._search_dir)
907 907
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 elif is_stm: 993 elif is_stm:
994 # We don't support cross compiling to STM boards (Cortex-M7) with clang ATM. 994 # We don't support cross compiling to STM boards (Cortex-M7) with clang ATM.
995 return [''] 995 return ['']
996 elif is_windows: 996 elif is_windows:
997 # On windows we always use VC++. 997 # On windows we always use VC++.
998 return [''] 998 return ['']
999 else: 999 else:
1000 return ['', 'Clang'] 1000 return ['', 'Clang']
1001 1001
1002 def TarballName(arch, revision): 1002 def TarballName(arch, revision):
1003 return 'fletch_cross_build_%s_%s.tar.bz2' % (arch, revision) 1003 return 'dartino_cross_build_%s_%s.tar.bz2' % (arch, revision)
1004 1004
1005 def MarkCurrentStep(fatal=True): 1005 def MarkCurrentStep(fatal=True):
1006 """Mark the current step as having a problem. 1006 """Mark the current step as having a problem.
1007 1007
1008 If fatal is True, mark the current step as failed (red), otherwise mark it as 1008 If fatal is True, mark the current step as failed (red), otherwise mark it as
1009 having warnings (orange). 1009 having warnings (orange).
1010 """ 1010 """
1011 # See 1011 # See
1012 # https://chromium.googlesource.com/chromium/tools/build/+/c63ec51491a8e47b724 b5206a76f8b5e137ff1e7/scripts/master/chromium_step.py#495 1012 # https://chromium.googlesource.com/chromium/tools/build/+/c63ec51491a8e47b724 b5206a76f8b5e137ff1e7/scripts/master/chromium_step.py#495
1013 if fatal: 1013 if fatal:
1014 print '@@@STEP_FAILURE@@@' 1014 print '@@@STEP_FAILURE@@@'
1015 else: 1015 else:
1016 print '@@@STEP_WARNINGS@@@' 1016 print '@@@STEP_WARNINGS@@@'
1017 sys.stdout.flush() 1017 sys.stdout.flush()
1018 1018
1019 if __name__ == '__main__': 1019 if __name__ == '__main__':
1020 # If main raises an exception we will get a very useful error message with 1020 # If main raises an exception we will get a very useful error message with
1021 # traceback written to stderr. We therefore intentionally do not catch 1021 # traceback written to stderr. We therefore intentionally do not catch
1022 # exceptions. 1022 # exceptions.
1023 Main() 1023 Main()
OLDNEW
« no previous file with comments | « tools/bots/dartino_namer.py ('k') | tools/bots/fletch_namer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698