Mercurial > hg > graal-compiler
comparison mx/mx_graal.py @ 15500:f2132fab8a6f
Add custom GraalJUnitCore.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 05 May 2014 11:33:33 +0200 |
parents | f73fc9309f12 |
children | a26be2c9b81b |
comparison
equal
deleted
inserted
replaced
15499:229537218983 | 15500:f2132fab8a6f |
---|---|
953 javaClass = join(mxdir, name + '.class') | 953 javaClass = join(mxdir, name + '.class') |
954 testfile = os.environ.get('MX_TESTFILE', None) | 954 testfile = os.environ.get('MX_TESTFILE', None) |
955 if testfile is None: | 955 if testfile is None: |
956 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") | 956 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") |
957 os.close(_) | 957 os.close(_) |
958 corecp = mx.classpath(['com.oracle.graal.test']) | |
958 | 959 |
959 def harness(projectscp, vmArgs): | 960 def harness(projectscp, vmArgs): |
960 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): | 961 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): |
961 subprocess.check_call([mx.java().javac, '-cp', projectscp, '-d', mxdir, javaSource]) | 962 subprocess.check_call([mx.java().javac, '-cp', projectscp, '-d', mxdir, javaSource]) |
962 if _get_vm() != 'graal': | 963 if _get_vm() != 'graal': |
966 with open(testfile) as fp: | 967 with open(testfile) as fp: |
967 testclasses = [l.rstrip() for l in fp.readlines()] | 968 testclasses = [l.rstrip() for l in fp.readlines()] |
968 if len(testclasses) == 1: | 969 if len(testclasses) == 1: |
969 # Execute Junit directly when one test is being run. This simplifies | 970 # Execute Junit directly when one test is being run. This simplifies |
970 # replaying the VM execution in a native debugger (e.g., gdb). | 971 # replaying the VM execution in a native debugger (e.g., gdb). |
971 vm(prefixArgs + vmArgs + ['-cp', prefixcp + projectscp, 'org.junit.runner.JUnitCore'] + testclasses) | 972 vm(prefixArgs + vmArgs + ['-cp', prefixcp + corecp + ':' + projectscp, 'com.oracle.graal.test.GraalJUnitCore'] + testclasses) |
972 else: | 973 else: |
973 vm(prefixArgs + vmArgs + ['-cp', prefixcp + projectscp + os.pathsep + mxdir, name] + [testfile]) | 974 vm(prefixArgs + vmArgs + ['-cp', prefixcp + corecp + ':' + projectscp + os.pathsep + mxdir, name] + [testfile]) |
974 | 975 |
975 try: | 976 try: |
976 _run_tests(args, harness, annotations, testfile, whitelist) | 977 _run_tests(args, harness, annotations, testfile, whitelist) |
977 finally: | 978 finally: |
978 if os.environ.get('MX_TESTFILE') is None: | 979 if os.environ.get('MX_TESTFILE') is None: |