[all-commits] [llvm/llvm-project] 8f64b0: [lit] Allow passing extra commands to executeShTest

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Mar 24 12:02:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f64b02d336a2197ce948026f5b2008b68d73a58
      https://github.com/llvm/llvm-project/commit/8f64b02d336a2197ce948026f5b2008b68d73a58
  Author: Louis Dionne <ldionne at apple.com>
  Date:   2020-03-24 (Tue, 24 Mar 2020)

  Changed paths:
    M llvm/utils/lit/lit/TestRunner.py
    A llvm/utils/lit/tests/Inputs/shtest-inject/lit.cfg
    A llvm/utils/lit/tests/Inputs/shtest-inject/test-empty.txt
    A llvm/utils/lit/tests/Inputs/shtest-inject/test-many.txt
    A llvm/utils/lit/tests/Inputs/shtest-inject/test-one.txt
    A llvm/utils/lit/tests/shtest-inject.py

  Log Message:
  -----------
  [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




More information about the All-commits mailing list