28412d1800
These directives define per-test lit substitutions. The concept was discussed at <https://discourse.llvm.org/t/iterating-lit-run-lines/62596/10>. For example, the following directives can be inserted into a test file to define `%{cflags}` and `%{fcflags}` substitutions with empty initial values, which serve as the parameters of another newly defined `%{check}` substitution: ``` // DEFINE: %{cflags} = // DEFINE: %{fcflags} = // DEFINE: %{check} = %clang_cc1 %{cflags} -emit-llvm -o - %s | \ // DEFINE: FileCheck %{fcflags} %s ``` The following directives then redefine the parameters before each use of `%{check}`: ``` // REDEFINE: %{cflags} = -foo // REDEFINE: %{fcflags} = -check-prefix=FOO // RUN: %{check} // REDEFINE: %{cflags} = -bar // REDEFINE: %{fcflags} = -check-prefix=BAR // RUN: %{check} ``` Of course, `%{check}` would typically be more elaborate, increasing the benefit of the reuse. One issue is that the strings `DEFINE:` and `REDEFINE:` already appear in 5 tests. This patch adjusts those tests not to use those strings. Our prediction is that, in the vast majority of cases, if a test author mistakenly uses one of those strings for another purpose, the text appearing after the string will not happen to have the syntax required for these directives. Thus, the test author will discover the mistake immediately when lit reports the syntax error. This patch also expands the documentation on existing lit substitution behavior. Reviewed By: jhenderson, MaskRay, awarzynski Differential Revision: https://reviews.llvm.org/D132513
17 lines
742 B
Plaintext
17 lines
742 B
Plaintext
; RUN: llvm-cvtres /h > %t
|
|
; RUN: FileCheck -input-file=%t %s -check-prefix=HELP_TEST
|
|
|
|
; HELP_TEST: OVERVIEW: Resource Converter
|
|
; HELP_TEST-DAG: USAGE: llvm-cvtres [options] file...
|
|
; HELP_TEST-DAG: OPTIONS:
|
|
; HELP_TEST-NEXT: /{{DEFINE}}:symbol Not implemented
|
|
; HELP_TEST-NEXT: /FOLDDUPS: Not implemented
|
|
; HELP_TEST-NEXT: /HELP Display available options
|
|
; HELP_TEST-NEXT: /MACHINE:{ARM|ARM64|EBC|IA64|X64|X86}
|
|
; HELP_TEST-NEXT: Machine architecture
|
|
; HELP_TEST-DAG: /NOLOGO Not implemented
|
|
; HELP_TEST-NEXT: /OUT:filename Output file
|
|
; HELP_TEST-NEXT: /READONLY Not implemented
|
|
; HELP_TEST-NEXT: /TIMESTAMP:<value> Timestamp for coff header, defaults to current time
|
|
; HELP_TEST-NEXT: /VERBOSE Use verbose output
|