comparison mx/mx_graal.py @ 18326:840257b6cdc5

mx: added --fail-fast option to unittest that stops Junit after first input class causing a test failure
author Doug Simon <doug.simon@oracle.com>
date Mon, 10 Nov 2014 18:16:21 +0100
parents 6924bb0badc9
children 13273385abb5
comparison
equal deleted inserted replaced
18325:6f99dae5df57 18326:840257b6cdc5
1139 for c in classes: 1139 for c in classes:
1140 f_testfile.write(c + '\n') 1140 f_testfile.write(c + '\n')
1141 f_testfile.close() 1141 f_testfile.close()
1142 harness(projectsCp, vmArgs) 1142 harness(projectsCp, vmArgs)
1143 1143
1144 def _unittest(args, annotations, prefixCp="", blacklist=None, whitelist=None, verbose=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): 1144 def _unittest(args, annotations, prefixCp="", blacklist=None, whitelist=None, verbose=False, fail_fast=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False):
1145 testfile = os.environ.get('MX_TESTFILE', None) 1145 testfile = os.environ.get('MX_TESTFILE', None)
1146 if testfile is None: 1146 if testfile is None:
1147 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") 1147 (_, testfile) = tempfile.mkstemp(".testclasses", "graal")
1148 os.close(_) 1148 os.close(_)
1149 coreCp = mx.classpath(['com.oracle.graal.test']) 1149 coreCp = mx.classpath(['com.oracle.graal.test'])
1150 1150
1151 coreArgs = [] 1151 coreArgs = []
1152 if verbose: 1152 if verbose:
1153 coreArgs.append('-JUnitVerbose') 1153 coreArgs.append('-JUnitVerbose')
1154 if fail_fast:
1155 coreArgs.append('-JUnitFailFast')
1154 if enable_timing: 1156 if enable_timing:
1155 coreArgs.append('-JUnitEnableTiming') 1157 coreArgs.append('-JUnitEnableTiming')
1156 if color: 1158 if color:
1157 coreArgs.append('-JUnitColor') 1159 coreArgs.append('-JUnitColor')
1158 if eager_stacktrace: 1160 if eager_stacktrace:
1204 1206
1205 --blacklist <file> run all testcases not specified in the blacklist 1207 --blacklist <file> run all testcases not specified in the blacklist
1206 --whitelist <file> run only testcases which are included 1208 --whitelist <file> run only testcases which are included
1207 in the given whitelist 1209 in the given whitelist
1208 --verbose enable verbose JUnit output 1210 --verbose enable verbose JUnit output
1211 --fail-fast stop after first JUnit test class that has a failure
1209 --enable-timing enable JUnit test timing 1212 --enable-timing enable JUnit test timing
1210 --regex <regex> run only testcases matching a regular expression 1213 --regex <regex> run only testcases matching a regular expression
1211 --color enable colors output 1214 --color enable colors output
1212 --eager-stacktrace print stacktrace eagerly 1215 --eager-stacktrace print stacktrace eagerly
1213 --gc-after-test force a GC after each test 1216 --gc-after-test force a GC after each test
1248 epilog=_unittestHelpSuffix, 1251 epilog=_unittestHelpSuffix,
1249 ) 1252 )
1250 parser.add_argument('--blacklist', help='run all testcases not specified in the blacklist', metavar='<path>') 1253 parser.add_argument('--blacklist', help='run all testcases not specified in the blacklist', metavar='<path>')
1251 parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='<path>') 1254 parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='<path>')
1252 parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true') 1255 parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true')
1256 parser.add_argument('--fail-fast', help='stop after first JUnit test class that has a failure', action='store_true')
1253 parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true') 1257 parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true')
1254 parser.add_argument('--regex', help='run only testcases matching a regular expression', metavar='<regex>') 1258 parser.add_argument('--regex', help='run only testcases matching a regular expression', metavar='<regex>')
1255 parser.add_argument('--color', help='enable color output', action='store_true') 1259 parser.add_argument('--color', help='enable color output', action='store_true')
1256 parser.add_argument('--eager-stacktrace', help='print stacktrace eagerly', action='store_true') 1260 parser.add_argument('--eager-stacktrace', help='print stacktrace eagerly', action='store_true')
1257 parser.add_argument('--gc-after-test', help='force a GC after each test', action='store_true') 1261 parser.add_argument('--gc-after-test', help='force a GC after each test', action='store_true')