Mercurial > hg > graal-jvmci-8
comparison mx/mx_graal.py @ 16393:380290b81eb0
mx: converted class path variables to camel case for better readability
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 03 Jul 2014 14:29:21 +0200 |
parents | 31e242cad4d1 |
children | 0dd27c6472d7 |
comparison
equal
deleted
inserted
replaced
16392:5af4dd229520 | 16393:380290b81eb0 |
---|---|
969 candidates[c] = p | 969 candidates[c] = p |
970 | 970 |
971 classes = [] | 971 classes = [] |
972 if len(tests) == 0: | 972 if len(tests) == 0: |
973 classes = candidates.keys() | 973 classes = candidates.keys() |
974 projectscp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) | 974 projectsCp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) |
975 else: | 975 else: |
976 projs = set() | 976 projs = set() |
977 if len(tests) == 1 and '#' in tests[0]: | 977 if len(tests) == 1 and '#' in tests[0]: |
978 words = tests[0].split('#') | 978 words = tests[0].split('#') |
979 if len(words) != 2: | 979 if len(words) != 2: |
997 found = True | 997 found = True |
998 classes.append(c) | 998 classes.append(c) |
999 projs.add(p.name) | 999 projs.add(p.name) |
1000 if not found: | 1000 if not found: |
1001 mx.log('warning: no tests matched by substring "' + t) | 1001 mx.log('warning: no tests matched by substring "' + t) |
1002 projectscp = mx.classpath(projs) | 1002 projectsCp = mx.classpath(projs) |
1003 | 1003 |
1004 if whitelist: | 1004 if whitelist: |
1005 classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] | 1005 classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] |
1006 | 1006 |
1007 if regex: | 1007 if regex: |
1010 if len(classes) != 0: | 1010 if len(classes) != 0: |
1011 f_testfile = open(testfile, 'w') | 1011 f_testfile = open(testfile, 'w') |
1012 for c in classes: | 1012 for c in classes: |
1013 f_testfile.write(c + '\n') | 1013 f_testfile.write(c + '\n') |
1014 f_testfile.close() | 1014 f_testfile.close() |
1015 harness(projectscp, vmArgs) | 1015 harness(projectsCp, vmArgs) |
1016 | 1016 |
1017 def _unittest(args, annotations, prefixcp="", whitelist=None, verbose=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): | 1017 def _unittest(args, annotations, prefixCp="", whitelist=None, verbose=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): |
1018 mxdir = dirname(__file__) | 1018 mxdir = dirname(__file__) |
1019 name = 'JUnitWrapper' | 1019 name = 'JUnitWrapper' |
1020 javaSource = join(mxdir, name + '.java') | 1020 javaSource = join(mxdir, name + '.java') |
1021 javaClass = join(mxdir, name + '.class') | 1021 javaClass = join(mxdir, name + '.class') |
1022 testfile = os.environ.get('MX_TESTFILE', None) | 1022 testfile = os.environ.get('MX_TESTFILE', None) |
1023 if testfile is None: | 1023 if testfile is None: |
1024 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") | 1024 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") |
1025 os.close(_) | 1025 os.close(_) |
1026 corecp = mx.classpath(['com.oracle.graal.test']) | 1026 coreCp = mx.classpath(['com.oracle.graal.test']) |
1027 | 1027 |
1028 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): | 1028 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): |
1029 subprocess.check_call([mx.java().javac, '-cp', corecp, '-d', mxdir, javaSource]) | 1029 subprocess.check_call([mx.java().javac, '-cp', coreCp, '-d', mxdir, javaSource]) |
1030 | 1030 |
1031 coreArgs = [] | 1031 coreArgs = [] |
1032 if verbose: | 1032 if verbose: |
1033 coreArgs.append('-JUnitVerbose') | 1033 coreArgs.append('-JUnitVerbose') |
1034 if enable_timing: | 1034 if enable_timing: |
1039 coreArgs.append('-JUnitEagerStackTrace') | 1039 coreArgs.append('-JUnitEagerStackTrace') |
1040 if gc_after_test: | 1040 if gc_after_test: |
1041 coreArgs.append('-JUnitGCAfterTest') | 1041 coreArgs.append('-JUnitGCAfterTest') |
1042 | 1042 |
1043 | 1043 |
1044 def harness(projectscp, vmArgs): | 1044 def harness(projectsCp, vmArgs): |
1045 if _get_vm() != 'graal': | 1045 if _get_vm() != 'graal': |
1046 prefixArgs = ['-esa', '-ea'] | 1046 prefixArgs = ['-esa', '-ea'] |
1047 else: | 1047 else: |
1048 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] | 1048 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] |
1049 if gc_after_test: | 1049 if gc_after_test: |
1051 with open(testfile) as fp: | 1051 with open(testfile) as fp: |
1052 testclasses = [l.rstrip() for l in fp.readlines()] | 1052 testclasses = [l.rstrip() for l in fp.readlines()] |
1053 if len(testclasses) == 1: | 1053 if len(testclasses) == 1: |
1054 # Execute Junit directly when one test is being run. This simplifies | 1054 # Execute Junit directly when one test is being run. This simplifies |
1055 # replaying the VM execution in a native debugger (e.g., gdb). | 1055 # replaying the VM execution in a native debugger (e.g., gdb). |
1056 vm(prefixArgs + vmArgs + ['-cp', prefixcp + corecp + ':' + projectscp, 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + testclasses) | 1056 vm(prefixArgs + vmArgs + ['-cp', prefixCp + coreCp + ':' + projectsCp, 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + testclasses) |
1057 else: | 1057 else: |
1058 vm(prefixArgs + vmArgs + ['-cp', prefixcp + corecp + ':' + projectscp + os.pathsep + mxdir, name] + [testfile] + coreArgs) | 1058 vm(prefixArgs + vmArgs + ['-cp', prefixCp + coreCp + ':' + projectsCp + os.pathsep + mxdir, name] + [testfile] + coreArgs) |
1059 | 1059 |
1060 try: | 1060 try: |
1061 _run_tests(args, harness, annotations, testfile, whitelist, regex) | 1061 _run_tests(args, harness, annotations, testfile, whitelist, regex) |
1062 finally: | 1062 finally: |
1063 if os.environ.get('MX_TESTFILE') is None: | 1063 if os.environ.get('MX_TESTFILE') is None: |