# HG changeset patch # User Bernhard Urban # Date 1363615912 -3600 # Node ID a3c30d467f965b3224918e19fdc4137945716c7b # Parent 90e51c504f3738857a216781a00ecbaff79e3688 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 diff -r 90e51c504f37 -r a3c30d467f96 mx/commands.py --- a/mx/commands.py Thu Mar 14 16:27:08 2013 +0100 +++ b/mx/commands.py Mon Mar 18 15:11:52 2013 +0100 @@ -730,22 +730,24 @@ return True return False + classes = [] for p in mx.projects(): - classes = _find_classes_with_annotations(p, None, annotations) + classes += _find_classes_with_annotations(p, None, annotations) if len(pos) != 0: classes = [c for c in classes if containsAny(c, pos)] if len(neg) != 0: classes = [c for c in classes if not containsAny(c, neg)] - if len(classes) != 0: - mx.log('running tests in ' + p.name) - harness(p, vmArgs, classes) + projectscp = mx.classpath([pcp.name for pcp in mx.projects()]) + + if len(classes) != 0: + harness(projectscp, vmArgs, classes) def _unittest(args, annotations): - def harness(p, vmArgs, classes): + def harness(projectscp, vmArgs, classes): prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] - vm(prefixArgs + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) + vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + classes) _run_tests(args, harness, annotations) def unittest(args):