llvm-project/llvm/utils/lit/lit
Eric Fiselier df87d070c9 [lit] Support custom parsers in parseIntegratedTestScript
Summary:
Libc++ frequently has the need to parse more than just the builtin *test keywords* (`RUN`, `REQUIRES`, `XFAIL`, ect). For example libc++ currently needs a new keyword `MODULES-DEFINES: macro list...`. Instead of re-implementing the script parsing in libc++ this patch allows `parseIntegratedTestScript` to take custom parsers.

This patch introduces a new class `IntegratedTestKeywordParser` which implements the logic to parse/process a test keyword. Parsing of various keyword "kinds" are supported out of the box, including 'TAG', 'COMMAND', and 'LIST', which parse keywords such as `END.`, `RUN:` and `XFAIL:` respectively.

As an example after this change libc++ can implement the `MODULES-DEFINES` simply using: 
```
mparser = IntegratedTestKeywordParser('MODULES-DEFINES:', ParserKind.LIST)
parseIntegratedTestScript(test, additional_parsers=[mparser])
macro_list = mparser.getValue()
```


Reviewers: ddunbar, modocache, rnk, danalbert, jroelofs

Subscribers: mgrang, llvm-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D27005

llvm-svn: 288694
2016-12-05 20:21:21 +00:00
..
ExampleTests.ObjDir
formats [lit] Remove (or allow specific) unused imports 2016-10-10 01:22:06 +00:00
LitConfig.py [lit] Remove (or allow specific) unused imports 2016-10-10 01:22:06 +00:00
LitTestCase.py
ProgressBar.py [lit] Parse all strings as UTF-8 rather than ASCII. 2014-09-12 16:46:05 +00:00
ShCommands.py
ShUtil.py [lit] Run unit tests as part of lit test suite 2016-10-12 03:35:04 +00:00
Test.py [lit] Fix undefined symbol ArgumentError 2016-10-10 01:19:27 +00:00
TestRunner.py [lit] Support custom parsers in parseIntegratedTestScript 2016-12-05 20:21:21 +00:00
TestingConfig.py [lit] Remove Python 2.6 and below exec workaround 2016-10-10 01:11:52 +00:00
__init__.py Fix issue which cases lit installed with setup.py to not resolve main 2016-10-10 23:22:11 +00:00
discovery.py Initial version of Go bindings. 2014-10-16 22:48:02 +00:00
main.py [lit] Remove unused TestingProgressDisplay attr 2016-10-10 01:20:43 +00:00
run.py [lit] Fix refacto introduced by rL282479. 2016-09-27 16:17:42 +00:00
util.py Recommit r287403 (reverted in r287804): [lit] When setting SDKROOT on Darwin, use '--sdk macosx' to find the right SDK path. 2016-12-01 17:45:22 +00:00