mirror of
https://github.com/moparisthebest/curl
synced 2024-11-16 22:45:03 -05:00
runtests: add %repeat[]% for test files
... and use this new keywords in all the test files larger than 50K to reduce their sizes and make them a lot easier to read and understand. Closes #6040
This commit is contained in:
parent
639c6bfcfa
commit
b8e4d1cb0a
@ -53,6 +53,21 @@ For example, to insert the binary octets 0, 1 and 255 into the test file:
|
|||||||
|
|
||||||
%hex[ %00%01%FF ]hex%
|
%hex[ %00%01%FF ]hex%
|
||||||
|
|
||||||
|
## Repeat content
|
||||||
|
|
||||||
|
In the preprocess stage, a special instruction can be used to have runtests.pl
|
||||||
|
generate a repetetive sequence of bytes.
|
||||||
|
|
||||||
|
To insert a sequence of repeat bytes, use this syntax to make the `<string>`
|
||||||
|
get repeated `<number>` of times. The number has to be 1 or large and the
|
||||||
|
string may contain `%HH` hexadecimal codes:
|
||||||
|
|
||||||
|
%repeat[<number> x <string>]%
|
||||||
|
|
||||||
|
For example, to insert the word hello a 100 times:
|
||||||
|
|
||||||
|
%repeat[100 x hello]%
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
|
||||||
When the test is preprocessed, a range of "variables" in the test file will be
|
When the test is preprocessed, a range of "variables" in the test file will be
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -3314,6 +3314,13 @@ sub subBase64 {
|
|||||||
$d =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
|
$d =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
|
||||||
$$thing =~ s/%%HEX%%/$d/;
|
$$thing =~ s/%%HEX%%/$d/;
|
||||||
}
|
}
|
||||||
|
if($$thing =~ s/%repeat\[(\d+) x (.*)\]%/%%REPEAT%%/i) {
|
||||||
|
# decode %NN characters
|
||||||
|
my ($d, $n) = ($2, $1);
|
||||||
|
$d =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
|
||||||
|
my $all = $d x $n;
|
||||||
|
$$thing =~ s/%%REPEAT%%/$all/;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub fixarray {
|
sub fixarray {
|
||||||
|
Loading…
Reference in New Issue
Block a user