comparison mx/commands.py @ 9704:f9a65a0e626b

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Mon, 13 May 2013 17:11:31 +0200
parents fde5ccbab3a3
children 1ef7b26e9177
comparison
equal deleted inserted replaced
9703:57113d21ce36 9704:f9a65a0e626b
747 excludes = ['com.oracle.graal.compiler.tests.*', 'com.oracle.graal.jtt.*'] 747 excludes = ['com.oracle.graal.compiler.tests.*', 'com.oracle.graal.jtt.*']
748 for p in mx.projects(): 748 for p in mx.projects():
749 excludes += _find_classes_with_annotations(p, None, ['@Snippet', '@ClassSubstitution', '@Test'], includeInnerClasses=True).keys() 749 excludes += _find_classes_with_annotations(p, None, ['@Snippet', '@ClassSubstitution', '@Test'], includeInnerClasses=True).keys()
750 excludes += p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True).keys() 750 excludes += p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True).keys()
751 751
752 includes = ['com.oracle.graal.*', 'com.oracle.max.*'] 752 includes = ['com.oracle.graal.*']
753 agentOptions = { 753 agentOptions = {
754 'append' : 'true' if _jacoco == 'append' else 'false', 754 'append' : 'true' if _jacoco == 'append' else 'false',
755 'bootclasspath' : 'true', 755 'bootclasspath' : 'true',
756 'includes' : ':'.join(includes), 756 'includes' : ':'.join(includes),
757 'excludes' : ':'.join(excludes), 757 'excludes' : ':'.join(excludes),
786 return True 786 return True
787 return False 787 return False
788 788
789 classes = [] 789 classes = []
790 for p in mx.projects(): 790 for p in mx.projects():
791 if mx.java().javaCompliance < p.javaCompliance:
792 continue
791 classes += _find_classes_with_annotations(p, None, annotations).keys() 793 classes += _find_classes_with_annotations(p, None, annotations).keys()
792 794
793 if len(pos) != 0: 795 if len(pos) != 0:
794 classes = [c for c in classes if containsAny(c, pos)] 796 classes = [c for c in classes if containsAny(c, pos)]
795 if len(neg) != 0: 797 if len(neg) != 0:
796 classes = [c for c in classes if not containsAny(c, neg)] 798 classes = [c for c in classes if not containsAny(c, neg)]
797 799
798 projectscp = mx.classpath([pcp.name for pcp in mx.projects()]) 800 projectscp = mx.classpath([pcp.name for pcp in mx.projects() if pcp.javaCompliance <= mx.java().javaCompliance])
799 801
800 if len(classes) != 0: 802 if len(classes) != 0:
801 f_testfile = open(testfile, 'w') 803 f_testfile = open(testfile, 'w')
802 for c in classes: 804 for c in classes:
803 f_testfile.write(c + '\n') 805 f_testfile.write(c + '\n')
827 _run_tests(args, harness, annotations, testfile) 829 _run_tests(args, harness, annotations, testfile)
828 finally: 830 finally:
829 if os.environ.get('MX_TESTFILE') is None: 831 if os.environ.get('MX_TESTFILE') is None:
830 os.remove(testfile) 832 os.remove(testfile)
831 833
834 _unittestHelpSuffix = """
835
836 If filters are supplied, only tests whose fully qualified name
837 includes a filter as a substring are run. Negative filters are
838 those with a '-' prefix.
839
840 Options with a '@' prefix are passed to the VM.
841
842 For example, this command line:
843
844 mx unittest BC_aload @-G:Dump= @-G:MethodFilter=BC_aload.* @-G:+PrintCFG
845
846 will run all JUnit test classes that contain 'BC_aload' in their
847 fully qualified name and will pass these options to the VM:
848
849 -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG
850
851 To get around command line length limitations on some OSes, the
852 JUnit class names to be executed are written to a file that a
853 custom JUnit wrapper reads and passes onto JUnit proper. The
854 MX_TESTFILE environment variable can be set to specify a
855 file which will not be deleted once the unittests are done
856 (unlike the temporary file otherwise used).
857
858 As with all other commands, using the global '-v' before 'unittest'
859 command will cause mx to show the complete shell command line
860 it uses to run the VM.
861 """
862
832 def unittest(args): 863 def unittest(args):
833 """run the JUnit tests (all testcases) 864 """run the JUnit tests (all testcases){0}"""
834
835 If filters are supplied, only tests whose fully qualified name
836 include a filter as a substring are run. Negative filters are
837 those with a '-' prefix. VM args should have a @ prefix."""
838 865
839 _unittest(args, ['@Test', '@LongTest']) 866 _unittest(args, ['@Test', '@LongTest'])
840 867
841 def shortunittest(args): 868 def shortunittest(args):
842 """run the JUnit tests (short testcases only) 869 """run the JUnit tests (short testcases only){0}"""
843
844 If filters are supplied, only tests whose fully qualified name
845 include a filter as a substring are run. Negative filters are
846 those with a '-' prefix. VM args should have a @ prefix."""
847 870
848 _unittest(args, ['@Test']) 871 _unittest(args, ['@Test'])
849 872
850 def longunittest(args): 873 def longunittest(args):
851 """run the JUnit tests (long testcases only) 874 """run the JUnit tests (long testcases only){0}"""
852
853 If filters are supplied, only tests whose fully qualified name
854 include a filter as a substring are run. Negative filters are
855 those with a '-' prefix. VM args should have a @ prefix."""
856 875
857 _unittest(args, ['@LongTest']) 876 _unittest(args, ['@LongTest'])
858 877
859 def buildvms(args): 878 def buildvms(args):
860 """build one or more VMs in various configurations""" 879 """build one or more VMs in various configurations"""
1339 'specjbb2013': [specjbb2013, '[VM options]'], 1358 'specjbb2013': [specjbb2013, '[VM options]'],
1340 'specjbb2005': [specjbb2005, '[VM options]'], 1359 'specjbb2005': [specjbb2005, '[VM options]'],
1341 'gate' : [gate, '[-options]'], 1360 'gate' : [gate, '[-options]'],
1342 'gv' : [gv, ''], 1361 'gv' : [gv, ''],
1343 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 1362 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'],
1344 'unittest' : [unittest, '[filters...]'], 1363 'unittest' : [unittest, '[filters...|@VM options]', _unittestHelpSuffix],
1345 'longunittest' : [longunittest, '[filters...]'], 1364 'longunittest' : [longunittest, '[filters...|@VM options]', _unittestHelpSuffix],
1346 'shortunittest' : [shortunittest, '[filters...]'], 1365 'shortunittest' : [shortunittest, '[filters...|@VM options]', _unittestHelpSuffix],
1347 'jacocoreport' : [jacocoreport, '[output directory]'], 1366 'jacocoreport' : [jacocoreport, '[output directory]'],
1348 'site' : [site, '[-options]'], 1367 'site' : [site, '[-options]'],
1349 'vm': [vm, '[-options] class [args...]'], 1368 'vm': [vm, '[-options] class [args...]'],
1350 'vmg': [vmg, '[-options] class [args...]'], 1369 'vmg': [vmg, '[-options] class [args...]'],
1351 'vmfg': [vmfg, '[-options] class [args...]'], 1370 'vmfg': [vmfg, '[-options] class [args...]'],