[PATCH] D27005: [lit] Support custom parsers in parseIntegratedTestScript

Eric Fiselier via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 15:24:31 PST 2016


EricWF created this revision.
EricWF added reviewers: ddunbar, modocache, rnk, danalbert, jroelofs.
EricWF added subscribers: cfe-commits, llvm-commits.

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()


https://reviews.llvm.org/D27005

Files:
  utils/lit/lit/TestRunner.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27005.78956.patch
Type: text/x-patch
Size: 8976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161122/85e1d2d4/attachment.bin>


More information about the llvm-commits mailing list