The goal here is to allow re-use of this functionality from debuginfo-tests. It's going to need to do a lot of similar configuration for clang and lld and enable similar substitutions. Moving some of this common functionality into the lit.llvm module reduces the amount of boilerplate for setting this up in debug info tests (which will come in a later patch)
Details
- Reviewers
rnk dlj modocache - Commits
- rG0d36b657b977: [lit] Refactor out some more common lit configuration code.
rLLD313919: [lit] Refactor out some more common lit configuration code.
rC313919: [lit] Refactor out some more common lit configuration code.
rL313919: [lit] Refactor out some more common lit configuration code.
Diff Detail
Event Timeline
llvm/test/lit.cfg.py | ||
---|---|---|
153 | pre=JUNKCHARS for consistency? | |
llvm/utils/lit/lit/llvm/__init__.py | ||
27 | (Minor nit) I really hate to bikeshed ... but I would expect this to do something like check for 'name' literally, without any regex matching. So I won't suggest changing the name to "is_regex" ;-) , but are there any other names that might make it more clear that the first argument will be interpreted as a well-formed regex? | |
30 | I think re.escape will do what you need: | |
44 | It might make more sense to factor out the regex construction, then you can assign self.regex all at once: def not_in(patterns, where=''): if not patterns: return '' pattern_str = '|'.join(re.escape(x) for x in patterns) return r'(?{where}!({pattern_str}))'.format( where=where, pattern_str=pattern_str) self.regex = not_in(pre, where='<') + '\b' + name + '\b' + not_in(post) (Not sure if that's actually clearer, but there might be some useful tidbits...) | |
llvm/utils/lit/lit/llvm/config.py | ||
174 | Nit: 'dir' is a Python builtin, this shadows it. |
pre=JUNKCHARS for consistency?