Mercurial > hg > truffle
comparison mx/commands.py @ 8362:5981ea5996e8
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 19 Mar 2013 11:35:25 +0100 |
parents | a3c30d467f96 |
children | 2bfb9644dcc2 |
comparison
equal
deleted
inserted
replaced
8361:676fa31bd3f0 | 8362:5981ea5996e8 |
---|---|
717 """ | 717 """ |
718 | 718 |
719 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 | 719 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 |
720 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) | 720 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) |
721 | 721 |
722 def _run_tests(args, harness): | 722 def _run_tests(args, harness, annotations): |
723 pos = [a for a in args if a[0] != '-' and a[0] != '@' ] | 723 pos = [a for a in args if a[0] != '-' and a[0] != '@' ] |
724 neg = [a[1:] for a in args if a[0] == '-'] | 724 neg = [a[1:] for a in args if a[0] == '-'] |
725 vmArgs = [a[1:] for a in args if a[0] == '@'] | 725 vmArgs = [a[1:] for a in args if a[0] == '@'] |
726 | 726 |
727 def containsAny(c, substrings): | 727 def containsAny(c, substrings): |
728 for s in substrings: | 728 for s in substrings: |
729 if s in c: | 729 if s in c: |
730 return True | 730 return True |
731 return False | 731 return False |
732 | 732 |
733 classes = [] | |
733 for p in mx.projects(): | 734 for p in mx.projects(): |
734 classes = _find_classes_with_annotations(p, None, ['@Test']) | 735 classes += _find_classes_with_annotations(p, None, annotations) |
735 | 736 |
736 if len(pos) != 0: | 737 if len(pos) != 0: |
737 classes = [c for c in classes if containsAny(c, pos)] | 738 classes = [c for c in classes if containsAny(c, pos)] |
738 if len(neg) != 0: | 739 if len(neg) != 0: |
739 classes = [c for c in classes if not containsAny(c, neg)] | 740 classes = [c for c in classes if not containsAny(c, neg)] |
740 | 741 |
741 if len(classes) != 0: | 742 projectscp = mx.classpath([pcp.name for pcp in mx.projects()]) |
742 mx.log('running tests in ' + p.name) | 743 |
743 harness(p, vmArgs, classes) | 744 if len(classes) != 0: |
745 harness(projectscp, vmArgs, classes) | |
746 | |
747 def _unittest(args, annotations): | |
748 def harness(projectscp, vmArgs, classes): | |
749 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] | |
750 vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + classes) | |
751 _run_tests(args, harness, annotations) | |
744 | 752 |
745 def unittest(args): | 753 def unittest(args): |
746 """run the JUnit tests | 754 """run the JUnit tests (all testcases) |
747 | 755 |
748 If filters are supplied, only tests whose fully qualified name | 756 If filters are supplied, only tests whose fully qualified name |
749 include a filter as a substring are run. Negative filters are | 757 include a filter as a substring are run. Negative filters are |
750 those with a '-' prefix. VM args should have a @ prefix.""" | 758 those with a '-' prefix. VM args should have a @ prefix.""" |
751 | 759 |
752 def harness(p, vmArgs, classes): | 760 _unittest(args, ['@Test', '@LongTest']) |
753 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] | 761 |
754 vm(prefixArgs + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) | 762 def shortunittest(args): |
755 _run_tests(args, harness) | 763 """run the JUnit tests (short testcases only) |
764 | |
765 If filters are supplied, only tests whose fully qualified name | |
766 include a filter as a substring are run. Negative filters are | |
767 those with a '-' prefix. VM args should have a @ prefix.""" | |
768 | |
769 _unittest(args, ['@Test']) | |
770 | |
771 def longunittest(args): | |
772 """run the JUnit tests (long testcases only) | |
773 | |
774 If filters are supplied, only tests whose fully qualified name | |
775 include a filter as a substring are run. Negative filters are | |
776 those with a '-' prefix. VM args should have a @ prefix.""" | |
777 | |
778 _unittest(args, ['@LongTest']) | |
756 | 779 |
757 def buildvms(args): | 780 def buildvms(args): |
758 """build one or more VMs in various configurations""" | 781 """build one or more VMs in various configurations""" |
759 | 782 |
760 parser = ArgumentParser(prog='mx buildvms'); | 783 parser = ArgumentParser(prog='mx buildvms'); |
870 | 893 |
871 _vmbuild = 'product' | 894 _vmbuild = 'product' |
872 t = Task('BootstrapWithRegisterPressure:product') | 895 t = Task('BootstrapWithRegisterPressure:product') |
873 vm(['-G:RegisterPressure=rbx,r11,r14,xmm3,xmm11,xmm14', '-esa', '-version']) | 896 vm(['-G:RegisterPressure=rbx,r11,r14,xmm3,xmm11,xmm14', '-esa', '-version']) |
874 tasks.append(t.stop()) | 897 tasks.append(t.stop()) |
875 | 898 |
876 originalVm = _vm | 899 originalVm = _vm |
877 _vm = 'server' # hosted mode | 900 _vm = 'server' # hosted mode |
878 t = Task('UnitTests:hosted-product') | 901 t = Task('UnitTests:hosted-product') |
879 unittest([]) | 902 unittest([]) |
880 tasks.append(t.stop()) | 903 tasks.append(t.stop()) |
1191 #'example': [example, '[-v] example names...'], | 1214 #'example': [example, '[-v] example names...'], |
1192 'gate' : [gate, '[-options]'], | 1215 'gate' : [gate, '[-options]'], |
1193 'gv' : [gv, ''], | 1216 'gv' : [gv, ''], |
1194 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], | 1217 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
1195 'unittest' : [unittest, '[filters...]'], | 1218 'unittest' : [unittest, '[filters...]'], |
1219 'longunittest' : [longunittest, '[filters...]'], | |
1220 'shortunittest' : [shortunittest, '[filters...]'], | |
1196 'jacocoreport' : [jacocoreport, '[output directory]'], | 1221 'jacocoreport' : [jacocoreport, '[output directory]'], |
1197 'site' : [site, '[-options]'], | 1222 'site' : [site, '[-options]'], |
1198 'vm': [vm, '[-options] class [args...]'], | 1223 'vm': [vm, '[-options] class [args...]'], |
1199 'vmg': [vmg, '[-options] class [args...]'], | 1224 'vmg': [vmg, '[-options] class [args...]'], |
1200 'vmfg': [vmfg, '[-options] class [args...]'], | 1225 'vmfg': [vmfg, '[-options] class [args...]'], |