Mercurial > hg > graal-jvmci-8
comparison mx/commands.py @ 4602:ebd98fc68b67
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 16 Feb 2012 22:58:26 +0100 |
parents | ade18666f2be 6bcf713a4f41 |
children | ee87cfe2f8f9 ef0ff914c10f |
comparison
equal
deleted
inserted
replaced
4601:ade18666f2be | 4602:ebd98fc68b67 |
---|---|
315 for line in lines: | 315 for line in lines: |
316 f.write(line) | 316 f.write(line) |
317 | 317 |
318 else: | 318 else: |
319 if not exists(jdk): | 319 if not exists(jdk): |
320 mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx make ' + build + '\'') | 320 mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx build ' + build + '\'') |
321 return jdk | 321 return jdk |
322 | 322 |
323 # run a command in the windows SDK Debug Shell | 323 # run a command in the windows SDK Debug Shell |
324 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}): | 324 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}): |
325 newLine = os.linesep | 325 newLine = os.linesep |
476 # containing '@Test'. These are then determined to be the classes defining | 476 # containing '@Test'. These are then determined to be the classes defining |
477 # unit tests. | 477 # unit tests. |
478 _unittests = { | 478 _unittests = { |
479 'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'], | 479 'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'], |
480 } | 480 } |
481 _jtttests = { | |
482 'com.oracle.max.graal.jtt': ['com.oracle.max.graal.jtt'], | |
483 } | |
481 | 484 |
482 def _add_test_classes(testClassList, searchDir, pkgRoot): | 485 def _add_test_classes(testClassList, searchDir, pkgRoot): |
483 pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$") | 486 pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$") |
484 for root, _, files in os.walk(searchDir): | 487 for root, _, files in os.walk(searchDir): |
485 for name in files: | 488 for name in files: |
496 if line.strip().startswith('@Test'): | 499 if line.strip().startswith('@Test'): |
497 hasTest = True | 500 hasTest = True |
498 break | 501 break |
499 if hasTest: | 502 if hasTest: |
500 assert pkg is not None | 503 assert pkg is not None |
501 testClassList.append(pkg + '.' + name[:-len('.java')]) | 504 if pkg.startswith(pkgRoot): |
505 testClassList.append(pkg + '.' + name[:-len('.java')]) | |
502 | 506 |
503 def unittest(args): | 507 def unittest(args): |
504 """run the Graal Compiler Unit Tests in the GraalVM | 508 """run the Graal Compiler Unit Tests in the GraalVM |
505 | 509 |
506 If filters are supplied, only tests whose fully qualified name | 510 If filters are supplied, only tests whose fully qualified name |
525 if len(pos) != 0: | 529 if len(pos) != 0: |
526 classes = [c for c in classes if containsAny(c, pos)] | 530 classes = [c for c in classes if containsAny(c, pos)] |
527 if len(neg) != 0: | 531 if len(neg) != 0: |
528 classes = [c for c in classes if not containsAny(c, neg)] | 532 classes = [c for c in classes if not containsAny(c, neg)] |
529 | 533 |
530 # (ds) The boot class path must be used for some reason I don't quite understand | 534 vm(['-XX:-BootstrapGraal', '-esa', '-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) |
531 vm(['-XX:-BootstrapGraal', '-esa', '-Xbootclasspath/a:' + mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) | 535 |
536 def jtt(args): | |
537 """run the Java Tester Tests in the GraalVM | |
538 | |
539 If filters are supplied, only tests whose fully qualified name | |
540 include a filter as a substring are run. Negative filters are | |
541 those with a '-' prefix.""" | |
542 | |
543 pos = [a for a in args if a[0] != '-'] | |
544 neg = [a[1:] for a in args if a[0] == '-'] | |
545 | |
546 def containsAny(c, substrings): | |
547 for s in substrings: | |
548 if s in c: | |
549 return True | |
550 return False | |
551 | |
552 for proj in _jtttests.iterkeys(): | |
553 p = mx.project(proj) | |
554 classes = [] | |
555 for pkg in _jtttests[proj]: | |
556 _add_test_classes(classes, join(p.dir, 'src'), pkg) | |
557 | |
558 if len(pos) != 0: | |
559 classes = [c for c in classes if containsAny(c, pos)] | |
560 if len(neg) != 0: | |
561 classes = [c for c in classes if not containsAny(c, neg)] | |
562 | |
563 vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa', '-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) | |
532 | 564 |
533 def buildvms(args): | 565 def buildvms(args): |
534 """build one or more VMs in various configurations""" | 566 """build one or more VMs in various configurations""" |
535 | 567 |
536 parser = ArgumentParser(prog='mx buildvms'); | 568 parser = ArgumentParser(prog='mx buildvms'); |
632 tasks.append(t.stop()) | 664 tasks.append(t.stop()) |
633 | 665 |
634 t = Task('UnitTests:' + vmbuild) | 666 t = Task('UnitTests:' + vmbuild) |
635 unittest([]) | 667 unittest([]) |
636 tasks.append(t.stop()) | 668 tasks.append(t.stop()) |
669 | |
670 # t = Task('JavaTesterTests:' + vmbuild) | |
671 # jtt([]) | |
672 # tasks.append(t.stop()) | |
637 | 673 |
638 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 674 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
639 t = Task(str(test) + ':' + vmbuild) | 675 t = Task(str(test) + ':' + vmbuild) |
640 if not test.test('graal'): | 676 if not test.test('graal'): |
641 t.abort(test.group + ' ' + test.name + ' Failed') | 677 t.abort(test.group + ' ' + test.name + ' Failed') |
776 'example': [example, '[-v] example names...'], | 812 'example': [example, '[-v] example names...'], |
777 'gate' : [gate, '[-options]'], | 813 'gate' : [gate, '[-options]'], |
778 'gv' : [gv, ''], | 814 'gv' : [gv, ''], |
779 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], | 815 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
780 'unittest' : [unittest, '[filters...]'], | 816 'unittest' : [unittest, '[filters...]'], |
817 'jtt' : [jtt, '[filters...]'], | |
781 'vm': [vm, '[-options] class [args...]'] | 818 'vm': [vm, '[-options] class [args...]'] |
782 } | 819 } |
783 | 820 |
784 if (_vmSourcesAvailable): | 821 if (_vmSourcesAvailable): |
785 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') | 822 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') |