Mercurial > hg > graal-jvmci-8
comparison mx/commands.py @ 6291:633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 28 Aug 2012 11:09:14 +0200 |
parents | 4f9574b2893e |
children | b0fc02623974 |
comparison
equal
deleted
inserted
replaced
6285:471b9eb7419d | 6291:633136426f26 |
---|---|
77 */ | 77 */ |
78 | 78 |
79 """ | 79 """ |
80 | 80 |
81 def clean(args): | 81 def clean(args): |
82 """cleans the GraalVM source tree""" | 82 """clean the GraalVM source tree""" |
83 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) | 83 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
84 if opts.native: | 84 if opts.native: |
85 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') | 85 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') |
86 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) | 86 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) |
87 jdks = join(_graal_home, 'jdk' + mx.java().version) | 87 jdks = join(_graal_home, 'jdk' + mx.java().version) |
394 if logFile: | 394 if logFile: |
395 log.close() | 395 log.close() |
396 return ret | 396 return ret |
397 | 397 |
398 def jdkhome(args, vm=None): | 398 def jdkhome(args, vm=None): |
399 """prints the JDK directory selected for the 'vm' command""" | 399 """print the JDK directory selected for the 'vm' command""" |
400 | 400 |
401 build = _vmbuild if _vmSourcesAvailable else 'product' | 401 build = _vmbuild if _vmSourcesAvailable else 'product' |
402 print join(_graal_home, 'jdk' + mx.java().version, build) | 402 print join(_graal_home, 'jdk' + mx.java().version, build) |
403 | 403 |
404 def build(args, vm=None): | 404 def build(args, vm=None): |
606 """ | 606 """ |
607 | 607 |
608 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 | 608 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 |
609 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) | 609 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) |
610 | 610 |
611 def _run_tests(args, harnessName, harness): | 611 def _run_tests(args, harness): |
612 pos = [a for a in args if a[0] != '-' and a[0] != '@' ] | 612 pos = [a for a in args if a[0] != '-' and a[0] != '@' ] |
613 neg = [a[1:] for a in args if a[0] == '-'] | 613 neg = [a[1:] for a in args if a[0] == '-'] |
614 vmArgs = [a[1:] for a in args if a[0] == '@'] | 614 vmArgs = [a[1:] for a in args if a[0] == '@'] |
615 | 615 |
616 def containsAny(c, substrings): | 616 def containsAny(c, substrings): |
618 if s in c: | 618 if s in c: |
619 return True | 619 return True |
620 return False | 620 return False |
621 | 621 |
622 for p in mx.projects(): | 622 for p in mx.projects(): |
623 if getattr(p, 'testHarness', None) == harnessName: | 623 classes = _find_classes_with_annotations(p, None, ['@Test']) |
624 classes = _find_classes_with_annotations(p, None, ['@Test']) | 624 |
625 | 625 if len(pos) != 0: |
626 if len(pos) != 0: | 626 classes = [c for c in classes if containsAny(c, pos)] |
627 classes = [c for c in classes if containsAny(c, pos)] | 627 if len(neg) != 0: |
628 if len(neg) != 0: | 628 classes = [c for c in classes if not containsAny(c, neg)] |
629 classes = [c for c in classes if not containsAny(c, neg)] | 629 |
630 | 630 if len(classes) != 0: |
631 if len(classes) != 0: | 631 mx.log('running tests in ' + p.name) |
632 mx.log('running tests in ' + p.name) | 632 harness(p, vmArgs, classes) |
633 harness(p, vmArgs, classes) | |
634 | 633 |
635 def unittest(args): | 634 def unittest(args): |
636 """run the Graal Compiler Unit Tests in the GraalVM | 635 """run the JUnit tests |
637 | 636 |
638 If filters are supplied, only tests whose fully qualified name | 637 If filters are supplied, only tests whose fully qualified name |
639 include a filter as a substring are run. Negative filters are | 638 include a filter as a substring are run. Negative filters are |
640 those with a '-' prefix. VM args should have a @ prefix.""" | 639 those with a '-' prefix. VM args should have a @ prefix.""" |
641 | 640 |
642 def harness(p, vmArgs, classes): | 641 def harness(p, vmArgs, classes): |
643 vm(['-XX:-BootstrapGraal', '-esa'] + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) | 642 prefixArgs = ['-XX:-BootstrapGraal', '-esa'] |
644 _run_tests(args, 'unittest', harness) | 643 if p.name.endswith('.jtt'): |
645 | 644 prefixArgs = prefixArgs + [ |
646 def jtt(args): | 645 '-XX:CompileOnly=com/oracle/graal/jtt', |
647 """run the Java Tester Tests in the GraalVM | 646 '-XX:CompileCommand=compileonly,java/lang/Object::<init>', |
648 | 647 '-XX:CompileCommand=quiet', |
649 If filters are supplied, only tests whose fully qualified name | 648 '-Xcomp'] |
650 include a filter as a substring are run. Negative filters are | 649 vm(prefixArgs + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) |
651 those with a '-' prefix. VM args should have a @ prefix.""" | 650 _run_tests(args, harness) |
652 | |
653 def harness(p, vmArgs, classes): | |
654 vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=com/oracle/graal/jtt', '-XX:CompileCommand=compileonly,java/lang/Object::<init>', '-XX:CompileCommand=quiet', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) | |
655 _run_tests(args, 'jtt', harness) | |
656 | 651 |
657 def buildvms(args): | 652 def buildvms(args): |
658 """build one or more VMs in various configurations""" | 653 """build one or more VMs in various configurations""" |
659 | 654 |
660 parser = ArgumentParser(prog='mx buildvms'); | 655 parser = ArgumentParser(prog='mx buildvms'); |
751 t = Task('BootstrapWithSystemAssertions:' + vmbuild) | 746 t = Task('BootstrapWithSystemAssertions:' + vmbuild) |
752 vm(['-esa', '-version']) | 747 vm(['-esa', '-version']) |
753 tasks.append(t.stop()) | 748 tasks.append(t.stop()) |
754 | 749 |
755 t = Task('UnitTests:' + vmbuild) | 750 t = Task('UnitTests:' + vmbuild) |
756 unittest([]) | 751 unittest(['@-XX:CompileCommand=exclude,*::run*'] if vmbuild == 'product' else []) |
757 tasks.append(t.stop()) | |
758 | |
759 t = Task('JavaTesterTests:' + vmbuild) | |
760 jtt(['@-XX:CompileCommand=exclude,*::run*'] if vmbuild == 'product' else []) | |
761 tasks.append(t.stop()) | 752 tasks.append(t.stop()) |
762 | 753 |
763 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 754 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
764 t = Task(str(test) + ':' + vmbuild) | 755 t = Task(str(test) + ':' + vmbuild) |
765 if not test.test('graal'): | 756 if not test.test('graal'): |
933 benchArgs.remove(args[itIdx+1]) | 924 benchArgs.remove(args[itIdx+1]) |
934 vm = _vm; | 925 vm = _vm; |
935 sanitycheck.getSPECjvm2008(benchArgs, skipValid, wt, it).bench(vm, opts=vmArgs) | 926 sanitycheck.getSPECjvm2008(benchArgs, skipValid, wt, it).bench(vm, opts=vmArgs) |
936 | 927 |
937 def hsdis(args, copyToDir=None): | 928 def hsdis(args, copyToDir=None): |
938 """downloads the hsdis library | 929 """download the hsdis library |
939 | 930 |
940 This is needed to support HotSpot's assembly dumping features. | 931 This is needed to support HotSpot's assembly dumping features. |
941 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax.""" | 932 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax.""" |
942 flavor = 'intel' | 933 flavor = 'intel' |
943 if 'att' in args: | 934 if 'att' in args: |
948 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) | 939 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) |
949 if copyToDir is not None and exists(copyToDir): | 940 if copyToDir is not None and exists(copyToDir): |
950 shutil.copy(path, copyToDir) | 941 shutil.copy(path, copyToDir) |
951 | 942 |
952 def hcfdis(args): | 943 def hcfdis(args): |
953 """disassembles HexCodeFiles embedded in text files | 944 """disassemble HexCodeFiles embedded in text files |
954 | 945 |
955 Run a tool over the input files to convert all embedded HexCodeFiles | 946 Run a tool over the input files to convert all embedded HexCodeFiles |
956 to a disassembled format.""" | 947 to a disassembled format.""" |
957 path = join(_graal_home, 'lib', 'hcfdis-1.jar') | 948 path = join(_graal_home, 'lib', 'hcfdis-1.jar') |
958 if not exists(path): | 949 if not exists(path): |
959 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-1.jar']) | 950 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-1.jar']) |
960 mx.run_java(['-jar', path] + args) | 951 mx.run_java(['-jar', path] + args) |
961 | 952 |
962 def jacocoreport(args): | 953 def jacocoreport(args): |
963 """creates a JaCoCo coverage report | 954 """create a JaCoCo coverage report |
964 | 955 |
965 Creates the report from the 'jacoco.exec' file in the current directory. | 956 Creates the report from the 'jacoco.exec' file in the current directory. |
966 Default output directory is 'coverage', but an alternative can be provided as an argument.""" | 957 Default output directory is 'coverage', but an alternative can be provided as an argument.""" |
967 jacocoreport = mx.library("JACOCOREPORT", True) | 958 jacocoreport = mx.library("JACOCOREPORT", True) |
968 out = 'coverage' | 959 out = 'coverage' |
971 elif len(args) > 1: | 962 elif len(args) > 1: |
972 mx.abort('jacocoreport takes only one argument : an output directory') | 963 mx.abort('jacocoreport takes only one argument : an output directory') |
973 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out]) | 964 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out]) |
974 | 965 |
975 def site(args): | 966 def site(args): |
976 """creates a website containing javadoc and the project dependency graph""" | 967 """create a website containing javadoc and the project dependency graph""" |
977 | 968 |
978 return mx.site(['--name', 'Graal', | 969 return mx.site(['--name', 'Graal', |
979 '--jd', '@-tag', '--jd', '@test:X', | 970 '--jd', '@-tag', '--jd', '@test:X', |
980 '--jd', '@-tag', '--jd', '@run:X', | 971 '--jd', '@-tag', '--jd', '@run:X', |
981 '--jd', '@-tag', '--jd', '@bug:X', | 972 '--jd', '@-tag', '--jd', '@bug:X', |
1001 #'example': [example, '[-v] example names...'], | 992 #'example': [example, '[-v] example names...'], |
1002 'gate' : [gate, '[-options]'], | 993 'gate' : [gate, '[-options]'], |
1003 'gv' : [gv, ''], | 994 'gv' : [gv, ''], |
1004 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], | 995 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
1005 'unittest' : [unittest, '[filters...]'], | 996 'unittest' : [unittest, '[filters...]'], |
1006 'jtt' : [jtt, '[filters...]'], | |
1007 'jacocoreport' : [jacocoreport, '[output directory]'], | 997 'jacocoreport' : [jacocoreport, '[output directory]'], |
1008 'site' : [site, '[-options]'], | 998 'site' : [site, '[-options]'], |
1009 'vm': [vm, '[-options] class [args...]'], | 999 'vm': [vm, '[-options] class [args...]'], |
1010 'vmg': [vmg, '[-options] class [args...]'], | 1000 'vmg': [vmg, '[-options] class [args...]'], |
1011 'vmfg': [vmfg, '[-options] class [args...]'] | 1001 'vmfg': [vmfg, '[-options] class [args...]'] |