llvm-project/llvm/utils/lit/tests
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
..
Inputs [lit] Support custom parsers in parseIntegratedTestScript 2016-12-05 20:21:21 +00:00
unit [lit] Support custom parsers in parseIntegratedTestScript 2016-12-05 20:21:21 +00:00
.coveragerc
discovery.py
googletest-format.py
googletest-timeout.py
googletest-upstream-format.py [lit][googletest] Handle upstream gtest output 2016-03-31 18:22:55 +00:00
lit.cfg Revert "Teach the CMake build system to run lit's test suite. These can be run" 2016-01-09 21:42:57 +00:00
max-failures.py [lit] Add a --max-failures option. 2016-09-26 23:38:23 +00:00
progress-bar.py
shell-parsing.py
shtest-encoding.py
shtest-format.py [lit] Improve readability of failing scripts. 2016-06-02 23:49:42 +00:00
shtest-output-printing.py [lit] Improve logging with file redirection. 2016-06-07 16:13:40 +00:00
shtest-shell.py [lit] Improve logging with file redirection. 2016-06-07 16:13:40 +00:00
shtest-timeout.py [lit] Fix test shtest-timeout.py for modern output 2016-10-12 21:40:08 +00:00
test-data.py
test-output.py
unittest-adaptor.py
usage.py [lit] Use argparse instead of optparse 2016-10-03 22:12:42 +00:00
xunit-output.py