comparison mx/mx_graal.py @ 13320:093353894575

Test the Truffle JAR after building.
author Chris Seaton <chris.seaton@oracle.com>
date Fri, 13 Dec 2013 14:26:39 +0000
parents 30e57b49fdb1
children ecea358f97be
comparison
equal deleted inserted replaced
13319:30e57b49fdb1 13320:093353894575
806 for c in classes: 806 for c in classes:
807 f_testfile.write(c + '\n') 807 f_testfile.write(c + '\n')
808 f_testfile.close() 808 f_testfile.close()
809 harness(projectscp, vmArgs) 809 harness(projectscp, vmArgs)
810 810
811 def _unittest(args, annotations): 811 def _unittest(args, annotations, prefixcp=""):
812 mxdir = dirname(__file__) 812 mxdir = dirname(__file__)
813 name = 'JUnitWrapper' 813 name = 'JUnitWrapper'
814 javaSource = join(mxdir, name + '.java') 814 javaSource = join(mxdir, name + '.java')
815 javaClass = join(mxdir, name + '.class') 815 javaClass = join(mxdir, name + '.class')
816 testfile = os.environ.get('MX_TESTFILE', None) 816 testfile = os.environ.get('MX_TESTFILE', None)
828 with open(testfile) as fp: 828 with open(testfile) as fp:
829 testclasses = [l.rstrip() for l in fp.readlines()] 829 testclasses = [l.rstrip() for l in fp.readlines()]
830 if len(testclasses) == 1: 830 if len(testclasses) == 1:
831 # Execute Junit directly when one test is being run. This simplifies 831 # Execute Junit directly when one test is being run. This simplifies
832 # replaying the VM execution in a native debugger (e.g., gdb). 832 # replaying the VM execution in a native debugger (e.g., gdb).
833 vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + testclasses) 833 vm(prefixArgs + vmArgs + ['-cp', prefixcp + projectscp, 'org.junit.runner.JUnitCore'] + testclasses)
834 else: 834 else:
835 vm(prefixArgs + vmArgs + ['-cp', projectscp + os.pathsep + mxdir, name] + [testfile]) 835 vm(prefixArgs + vmArgs + ['-cp', prefixcp + projectscp + os.pathsep + mxdir, name] + [testfile])
836 836
837 try: 837 try:
838 _run_tests(args, harness, annotations, testfile) 838 _run_tests(args, harness, annotations, testfile)
839 finally: 839 finally:
840 if os.environ.get('MX_TESTFILE') is None: 840 if os.environ.get('MX_TESTFILE') is None:
1346 vmArgs, slArgs = _extract_VM_args(args) 1346 vmArgs, slArgs = _extract_VM_args(args)
1347 vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl"), "com.oracle.truffle.sl.SimpleLanguage"] + slArgs) 1347 vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl"), "com.oracle.truffle.sl.SimpleLanguage"] + slArgs)
1348 1348
1349 def trufflejar(args=None): 1349 def trufflejar(args=None):
1350 """make truffle.jar""" 1350 """make truffle.jar"""
1351
1352 # Test with the built classes
1353 _unittest(["com.oracle.truffle.api.test", "com.oracle.truffle.api.dsl.test"], ['@Test', '@LongTest', '@Parameters'])
1354
1351 # We use the DSL processor as the starting point for the classpath - this 1355 # We use the DSL processor as the starting point for the classpath - this
1352 # therefore includes the DSL processor, the DSL and the API. 1356 # therefore includes the DSL processor, the DSL and the API.
1353 packagejar(mx.classpath("com.oracle.truffle.dsl.processor").split(os.pathsep), "truffle.jar", None, "com.oracle.truffle.dsl.processor.TruffleProcessor") 1357 packagejar(mx.classpath("com.oracle.truffle.dsl.processor").split(os.pathsep), "truffle.jar", None, "com.oracle.truffle.dsl.processor.TruffleProcessor")
1358
1359 # Test with the JAR
1360 _unittest(["com.oracle.truffle.api.test", "com.oracle.truffle.api.dsl.test"], ['@Test', '@LongTest', '@Parameters'], "truffle.jar:")
1361
1354 1362
1355 def isGraalEnabled(vm): 1363 def isGraalEnabled(vm):
1356 return vm != 'original' and not vm.endswith('nograal') 1364 return vm != 'original' and not vm.endswith('nograal')
1357 1365
1358 def site(args): 1366 def site(args):