[llvm] 022f1e2 - [lit] Refine filter error handling
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 15:20:43 PDT 2020
Author: Julian Lettner
Date: 2020-04-02T14:45:54-07:00
New Revision: 022f1e2cc832cb4c0be90d12e50d773114f208e7
URL: https://github.com/llvm/llvm-project/commit/022f1e2cc832cb4c0be90d12e50d773114f208e7
DIFF: https://github.com/llvm/llvm-project/commit/022f1e2cc832cb4c0be90d12e50d773114f208e7.diff
LOG: [lit] Refine filter error handling
Picking a default filter `.*` that matches everything lets us streamline
some error handling code.
Added:
Modified:
llvm/utils/lit/lit/cl_arguments.py
llvm/utils/lit/lit/main.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/cl_arguments.py b/llvm/utils/lit/lit/cl_arguments.py
index 53ef761302ae..656a783d3dca 100644
--- a/llvm/utils/lit/lit/cl_arguments.py
+++ b/llvm/utils/lit/lit/cl_arguments.py
@@ -133,7 +133,7 @@ def parse_args():
metavar="REGEX",
type=_case_insensitive_regex,
help="Only run tests with paths matching the given regular expression",
- default=os.environ.get("LIT_FILTER"))
+ default=os.environ.get("LIT_FILTER", ".*"))
selection_group.add_argument("--num-shards", # TODO(yln): --shards N/M
dest="numShards",
metavar="M",
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index a329115fafd0..8ac53dfbad9b 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -57,22 +57,19 @@ def main(builtin_params={}):
print_suites_or_tests(discovered_tests, opts)
return
- if opts.filter:
- filtered_tests = [t for t in discovered_tests if
- opts.filter.search(t.getFullName())]
- if not filtered_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 '
- "'--allow-empty-runs' was specified.\n")
- sys.exit(0)
- else:
- sys.stderr.write("Use '--allow-empty-runs' to suppress this "
- 'error.\n')
- sys.exit(2)
- else:
- filtered_tests = discovered_tests
+ filtered_tests = [t for t in discovered_tests if
+ opts.filter.search(t.getFullName())]
+ if not filtered_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 '--allow-empty-runs' "
+ 'was specified.\n')
+ sys.exit(0)
+ else:
+ sys.stderr.write("Use '--allow-empty-runs' to suppress this "
+ 'error.\n')
+ sys.exit(2)
determine_order(filtered_tests, opts.order)
More information about the llvm-commits
mailing list