Mercurial > hg > graal-jvmci-8
comparison mx/commands.py @ 11359:51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 19 Aug 2013 12:55:34 +0200 |
parents | fcb4cf14a3c3 |
children | 39b86b83ddeb |
comparison
equal
deleted
inserted
replaced
11349:67969c1f20fb | 11359:51b0b1104114 |
---|---|
769 """ | 769 """ |
770 | 770 |
771 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 | 771 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 |
772 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) | 772 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) |
773 | 773 |
774 def _extract_VM_args(args, allowClasspath=False): | |
775 """ | |
776 Partitions a command line into a leading sequence of HotSpot VM options and the rest. | |
777 """ | |
778 for i in range(0, len(args)): | |
779 if not args[i].startswith('-'): | |
780 if i != 0 and (args[i - 1] == '-cp' or args[i - 1] == '-classpath'): | |
781 if not allowClasspath: | |
782 mx.abort('Cannot supply explicit class path option') | |
783 else: | |
784 continue | |
785 vmArgs = args[:i] | |
786 remainder = args[i:] | |
787 return vmArgs, remainder | |
788 return args, [] | |
789 | |
774 def _run_tests(args, harness, annotations, testfile): | 790 def _run_tests(args, harness, annotations, testfile): |
775 tests = [a for a in args if a[0] != '@' ] | 791 |
776 vmArgs = [a[1:] for a in args if a[0] == '@'] | 792 |
793 vmArgs, tests = _extract_VM_args(args) | |
794 for t in tests: | |
795 if t.startswith('-'): | |
796 mx.abort('VM option ' + t + ' must precede first test name') | |
777 | 797 |
778 def containsAny(c, substrings): | 798 def containsAny(c, substrings): |
779 for s in substrings: | 799 for s in substrings: |
780 if s in c: | 800 if s in c: |
781 return True | 801 return True |
790 classes = [] | 810 classes = [] |
791 if len(tests) == 0: | 811 if len(tests) == 0: |
792 classes = candidates | 812 classes = candidates |
793 else: | 813 else: |
794 for t in tests: | 814 for t in tests: |
795 if t.startswith('-'): | |
796 mx.abort('VM option needs @ prefix (i.e., @' + t + ')') | |
797 | |
798 found = False | 815 found = False |
799 for c in candidates: | 816 for c in candidates: |
800 if t in c: | 817 if t in c: |
801 found = True | 818 found = True |
802 classes.append(c) | 819 classes.append(c) |
847 _unittestHelpSuffix = """ | 864 _unittestHelpSuffix = """ |
848 | 865 |
849 If filters are supplied, only tests whose fully qualified name | 866 If filters are supplied, only tests whose fully qualified name |
850 includes a filter as a substring are run. | 867 includes a filter as a substring are run. |
851 | 868 |
852 Options with a '@' prefix are passed to the VM. | |
853 | |
854 For example, this command line: | 869 For example, this command line: |
855 | 870 |
856 mx unittest BC_aload @-G:Dump= @-G:MethodFilter=BC_aload.* @-G:+PrintCFG | 871 mx unittest -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG BC_aload @ |
857 | 872 |
858 will run all JUnit test classes that contain 'BC_aload' in their | 873 will run all JUnit test classes that contain 'BC_aload' in their |
859 fully qualified name and will pass these options to the VM: | 874 fully qualified name and will pass these options to the VM: |
860 | 875 |
861 -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG | 876 -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG |
866 MX_TESTFILE environment variable can be set to specify a | 881 MX_TESTFILE environment variable can be set to specify a |
867 file which will not be deleted once the unittests are done | 882 file which will not be deleted once the unittests are done |
868 (unlike the temporary file otherwise used). | 883 (unlike the temporary file otherwise used). |
869 | 884 |
870 As with all other commands, using the global '-v' before 'unittest' | 885 As with all other commands, using the global '-v' before 'unittest' |
871 command will cause mx to show the complete shell command line | 886 command will cause mx to show the complete command line |
872 it uses to run the VM. | 887 it uses to run the VM. |
873 """ | 888 """ |
874 | 889 |
875 def unittest(args): | 890 def unittest(args): |
876 """run the JUnit tests (all testcases){0}""" | 891 """run the JUnit tests (all testcases){0}""" |
1075 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild) | 1090 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild) |
1076 dacapo(['pmd']) | 1091 dacapo(['pmd']) |
1077 tasks.append(t.stop()) | 1092 tasks.append(t.stop()) |
1078 | 1093 |
1079 t = Task('UnitTests:' + theVm + ':' + vmbuild) | 1094 t = Task('UnitTests:' + theVm + ':' + vmbuild) |
1080 unittest(['@-XX:CompileCommand=exclude,*::run*', 'graal.api']) | 1095 unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) |
1081 tasks.append(t.stop()) | 1096 tasks.append(t.stop()) |
1082 | 1097 |
1083 except KeyboardInterrupt: | 1098 except KeyboardInterrupt: |
1084 total.abort(1) | 1099 total.abort(1) |
1085 | 1100 |
1379 'specjbb2013': [specjbb2013, '[VM options]'], | 1394 'specjbb2013': [specjbb2013, '[VM options]'], |
1380 'specjbb2005': [specjbb2005, '[VM options]'], | 1395 'specjbb2005': [specjbb2005, '[VM options]'], |
1381 'gate' : [gate, '[-options]'], | 1396 'gate' : [gate, '[-options]'], |
1382 'gv' : [gv, ''], | 1397 'gv' : [gv, ''], |
1383 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], | 1398 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
1384 'unittest' : [unittest, '[filters...|@VM options]', _unittestHelpSuffix], | 1399 'unittest' : [unittest, '[VM options] [filters...]', _unittestHelpSuffix], |
1385 'longunittest' : [longunittest, '[filters...|@VM options]', _unittestHelpSuffix], | 1400 'longunittest' : [longunittest, '[VM options] [filters...]', _unittestHelpSuffix], |
1386 'shortunittest' : [shortunittest, '[filters...|@VM options]', _unittestHelpSuffix], | 1401 'shortunittest' : [shortunittest, '[VM options] [filters...]', _unittestHelpSuffix], |
1387 'jacocoreport' : [jacocoreport, '[output directory]'], | 1402 'jacocoreport' : [jacocoreport, '[output directory]'], |
1388 'site' : [site, '[-options]'], | 1403 'site' : [site, '[-options]'], |
1389 'vm': [vm, '[-options] class [args...]'], | 1404 'vm': [vm, '[-options] class [args...]'], |
1390 'vmg': [vmg, '[-options] class [args...]'], | 1405 'vmg': [vmg, '[-options] class [args...]'], |
1391 'vmfg': [vmfg, '[-options] class [args...]'], | 1406 'vmfg': [vmfg, '[-options] class [args...]'], |