@@ -131,6 +131,9 @@ patternForRegexInWarning = ["{{", "}}"]
131131partialWarnTextMatch = false # (default value)
132132# if not set than stdout will be used as result of warn plugin execution
133133testToolResFileOutput = " 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: (.+)"
134137```
135138
136139When 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
146149usually you'll want them to be consistent to make testing easier, i.e. if input has line number, then so should output.
147150` testNameRegex ` is a regular expression which sets the name of the test file.
148151
149- ### Customize ` execCmd ` per file with placefolders and execFlags
152+ ### Customize ` execCmd ` per file with placeholders and execFlags
150153As 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.
151154The 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 ` \ ` .
153156
154157Additionally, that execution command can define a number of placeholders, which can be used in ` execFlags ` in TOML config:
155158* ` args1 ` a set of CLI parameters which will be inserted _ between_ ` execFlags ` from TOML config and name of the test file
156159* ` 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
159162(or a set of names in batch mode).
160163
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
162165of the following command when checking file ` FileName ` :
163166``` 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
165179```
166180
167181The following images explain how ` execFlags ` can be used:
0 commit comments