diff options
| author | Julian Lettner <julian.lettner@gmail.com> | 2019-02-20 22:19:52 -0800 |
|---|---|---|
| committer | Julian Lettner <jlettner@apple.com> | 2019-10-28 11:10:07 -0700 |
| commit | e6102dc5ef8839de04b04a6b3d77a8a16f461e49 (patch) | |
| tree | 6c8335476b83982e89510cf46805b5732b6253bb /llvm/utils | |
| parent | 6d63bf919489608cb1c687046f79facfe23240d4 (diff) | |
| download | bcm5719-llvm-e6102dc5ef8839de04b04a6b3d77a8a16f461e49.tar.gz bcm5719-llvm-e6102dc5ef8839de04b04a6b3d77a8a16f461e49.zip | |
[lit] Remove redundant comments from main function
Hopefully the functionality is now clear due to the use of small,
well-named helper functions.
Diffstat (limited to 'llvm/utils')
| -rwxr-xr-x | llvm/utils/lit/lit/main.py | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py index 7e8db087932..9372886acb4 100755 --- a/llvm/utils/lit/lit/main.py +++ b/llvm/utils/lit/lit/main.py @@ -26,7 +26,6 @@ def main(builtinParameters = {}): userParams = create_user_parameters(builtinParameters, opts) isWindows = platform.system() == 'Windows' - # Create the global config object. litConfig = lit.LitConfig.LitConfig( progname = os.path.basename(sys.argv[0]), path = opts.path, @@ -42,7 +41,6 @@ def main(builtinParameters = {}): maxFailures = opts.maxFailures, echo_all_commands = opts.echoAllCommands) - # Perform test discovery. tests = lit.discovery.find_tests_for_inputs(litConfig, opts.test_paths) # Command line overrides configuration for maxIndividualTestTime. @@ -60,7 +58,6 @@ def main(builtinParameters = {}): print_suites_or_tests(tests, opts) return - # Select and order the tests. numTotalTests = len(tests) if opts.filter: @@ -68,38 +65,28 @@ def main(builtinParameters = {}): determine_order(tests, opts) - # Then optionally restrict our attention to a shard of the tests. if opts.shard: (run, shards) = opts.shard tests = filter_by_shard(tests, run, shards, litConfig) - # Finally limit the number of tests, if desired. if opts.maxTests is not None: tests = tests[:opts.maxTests] - # Don't create more workers than tests. opts.numWorkers = min(len(tests), opts.numWorkers) - testing_time = run_tests(tests, litConfig, opts, numTotalTests) + elapsed = run_tests(tests, litConfig, opts, numTotalTests) - # move into print_summary - if not opts.quiet: - print('Testing Time: %.2fs' % (testing_time,)) - - print_summary(tests, opts) + print_summary(tests, elapsed, opts) - # Write out the test data, if requested. if opts.output_path: - write_test_results(tests, litConfig, testing_time, opts.output_path) + write_test_results(tests, litConfig, elapsed, opts.output_path) if opts.xunit_output_file: write_test_results_xunit(tests, opts) - # If we encountered any additional errors, exit abnormally. if litConfig.numErrors: sys.stderr.write('\n%d error(s), exiting.\n' % litConfig.numErrors) sys.exit(2) - # Warn about warnings. if litConfig.numWarnings: sys.stderr.write('\n%d warning(s) in tests.\n' % litConfig.numWarnings) @@ -241,7 +228,10 @@ def run_tests_in_tmp_dir(run_callback, litConfig): # FIXME: Re-try after timeout on Windows. litConfig.warning("Failed to delete temp directory '%s'" % tmp_dir) -def print_summary(tests, opts): +def print_summary(tests, elapsed, opts): + if not opts.quiet: + print('Testing Time: %.2fs' % elapsed) + byCode = {} for test in tests: if test.result.code not in byCode: @@ -288,12 +278,12 @@ def print_summary(tests, opts): if N: print(' %s: %d' % (name,N)) -def write_test_results(tests, lit_config, testing_time, output_path): +def write_test_results(tests, lit_config, elapsed, output_path): # Construct the data we will write. data = {} # Encode the current lit version as a schema version. data['__version__'] = lit.__versioninfo__ - data['elapsed'] = testing_time + data['elapsed'] = elapsed # FIXME: Record some information on the lit configuration used? # FIXME: Record information from the individual test suites? |

