runtests: allow client/command to span multiple lines, and use it

Some curl command-lines are long, often repetitive, and difficult
to read or write:

Before this patch (1 test == 1 line):
- <=78 characters: 1099 tests
- 79-132 characters: 500 tests
- 133+ characters: 217 tests: patch meant to help with some of these.

After this patch:
- <=78 characters: 1288 lines
- 79-132 characters: 526 lines
- 133+ characters: 190 lines

After this patch it's possible to fold long lines into multiple ones.
Folding can reduce greppability, thus this is primarily useful for cases
when the options are repetitive, e.g. a list of form options, headers,
mail parameters and the like.

Closes #19500
This commit is contained in:
Viktor Szakats 2025-11-12 17:26:27 +01:00
parent 64c03bbdf2
commit 3d42510118
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
38 changed files with 233 additions and 39 deletions

View file

@ -804,10 +804,13 @@ sub singletest_run {
my ($testnum, $testtimings) = @_;
# get the command line options to use
my ($cmd, @blaha)= getpart("client", "command");
if($cmd) {
# make some nice replace operations
my $cmd;
my @cmd = getpart("client", "command");
if(@cmd) {
# allow splitting the command-line to multiple lines
$cmd = join(' ', @cmd);
$cmd =~ s/\n//g; # no newlines please
chomp $cmd; # no newlines please
# substitute variables in the command line
}
else {