llvm.org GIT mirror llvm / 75b1901
[lit] Set --single-process for single tests and --threads=1 Summary: Automatically upgrade debugging experience (single process, no thread pool) when: 1) we only run a single test 2) user specifies `-j1` Details: Fix `--max-failures` in single process mode. Option did not have an effect in single process mode. Add display feedback for single process mode. Adapted test. Improve argument checking (require positive integers). `--single-process` is now essentially an alias for `-j1`. Should we remove it? Reviewers: rnk Differential Revision: https://reviews.llvm.org/D58249 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354068 91177308-0d34-0410-b5e6-96231b3b80d8 Julian Lettner 6 months ago
6 changed file(s) with 20 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
2020
2121 def __init__(self, progname, path, quiet,
2222 useValgrind, valgrindLeakCheck, valgrindArgs,
23 noExecute, debug, isWindows, singleProcess,
23 noExecute, debug, isWindows,
2424 params, config_prefix = None,
2525 maxIndividualTestTime = 0,
2626 maxFailures = None,
3636 self.valgrindUserArgs = list(valgrindArgs)
3737 self.noExecute = noExecute
3838 self.debug = debug
39 self.singleProcess = singleProcess
4039 self.isWindows = bool(isWindows)
4140 self.params = dict(params)
4241 self.bashPath = None
261261 useValgrind = False,
262262 valgrindLeakCheck = False,
263263 valgrindArgs = [],
264 singleProcess=False,
265264 noExecute = False,
266265 debug = False,
267266 isWindows = (platform.system()=='Windows'),
335335 if not args:
336336 parser.error('No inputs specified')
337337
338 if opts.numThreads is None:
339 opts.numThreads = lit.util.detectCPUs()
340
341 if opts.maxFailures == 0:
342 parser.error("Setting --max-failures to 0 does not have any effect.")
338 if opts.numThreads is not None and opts.numThreads <= 0:
339 parser.error("Option '--threads' or '-j' requires positive integer")
340
341 if opts.maxFailures is not None and opts.maxFailures <= 0:
342 parser.error("Option '--max-failures' requires positive integer")
343343
344344 if opts.echoAllCommands:
345345 opts.showOutput = True
373373 valgrindLeakCheck = opts.valgrindLeakCheck,
374374 valgrindArgs = opts.valgrindArgs,
375375 noExecute = opts.noExecute,
376 singleProcess = opts.singleProcess,
377376 debug = opts.debug,
378377 isWindows = isWindows,
379378 params = userParams,
480479 if opts.maxTests is not None:
481480 run.tests = run.tests[:opts.maxTests]
482481
482 # Determine number of workers to use.
483 if opts.singleProcess:
484 opts.numThreads = 1
485 elif opts.numThreads is None:
486 opts.numThreads = lit.util.detectCPUs()
487
483488 # Don't create more threads than tests.
484489 opts.numThreads = min(len(run.tests), opts.numThreads)
485490
505510 except:
506511 pass
507512
508 extra = ''
509 if len(run.tests) != numTotalTests:
510 extra = ' of %d' % numTotalTests
511 header = '-- Testing: %d%s tests, %d threads --'%(len(run.tests), extra,
512 opts.numThreads)
513 extra = (' of %d' % numTotalTests) if (len(run.tests) != numTotalTests) else ''
514 threads = 'single process' if (opts.numThreads == 1) else ('%d threads' % opts.numThreads)
515 header = '-- Testing: %d%s tests, %s --' % (len(run.tests), extra, threads)
513516 progressBar = None
514517 if not opts.quiet:
515518 if opts.succinct and opts.useProgressBar:
132132 be given an UNRESOLVED result.
133133 """
134134 # Don't do anything if we aren't going to run any tests.
135 if not self.tests or jobs == 0:
135 if not self.tests:
136136 return
137137
138138 # Save the display object on the runner so that we can update it from
141141
142142 self.failure_count = 0
143143 self.hit_max_failures = False
144 if self.lit_config.singleProcess:
144 if jobs == 1:
145145 global child_lit_config
146146 child_lit_config = self.lit_config
147147 for test_index, test in enumerate(self.tests):
148148 result = worker_run_one_test(test_index, test)
149149 self.consume_test_result(result)
150 if self.hit_max_failures:
151 break
150152 else:
151153 self.execute_tests_in_pool(jobs, max_time)
152154
1010 # CHECK: Failing Tests (27)
1111 # CHECK: Failing Tests (1)
1212 # CHECK: Failing Tests (2)
13 # CHECK: error: Setting --max-failures to 0 does not have any effect.
13 # CHECK: error: Option '--max-failures' requires positive integer
2828 quiet=False,
2929 useValgrind=False,
3030 valgrindLeakCheck=False,
31 singleProcess=False,
3231 valgrindArgs=[],
3332 noExecute=False,
3433 debug=False,