[lit] Improve formatting of error messages. NFC

This commit is contained in:
Julian Lettner 2019-02-25 22:41:52 -08:00 committed by Julian Lettner
parent ff82315d4e
commit f38b543b97
2 changed files with 10 additions and 10 deletions

View File

@ -44,7 +44,7 @@ def main(builtin_params = {}):
discovered_tests = lit.discovery.find_tests_for_inputs(litConfig, opts.test_paths)
if not discovered_tests:
sys.stderr.write('Did not disover any tests for provided path(s).\n')
sys.stderr.write('error: did not disover any tests for provided path(s)\n')
sys.exit(2)
# Command line overrides configuration for maxIndividualTestTime.
@ -66,7 +66,7 @@ def main(builtin_params = {}):
filtered_tests = [t for t in discovered_tests if
opts.filter.search(t.getFullName())]
if not filtered_tests:
sys.stderr.write('Filter did not match any tests '
sys.stderr.write('error: filter did not match any tests '
'(of %d discovered). ' % len(discovered_tests))
if opts.allow_empty_runs:
sys.stderr.write('Suppressing error because '
@ -85,8 +85,8 @@ def main(builtin_params = {}):
(run, shards) = opts.shard
filtered_tests = filter_by_shard(filtered_tests, run, shards, litConfig)
if not filtered_tests:
sys.stderr.write('Shard does not contain any tests. Consider '
'decreasing the number of shards.\n')
sys.stderr.write('warning: shard does not contain any tests. '
'Consider decreasing the number of shards.\n')
sys.exit(0)
if opts.max_tests:
@ -109,11 +109,11 @@ def main(builtin_params = {}):
write_test_results_xunit(executed_tests, opts)
if litConfig.numErrors:
sys.stderr.write('\n%d error(s) in tests.\n' % litConfig.numErrors)
sys.stderr.write('\n%d error(s) in tests\n' % litConfig.numErrors)
sys.exit(2)
if litConfig.numWarnings:
sys.stderr.write('\n%d warning(s) in tests.\n' % litConfig.numWarnings)
sys.stderr.write('\n%d warning(s) in tests\n' % litConfig.numWarnings)
has_failure = any(t.isFailure() for t in executed_tests)
if has_failure:

View File

@ -6,13 +6,13 @@
#
# RUN: not %{lit} %{inputs}/nonexistent 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
# RUN: not %{lit} %{inputs}/nonexistent --allow-empty-runs 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
# CHECK-BAD-PATH: Did not disover any tests for provided path(s).
# CHECK-BAD-PATH: error: did not disover any tests for provided path(s)
# Check that we exit with an error if we filter out all tests, but allow it with --allow-empty-runs.
#
# RUN: not %{lit} --filter 'nonexistent' %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ERROR %s
# RUN: %{lit} --filter 'nonexistent' --allow-empty-runs %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ALLOW %s
# CHECK-BAD-FILTER: Filter did not match any tests (of 5 discovered).
# CHECK-BAD-FILTER: error: filter did not match any tests (of 5 discovered).
# CHECK-BAD-FILTER-ERROR: Use '--allow-empty-runs' to suppress this error.
# CHECK-BAD-FILTER-ALLOW: Suppressing error because '--allow-empty-runs' was specified.
@ -85,12 +85,12 @@
# RUN: %{lit} --num-shards 100 --run-shard 6 %{inputs}/discovery >%t.out 2>%t.err
# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR2 < %t.err %s
# CHECK-SHARD-BIG-ERR2: note: Selecting shard 6/100 = size 0/5 = tests #(100*k)+6 = []
# CHECK-SHARD-BIG-ERR2: Shard does not contain any tests. Consider decreasing the number of shards.
# CHECK-SHARD-BIG-ERR2: warning: shard does not contain any tests. Consider decreasing the number of shards.
#
# RUN: %{lit} --num-shards 100 --run-shard 50 %{inputs}/discovery >%t.out 2>%t.err
# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR3 < %t.err %s
# CHECK-SHARD-BIG-ERR3: note: Selecting shard 50/100 = size 0/5 = tests #(100*k)+50 = []
# CHECK-SHARD-BIG-ERR3: Shard does not contain any tests. Consider decreasing the number of shards.
# CHECK-SHARD-BIG-ERR3: warning: shard does not contain any tests. Consider decreasing the number of shards.
# Check that range constraints are enforced