@@ -131,6 +131,9 @@ patternForRegexInWarning = ["{{", "}}"]
131
131
partialWarnTextMatch = false # (default value)
132
132
# if not set than stdout will be used as result of warn plugin execution
133
133
testToolResFileOutput = " result.out" # (no default value is set)
134
+
135
+ # Extra flags will be extracted from a line that mathces this regex if it's present in a file
136
+ runConfigPattern = " # RUN: (.+)"
134
137
```
135
138
136
139
When executed from project root (where ` save.propertes ` is located), SAVE will cd to ` rootDir ` and discover all files
@@ -146,22 +149,33 @@ with `lineCaptureGroup`, `columnCaptureGroup` and `messageCaptureGroup` paramete
146
149
usually you'll want them to be consistent to make testing easier, i.e. if input has line number, then so should output.
147
150
` testNameRegex ` is a regular expression which sets the name of the test file.
148
151
149
- ### Customize ` execCmd ` per file with placefolders and execFlags
152
+ ### Customize ` execCmd ` per file with placeholders and execFlags
150
153
As the next level of customization, execution command can be customized per individual test. To do so, one can use a special comment in that file.
151
154
The pattern of the comment is taken from ` WarnPluginConfig.runConfigPattern ` . It should contain a single capture group, which corresponds to
152
- execution command.
155
+ execution command. Capturing of multiline commands is supported; in this case the line should be finalized by ` \ ` .
153
156
154
157
Additionally, that execution command can define a number of placeholders, which can be used in ` execFlags ` in TOML config:
155
158
* ` args1 ` a set of CLI parameters which will be inserted _ between_ ` execFlags ` from TOML config and name of the test file
156
159
* ` args2 ` a set of CLI parameters which will be inserted _ after_ the name of the test file
157
- These placeholders are optional; if present, they should be comma-separated. Equal sign can be escaped with ` \ ` . They can be accessed
158
- from ` warn.execFlags ` with ` $ ` sign. Additionally, ` $fileName ` in ` execFlags ` is substituted by the name of analyzed file
160
+ These placeholders are optional; if present, they should be comma-separated. Comma and equal sign can be escaped with ` \ ` .
161
+ They can be accessed from ` warn.execFlags ` with ` $ ` sign. Additionally, ` $fileName ` in ` execFlags ` is substituted by the name of analyzed file
159
162
(or a set of names in batch mode).
160
163
161
- For example, the comment ` // RUN: args1=--foo\=bar,args2=--log debug ` in combination with ` warn.execCmd = ./my-tool ` will lead to execution
164
+ For example, the comment ` // RUN: args1=--foo\=bar,args2=--baz=opt-1\,opt-2 ` in combination with ` warn.execCmd = ./my-tool ` will lead to execution
162
165
of the following command when checking file ` FileName ` :
163
166
``` bash
164
- ./my-tool --foo=bar FileName --log debug
167
+ ./my-tool --foo=bar FileName --baz=opt-1,opt-2
168
+ ```
169
+
170
+ More examples:
171
+ ``` c++
172
+ // RUN: args1=--log debug\
173
+ // RUN: args2=--verbose --verbosity=4 \
174
+ // RUN: --output out.txt
175
+ ```
176
+ translates to
177
+ ``` bash
178
+ ./my-tool --log debug FileName --verbose --verbosity=4 --output out.txt
165
179
```
166
180
167
181
The following images explain how ` execFlags ` can be used:
0 commit comments