Skip to content

Commit f38b543

Browse files
ylnJulian Lettner
authored andcommitted
[lit] Improve formatting of error messages. NFC
1 parent ff82315 commit f38b543

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

llvm/utils/lit/lit/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def main(builtin_params = {}):
4444

4545
discovered_tests = lit.discovery.find_tests_for_inputs(litConfig, opts.test_paths)
4646
if not discovered_tests:
47-
sys.stderr.write('Did not disover any tests for provided path(s).\n')
47+
sys.stderr.write('error: did not disover any tests for provided path(s)\n')
4848
sys.exit(2)
4949

5050
# Command line overrides configuration for maxIndividualTestTime.
@@ -66,7 +66,7 @@ def main(builtin_params = {}):
6666
filtered_tests = [t for t in discovered_tests if
6767
opts.filter.search(t.getFullName())]
6868
if not filtered_tests:
69-
sys.stderr.write('Filter did not match any tests '
69+
sys.stderr.write('error: filter did not match any tests '
7070
'(of %d discovered). ' % len(discovered_tests))
7171
if opts.allow_empty_runs:
7272
sys.stderr.write('Suppressing error because '
@@ -85,8 +85,8 @@ def main(builtin_params = {}):
8585
(run, shards) = opts.shard
8686
filtered_tests = filter_by_shard(filtered_tests, run, shards, litConfig)
8787
if not filtered_tests:
88-
sys.stderr.write('Shard does not contain any tests. Consider '
89-
'decreasing the number of shards.\n')
88+
sys.stderr.write('warning: shard does not contain any tests. '
89+
'Consider decreasing the number of shards.\n')
9090
sys.exit(0)
9191

9292
if opts.max_tests:
@@ -109,11 +109,11 @@ def main(builtin_params = {}):
109109
write_test_results_xunit(executed_tests, opts)
110110

111111
if litConfig.numErrors:
112-
sys.stderr.write('\n%d error(s) in tests.\n' % litConfig.numErrors)
112+
sys.stderr.write('\n%d error(s) in tests\n' % litConfig.numErrors)
113113
sys.exit(2)
114114

115115
if litConfig.numWarnings:
116-
sys.stderr.write('\n%d warning(s) in tests.\n' % litConfig.numWarnings)
116+
sys.stderr.write('\n%d warning(s) in tests\n' % litConfig.numWarnings)
117117

118118
has_failure = any(t.isFailure() for t in executed_tests)
119119
if has_failure:

llvm/utils/lit/tests/selecting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
#
77
# RUN: not %{lit} %{inputs}/nonexistent 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
88
# RUN: not %{lit} %{inputs}/nonexistent --allow-empty-runs 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
9-
# CHECK-BAD-PATH: Did not disover any tests for provided path(s).
9+
# CHECK-BAD-PATH: error: did not disover any tests for provided path(s)
1010

1111
# Check that we exit with an error if we filter out all tests, but allow it with --allow-empty-runs.
1212
#
1313
# RUN: not %{lit} --filter 'nonexistent' %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ERROR %s
1414
# RUN: %{lit} --filter 'nonexistent' --allow-empty-runs %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ALLOW %s
15-
# CHECK-BAD-FILTER: Filter did not match any tests (of 5 discovered).
15+
# CHECK-BAD-FILTER: error: filter did not match any tests (of 5 discovered).
1616
# CHECK-BAD-FILTER-ERROR: Use '--allow-empty-runs' to suppress this error.
1717
# CHECK-BAD-FILTER-ALLOW: Suppressing error because '--allow-empty-runs' was specified.
1818

@@ -85,12 +85,12 @@
8585
# RUN: %{lit} --num-shards 100 --run-shard 6 %{inputs}/discovery >%t.out 2>%t.err
8686
# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR2 < %t.err %s
8787
# CHECK-SHARD-BIG-ERR2: note: Selecting shard 6/100 = size 0/5 = tests #(100*k)+6 = []
88-
# CHECK-SHARD-BIG-ERR2: Shard does not contain any tests. Consider decreasing the number of shards.
88+
# CHECK-SHARD-BIG-ERR2: warning: shard does not contain any tests. Consider decreasing the number of shards.
8989
#
9090
# RUN: %{lit} --num-shards 100 --run-shard 50 %{inputs}/discovery >%t.out 2>%t.err
9191
# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR3 < %t.err %s
9292
# CHECK-SHARD-BIG-ERR3: note: Selecting shard 50/100 = size 0/5 = tests #(100*k)+50 = []
93-
# CHECK-SHARD-BIG-ERR3: Shard does not contain any tests. Consider decreasing the number of shards.
93+
# CHECK-SHARD-BIG-ERR3: warning: shard does not contain any tests. Consider decreasing the number of shards.
9494

9595

9696
# Check that range constraints are enforced

0 commit comments

Comments
 (0)