comparison mx.jvmci/mx_jvmci.py @ 22182:9bbd878b17af

use unittest extensibility
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Jul 2015 15:16:01 +0200
parents ffdee9fe0ded
children 706aa848a8d7
comparison
equal deleted inserted replaced
22181:ffdee9fe0ded 22182:9bbd878b17af
1056 1056
1057 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): 1057 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
1058 (pfx_, exe_, vm_, args_, cwd) = parseVmArgs(args, vm, cwd, vmbuild) 1058 (pfx_, exe_, vm_, args_, cwd) = parseVmArgs(args, vm, cwd, vmbuild)
1059 return mx.run(pfx_ + [exe_, '-' + vm_] + args_, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) 1059 return mx.run(pfx_ + [exe_, '-' + vm_] + args_, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
1060 1060
1061 def unittest(args): 1061 def _unittest_config_participant(config):
1062 def vmLauncher(vmArgs, mainClass, mainClassArgs): 1062 vmArgs, mainClass, mainClassArgs = config
1063 if isJVMCIEnabled(get_vm()): 1063 if isJVMCIEnabled(get_vm()):
1064 # Remove entries from class path that are in JVMCI loaded jars 1064 # Remove entries from class path that are in JVMCI loaded jars
1065 cpIndex, cp = mx.find_classpath_arg(vmArgs) 1065 cpIndex, cp = mx.find_classpath_arg(vmArgs)
1066 if cp: 1066 if cp:
1067 excluded = set() 1067 excluded = set()
1068 for jdkDist in jdkDeployedDists: 1068 for jdkDist in jdkDeployedDists:
1069 dist = mx.distribution(jdkDist.name) 1069 dist = mx.distribution(jdkDist.name)
1070 excluded.update([d.output_dir() for d in dist.archived_deps() if d.isJavaProject()]) 1070 excluded.update([d.output_dir() for d in dist.archived_deps() if d.isJavaProject()])
1071 cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) 1071 cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded])
1072 vmArgs[cpIndex] = cp 1072 vmArgs[cpIndex] = cp
1073 1073
1074 # Run the VM in a mode where application/test classes can 1074 # Run the VM in a mode where application/test classes can
1075 # access JVMCI loaded classes. 1075 # access JVMCI loaded classes.
1076 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs 1076 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs
1077 1077 return (vmArgs, mainClass, mainClassArgs)
1078 vm(vmArgs + [mainClass] + mainClassArgs) 1078 return config
1079 mx_unittest.unittest(args, vmLauncher=vmLauncher) 1079
1080 def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):
1081 vm(vmArgs + [mainClass] + mainClassArgs)
1082
1083 mx_unittest.add_config_participant(_unittest_config_participant)
1084 mx_unittest.set_vm_launcher('JVMCI VM launcher', _unittest_vm_launcher)
1080 1085
1081 def shortunittest(args): 1086 def shortunittest(args):
1082 """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'""" 1087 """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'"""
1083 1088
1084 args = ['--whitelist', 'test/whitelist_shortunittest.txt'] + args 1089 args = ['--whitelist', 'test/whitelist_shortunittest.txt'] + args
1085 unittest(args) 1090 mx_unittest.unittest(args)
1086 1091
1087 def buildvms(args): 1092 def buildvms(args):
1088 """build one or more VMs in various configurations""" 1093 """build one or more VMs in various configurations"""
1089 1094
1090 vmsDefault = ','.join(_vmChoices.keys()) 1095 vmsDefault = ','.join(_vmChoices.keys())
1979 'igv' : [igv, ''], 1984 'igv' : [igv, ''],
1980 'jdkhome': [print_jdkhome, ''], 1985 'jdkhome': [print_jdkhome, ''],
1981 'jmh': [jmh, '[VM options] [filters|JMH-args-as-json...]'], 1986 'jmh': [jmh, '[VM options] [filters|JMH-args-as-json...]'],
1982 'gate' : [gate, '[-options]'], 1987 'gate' : [gate, '[-options]'],
1983 'makejmhdeps' : [makejmhdeps, ''], 1988 'makejmhdeps' : [makejmhdeps, ''],
1984 'unittest' : [unittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix],
1985 'shortunittest' : [shortunittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix], 1989 'shortunittest' : [shortunittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix],
1986 'jacocoreport' : [jacocoreport, '[output directory]'], 1990 'jacocoreport' : [jacocoreport, '[output directory]'],
1987 'vm': [vm, '[-options] class [args...]'], 1991 'vm': [vm, '[-options] class [args...]'],
1988 'deoptalot' : [deoptalot, '[n]'], 1992 'deoptalot' : [deoptalot, '[n]'],
1989 'longtests' : [longtests, ''], 1993 'longtests' : [longtests, ''],