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

Side by Side Diff: bin/cbuildbot.py

Issue 3591002: Add ability to run smoke_Suite on x86-pre-flight-queue. (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: Fix no_graphics Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | bin/cbuildbot_config.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) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS 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 """CBuildbot is wrapper around the build process used by the pre-flight queue""" 7 """CBuildbot is wrapper around the build process used by the pre-flight queue"""
8 8
9 import errno 9 import errno
10 import re 10 import re
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 cwd=cwd, enter_chroot=True) 201 cwd=cwd, enter_chroot=True)
202 202
203 203
204 def _UprevAllPackages(buildroot): 204 def _UprevAllPackages(buildroot):
205 """Uprevs all packages that have been updated since last uprev.""" 205 """Uprevs all packages that have been updated since last uprev."""
206 cwd = os.path.join(buildroot, 'src', 'scripts') 206 cwd = os.path.join(buildroot, 'src', 'scripts')
207 RunCommand(['./cros_mark_all_as_stable', 207 RunCommand(['./cros_mark_all_as_stable',
208 '--tracking_branch="cros/master"'], 208 '--tracking_branch="cros/master"'],
209 cwd=cwd, enter_chroot=True) 209 cwd=cwd, enter_chroot=True)
210 210
211
212 def _GetVMConstants(buildroot):
213 """Returns minimum (vdisk_size, statefulfs_size) recommended for VM's."""
214 cwd = os.path.join(buildroot, 'src', 'scripts', 'lib')
215 source_cmd = 'source %s/cros_vm_constants.sh' % cwd
216 vdisk_size = RunCommand([
217 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd],
218 redirect_stdout=True)
219 statefulfs_size = RunCommand([
220 '/bin/bash', '-c', '%s && echo $MIN_STATEFUL_FS_SIZE_FULL' % source_cmd],
221 redirect_stdout=True)
222 return (vdisk_size.strip(), statefulfs_size.strip())
223
224
211 # =========================== Main Commands =================================== 225 # =========================== Main Commands ===================================
212 226
213 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES): 227 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES):
214 """Performs a full checkout and clobbers any previous checkouts.""" 228 """Performs a full checkout and clobbers any previous checkouts."""
215 RunCommand(['sudo', 'rm', '-rf', buildroot]) 229 RunCommand(['sudo', 'rm', '-rf', buildroot])
216 MakeDir(buildroot, parents=True) 230 MakeDir(buildroot, parents=True)
217 RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], 231 RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'],
218 cwd=buildroot, input='\n\ny\n') 232 cwd=buildroot, input='\n\ny\n')
219 RepoSync(buildroot, rw_checkout, retries) 233 RepoSync(buildroot, rw_checkout, retries)
220 234
(...skipping 16 matching lines...) Expand all
237 cwd = os.path.join(buildroot, 'src', 'scripts') 251 cwd = os.path.join(buildroot, 'src', 'scripts')
238 RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board], 252 RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board],
239 cwd=cwd, enter_chroot=True) 253 cwd=cwd, enter_chroot=True)
240 254
241 255
242 def _Build(buildroot): 256 def _Build(buildroot):
243 """Wrapper around build_packages.""" 257 """Wrapper around build_packages."""
244 cwd = os.path.join(buildroot, 'src', 'scripts') 258 cwd = os.path.join(buildroot, 'src', 'scripts')
245 RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True) 259 RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True)
246 260
261
247 def _WipeOldOutput(buildroot): 262 def _WipeOldOutput(buildroot):
248 RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot) 263 RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot)
249 264
265
250 def _BuildImage(buildroot): 266 def _BuildImage(buildroot):
251 _WipeOldOutput(buildroot) 267 _WipeOldOutput(buildroot)
252 268
253 cwd = os.path.join(buildroot, 'src', 'scripts') 269 cwd = os.path.join(buildroot, 'src', 'scripts')
254 RunCommand(['./build_image', '--replace'], cwd=cwd, enter_chroot=True) 270 RunCommand(['./build_image', '--replace'], cwd=cwd, enter_chroot=True)
255 271
272
273 def _BuildVMImageForTesting(buildroot):
274 (vdisk_size, statefulfs_size) = _GetVMConstants(buildroot)
275 cwd = os.path.join(buildroot, 'src', 'scripts')
276 RunCommand(['./image_to_vm.sh',
277 '--test_image',
278 '--full',
279 '--vdisk_size %s' % vdisk_size,
280 '--statefulfs_size %s' % statefulfs_size,
281 ], cwd=cwd, enter_chroot=True)
282
283
256 def _RunUnitTests(buildroot): 284 def _RunUnitTests(buildroot):
257 cwd = os.path.join(buildroot, 'src', 'scripts') 285 cwd = os.path.join(buildroot, 'src', 'scripts')
258 RunCommand(['./cros_run_unit_tests'], cwd=cwd, enter_chroot=True) 286 RunCommand(['./cros_run_unit_tests'], cwd=cwd, enter_chroot=True)
259 287
260 288
289 def _RunSmokeSuite(buildroot):
290 cwd = os.path.join(buildroot, 'src', 'scripts')
291 RunCommand(['bin/cros_run_vm_test',
292 '--no_graphics',
293 '--test_case',
294 'suite_Smoke',
295 ], cwd=cwd, error_ok=True)
296
297
261 def _UprevPackages(buildroot, revisionfile, board): 298 def _UprevPackages(buildroot, revisionfile, board):
262 """Uprevs a package based on given revisionfile. 299 """Uprevs a package based on given revisionfile.
263 300
264 If revisionfile is set to None or does not resolve to an actual file, this 301 If revisionfile is set to None or does not resolve to an actual file, this
265 function will uprev all packages. 302 function will uprev all packages.
266 303
267 Keyword arguments: 304 Keyword arguments:
268 revisionfile -- string specifying a file that contains a list of revisions to 305 revisionfile -- string specifying a file that contains a list of revisions to
269 uprev. 306 uprev.
270 """ 307 """
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 _SetupBoard(buildroot, board=buildconfig['board']) 413 _SetupBoard(buildroot, board=buildconfig['board'])
377 414
378 if buildconfig['uprev']: 415 if buildconfig['uprev']:
379 _UprevPackages(buildroot, revisionfile, board=buildconfig['board']) 416 _UprevPackages(buildroot, revisionfile, board=buildconfig['board'])
380 417
381 _Build(buildroot) 418 _Build(buildroot)
382 if buildconfig['unittests']: 419 if buildconfig['unittests']:
383 _RunUnitTests(buildroot) 420 _RunUnitTests(buildroot)
384 421
385 _BuildImage(buildroot) 422 _BuildImage(buildroot)
423
424 if buildconfig['smoke_bvt']:
425 _BuildVMImageForTesting(buildroot)
426 _RunSmokeSuite(buildroot)
427
386 if buildconfig['uprev']: 428 if buildconfig['uprev']:
387 if buildconfig['master']: 429 if buildconfig['master']:
388 # Master bot needs to check if the other slaves completed. 430 # Master bot needs to check if the other slaves completed.
389 if cbuildbot_comm.HaveSlavesCompleted(config): 431 if cbuildbot_comm.HaveSlavesCompleted(config):
390 _UprevPush(buildroot) 432 _UprevPush(buildroot)
391 _UprevCleanup(buildroot) 433 _UprevCleanup(buildroot)
392 else: 434 else:
393 # At least one of the slaves failed or we timed out. 435 # At least one of the slaves failed or we timed out.
394 _UprevCleanup(buildroot) 436 _UprevCleanup(buildroot)
395 Die('CBUILDBOT - One of the slaves has failed!!!') 437 Die('CBUILDBOT - One of the slaves has failed!!!')
396 else: 438 else:
397 # Publish my status to the master if its expecting it. 439 # Publish my status to the master if its expecting it.
398 if buildconfig['important']: 440 if buildconfig['important']:
399 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) 441 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE)
400 442
401 _UprevCleanup(buildroot) 443 _UprevCleanup(buildroot)
402 except: 444 except:
403 # Send failure to master bot. 445 # Send failure to master bot.
404 if not buildconfig['master'] and buildconfig['important']: 446 if not buildconfig['master'] and buildconfig['important']:
405 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) 447 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
406 448
407 raise 449 raise
408 450
409 451
410 if __name__ == '__main__': 452 if __name__ == '__main__':
411 main() 453 main()
OLDNEW
« no previous file with comments | « no previous file | bin/cbuildbot_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698