Skip to content

Commit

Permalink
tests: add -q as first option when invoking curl for tests
Browse files Browse the repository at this point in the history
To reduce the risk that the user running the tests has a .curlrc present
that messes things up.

Support 'option="no-q"' for the <command> tag to switch it off on demand.
Use this new feature in test 433 and 436.

Ref: curl#13284
Closes curl#13387
  • Loading branch information
bagder committed Apr 16, 2024
1 parent d28f749 commit f7cc9e9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion tests/FILEFORMAT.md
Expand Up @@ -531,7 +531,7 @@ command has been run.
If the variable name has no assignment, no `=`, then that variable is just
deleted.

### `<command [option="no-output/no-include/force-output/binary-trace"] [timeout="secs"][delay="secs"][type="perl/shell"]>`
### `<command [option="no-q/no-output/no-include/force-output/binary-trace"] [timeout="secs"][delay="secs"][type="perl/shell"]>`
Command line to run.

Note that the URL that gets passed to the server actually controls what data
Expand Down Expand Up @@ -562,6 +562,9 @@ otherwise written to verify stdout.
Set `option="no-include"` to prevent the test script to slap on the
`--include` argument.

Set `option="no-q"` avoid using `-q` as the first argument in the curl command
line.

Set `option="binary-trace"` to use `--trace` instead of `--trace-ascii` for
tracing. Suitable for binary-oriented protocols such as MQTT.

Expand Down
2 changes: 1 addition & 1 deletion tests/data/test433
Expand Up @@ -36,7 +36,7 @@ CURL_HOME=
<name>
Verify XDG_CONFIG_HOME use to find .curlrc
</name>
<command>
<command option="no-q">
%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
Expand Down
2 changes: 1 addition & 1 deletion tests/data/test436
Expand Up @@ -35,7 +35,7 @@ XDG_CONFIG_HOME=
<name>
Find .curlrc in .config/curlrc via CURL_HOME
</name>
<command>
<command option="no-q">
%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
Expand Down
3 changes: 3 additions & 0 deletions tests/runner.pm
Expand Up @@ -920,6 +920,9 @@ sub singletest_run {

if(!$tool) {
$CMDLINE=shell_quote($CURL);
if($cmdhash{'option'} !~ /no-q/) {
$CMDLINE .= " -q";
}
}

if(use_valgrind() && !$disablevalgrind) {
Expand Down

0 comments on commit f7cc9e9

Please sign in to comment.