Mercurial > hg > truffle
comparison mx/commands.py @ 4438:0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 04 Feb 2012 15:43:40 +0100 |
parents | 648a7873cea2 |
children | 7d6490436b57 |
comparison
equal
deleted
inserted
replaced
4437:c7ad6e1e202b | 4438:0312460af9fc |
---|---|
449 vm(['-XX:-BootstrapGraal', '-esa', '-Xbootclasspath/a:' + mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) | 449 vm(['-XX:-BootstrapGraal', '-esa', '-Xbootclasspath/a:' + mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) |
450 | 450 |
451 def gate(args): | 451 def gate(args): |
452 """run the tests used to validate a push | 452 """run the tests used to validate a push |
453 | 453 |
454 If this commands exits with a 0 exit code, then the source code is in | 454 If this command exits with a 0 exit code, then the source code is in |
455 a state that would be accepted for integration into the main repository.""" | 455 a state that would be accepted for integration into the main repository.""" |
456 | |
457 | |
456 | 458 |
457 class Task: | 459 class Task: |
458 def __init__(self, title): | 460 def __init__(self, title): |
459 self.start = time.time() | 461 self.start = time.time() |
460 self.title = title | 462 self.title = title |
463 self.end = None | |
464 self.duration = None | |
461 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) | 465 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) |
462 def stop(self): | 466 def stop(self): |
463 duration = datetime.timedelta(seconds=time.time() - self.start) | 467 self.end = time.time() |
464 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(duration) + ']') | 468 self.duration = datetime.timedelta(seconds=self.end - self.start) |
469 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') | |
470 return self | |
465 def abort(self, codeOrMessage): | 471 def abort(self, codeOrMessage): |
466 duration = datetime.timedelta(seconds=time.time() - self.start) | 472 self.end = time.time() |
467 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: ABORT: ') + self.title + ' [' + str(duration) + ']') | 473 self.duration = datetime.timedelta(seconds=self.end - self.start) |
474 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: ABORT: ') + self.title + ' [' + str(self.duration) + ']') | |
468 mx.abort(codeOrMessage) | 475 mx.abort(codeOrMessage) |
476 return self | |
469 | 477 |
478 tasks = [] | |
470 total = Task('Gate') | 479 total = Task('Gate') |
471 try: | 480 try: |
472 | 481 |
473 t = Task('CleanJava') | 482 t = Task('Clean') |
474 clean(['--no-native']) | 483 clean([]) |
475 t.stop() | 484 tasks.append(t.stop()) |
476 | 485 |
477 t = Task('Checkstyle') | 486 t = Task('Checkstyle') |
478 if mx.checkstyle([]) != 0: | 487 if mx.checkstyle([]) != 0: |
479 t.abort('Checkstyle warnings were found') | 488 t.abort('Checkstyle warnings were found') |
480 t.stop() | 489 tasks.append(t.stop()) |
481 | 490 |
482 t = Task('Canonicalization Check') | 491 t = Task('Canonicalization Check') |
483 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) | 492 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) |
484 if mx.canonicalizeprojects([]) != 0: | 493 if mx.canonicalizeprojects([]) != 0: |
485 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') | 494 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') |
486 t.stop() | 495 tasks.append(t.stop()) |
487 | 496 |
488 t = Task('BuildJava') | 497 t = Task('BuildJava') |
489 build(['--no-native']) | 498 build(['--no-native']) |
490 t.stop() | 499 tasks.append(t.stop()) |
491 | 500 |
492 for vmbuild in ['product', 'fastdebug']: | 501 for vmbuild in ['product', 'fastdebug']: |
493 global _vmbuild | 502 global _vmbuild |
494 _vmbuild = vmbuild | 503 _vmbuild = vmbuild |
495 | 504 |
496 t = Task('BuildHotSpot:' + vmbuild) | 505 t = Task('BuildHotSpot:' + vmbuild) |
497 build(['--no-java', vmbuild]) | 506 build(['--no-java', vmbuild]) |
498 t.stop() | 507 tasks.append(t.stop()) |
499 | 508 |
500 t = Task('BootstrapWithSystemAssertions:' + vmbuild) | 509 t = Task('BootstrapWithSystemAssertions:' + vmbuild) |
501 vm(['-esa', '-version']) | 510 vm(['-esa', '-version']) |
502 t.stop() | 511 tasks.append(t.stop()) |
503 | 512 |
504 t = Task('UnitTests:' + vmbuild) | 513 t = Task('UnitTests:' + vmbuild) |
505 unittest([]) | 514 unittest([]) |
506 t.stop() | 515 tasks.append(t.stop()) |
507 | 516 |
508 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 517 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
509 t = Task(str(test) + ':' + vmbuild) | 518 t = Task(str(test) + ':' + vmbuild) |
510 if not test.test('graal'): | 519 if not test.test('graal'): |
511 t.abort(test.group + ' ' + test.name + ' Failed') | 520 t.abort(test.group + ' ' + test.name + ' Failed') |
512 t.stop() | 521 tasks.append(t.stop()) |
513 except KeyboardInterrupt: | 522 except KeyboardInterrupt: |
514 total.abort(1) | 523 total.abort(1) |
515 | 524 |
516 except Exception as e: | 525 except Exception as e: |
517 import traceback | 526 import traceback |
518 traceback.print_exc() | 527 traceback.print_exc() |
519 total.abort(str(e)) | 528 total.abort(str(e)) |
520 | 529 |
521 total.stop() | 530 total.stop() |
531 | |
532 mx.log('Gate task times:') | |
533 for t in tasks: | |
534 mx.log(' ' + str(t.duration) + '\t' + t.title) | |
535 mx.log(' =======') | |
536 mx.log(' ' + str(total.duration)) | |
522 | 537 |
523 def bench(args): | 538 def bench(args): |
524 """run benchmarks and parse their output for results | 539 """run benchmarks and parse their output for results |
525 | 540 |
526 Results are JSON formated : {group : {benchmark : score}}.""" | 541 Results are JSON formated : {group : {benchmark : score}}.""" |