HomePhabricator

[lit] Allow passing extra commands to executeShTest

Authored by ldionne on Mar 18 2020, 8:17 PM.

Description

[lit] Allow passing extra commands to executeShTest

This allows creating custom test formats on top of executeShTest that
inject commands at the beginning of the file being parsed, without
requiring these commands to physically appear in the test file itself.

For example, one could define a test format that prints out additional
debug information at the beginning of each test. More realistically,
this has been used to define custom test formats like one that supports
compilation failure tests (e.g. with the extension compile.fail.cpp)
by injecting a command that calls the compiler on the file itself and
expects it to fail.

Without this change, the only alternative is to create a temporary file
with the same content as the original test, then prepend the desired
// RUN: lines to that file, and call executeShTest on that file
instead. This is both slow and cumbersome to do.

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

Details