Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/mx/commands.py Tue Mar 19 11:30:58 2013 +0100 +++ b/mx/commands.py Tue Mar 19 11:35:25 2013 +0100 @@ -719,7 +719,7 @@ matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) -def _run_tests(args, harness): +def _run_tests(args, harness, annotations): pos = [a for a in args if a[0] != '-' and a[0] != '@' ] neg = [a[1:] for a in args if a[0] == '-'] vmArgs = [a[1:] for a in args if a[0] == '@'] @@ -730,29 +730,52 @@ return True return False + classes = [] for p in mx.projects(): - classes = _find_classes_with_annotations(p, None, ['@Test']) + 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(projectscp, vmArgs, classes): + prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] + vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + classes) + _run_tests(args, harness, annotations) def unittest(args): - """run the JUnit tests + """run the JUnit tests (all testcases) If filters are supplied, only tests whose fully qualified name include a filter as a substring are run. Negative filters are those with a '-' prefix. VM args should have a @ prefix.""" - def harness(p, vmArgs, classes): - prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] - vm(prefixArgs + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes) - _run_tests(args, harness) + _unittest(args, ['@Test', '@LongTest']) + +def shortunittest(args): + """run the JUnit tests (short testcases only) + + If filters are supplied, only tests whose fully qualified name + include a filter as a substring are run. Negative filters are + those with a '-' prefix. VM args should have a @ prefix.""" + + _unittest(args, ['@Test']) + +def longunittest(args): + """run the JUnit tests (long testcases only) + + If filters are supplied, only tests whose fully qualified name + include a filter as a substring are run. Negative filters are + those with a '-' prefix. VM args should have a @ prefix.""" + + _unittest(args, ['@LongTest']) def buildvms(args): """build one or more VMs in various configurations""" @@ -872,7 +895,7 @@ t = Task('BootstrapWithRegisterPressure:product') vm(['-G:RegisterPressure=rbx,r11,r14,xmm3,xmm11,xmm14', '-esa', '-version']) tasks.append(t.stop()) - + originalVm = _vm _vm = 'server' # hosted mode t = Task('UnitTests:hosted-product') @@ -1193,6 +1216,8 @@ 'gv' : [gv, ''], 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 'unittest' : [unittest, '[filters...]'], + 'longunittest' : [longunittest, '[filters...]'], + 'shortunittest' : [shortunittest, '[filters...]'], 'jacocoreport' : [jacocoreport, '[output directory]'], 'site' : [site, '[-options]'], 'vm': [vm, '[-options] class [args...]'],