comparison mx/commands.py @ 8343:a3c30d467f96

unittest: just do a single JVM call avoid multiple executions of the JVM in order to avoid high startup costs. before: > mx --vm server unittest 355.86s user 2.97s system 175% cpu 3:24.21 total > mx --vm server longunittest 241.27s user 1.40s system 151% cpu 2:39.88 total > mx --vm server shortunittest 203.36s user 2.23s system 269% cpu 1:16.42 total after: > mx --vm server unittest 202.39s user 1.02s system 130% cpu 2:36.04 total > mx --vm server longunittest 187.39s user 0.97s system 126% cpu 2:28.38 total > mx --vm server shortunittest 87.39s user 0.68s system 265% cpu 33.15 total
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 18 Mar 2013 15:11:52 +0100
parents d9d883aeb96f
children 2bfb9644dcc2
comparison
equal deleted inserted replaced
8342:90e51c504f37 8343:a3c30d467f96
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, annotations) 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)
744 746
745 def _unittest(args, annotations): 747 def _unittest(args, annotations):
746 def harness(p, vmArgs, classes): 748 def harness(projectscp, vmArgs, classes):
747 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] 749 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
748 vm(prefixArgs + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) 750 vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + classes)
749 _run_tests(args, harness, annotations) 751 _run_tests(args, harness, annotations)
750 752
751 def unittest(args): 753 def unittest(args):
752 """run the JUnit tests (all testcases) 754 """run the JUnit tests (all testcases)
753 755