[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 214/411: runtests: allow generating a binary sequence from hex
From: |
gnunet |
Subject: |
[gnurl] 214/411: runtests: allow generating a binary sequence from hex |
Date: |
Wed, 13 Jan 2021 01:20:29 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit 2dd53e82f1ec3de8a9ecc1261ca4d9077506a9bb
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Fri Oct 2 00:11:13 2020 +0200
runtests: allow generating a binary sequence from hex
---
tests/FILEFORMAT.md | 13 +++++++++++++
tests/runtests.pl | 7 +++++++
2 files changed, 20 insertions(+)
diff --git a/tests/FILEFORMAT.md b/tests/FILEFORMAT.md
index 09600d016..7748b6706 100644
--- a/tests/FILEFORMAT.md
+++ b/tests/FILEFORMAT.md
@@ -40,6 +40,19 @@ server's port number (in ASCII) followed by a space and the
hexadecimal byte
%b64[%HTTPPORT %9a]b64%
+## Hexadecimal decoding
+
+In the preprocess stage, a special instruction can be used to have runtests.pl
+generate a sequence of binary bytes.
+
+To insert a sequence of bytes from a hex encoded string, use this syntax:
+
+ %hex[ %XX-encoded data to decode ]hex%
+
+For example, to insert the binary octets 0, 1 and 255 into the test file:
+
+ %hex[ %00%01%FF ]hex%
+
# Variables
When the test is preprocessed, a range of "variables" in the test file will be
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 49b318dc7..325522182 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -3304,6 +3304,13 @@ sub subBase64 {
# put the result into there
$$thing =~ s/%%B64%%/$enc/;
}
+ # hex decode
+ if($$thing =~ s/%hex\[(.*)\]hex%/%%HEX%%/i) {
+ # decode %NN characters
+ my $d = $1;
+ $d =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
+ $$thing =~ s/%%HEX%%/$d/;
+ }
}
sub fixarray {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 331/411: RELEASE-NOTES: synced, (continued)
- [gnurl] 331/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 374/411: runtests: make 'c-ares' a "feature" to depend on, gnunet, 2021/01/12
- [gnurl] 378/411: vquic/ngtcp2.h: define local_addr as sockaddr_storage, gnunet, 2021/01/12
- [gnurl] 200/411: HISTORY: add some 2020 events, gnunet, 2021/01/12
- [gnurl] 247/411: libcurl.pc: make it relocatable, gnunet, 2021/01/12
- [gnurl] 254/411: CURLOPT_TCP_NODELAY.3: fix comment in example code, gnunet, 2021/01/12
- [gnurl] 255/411: CURLOPT_URL.3: clarify SCP/SFTP URLs are for uploads as well, gnunet, 2021/01/12
- [gnurl] 216/411: checksrc: warn on space after exclamation mark, gnunet, 2021/01/12
- [gnurl] 225/411: curl: make sure setopt CURLOPT_IPRESOLVE passes on a long, gnunet, 2021/01/12
- [gnurl] 239/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 214/411: runtests: allow generating a binary sequence from hex,
gnunet <=
- [gnurl] 238/411: THANKS: from 7.73.0 and .mailmap fixes, gnunet, 2021/01/12
- [gnurl] 340/411: release-notes.pl: detect #[number] better for Ref: etc, gnunet, 2021/01/12
- [gnurl] 352/411: KNOWN_BUGS: cmake: libspsl is not supported, gnunet, 2021/01/12
- [gnurl] 284/411: tool_operate: bail out proper on errors for parallel setup, gnunet, 2021/01/12
- [gnurl] 288/411: acinclude: detect manually set minimum macos/ipod version, gnunet, 2021/01/12
- [gnurl] 375/411: test506: make it not run in c-ares builds, gnunet, 2021/01/12
- [gnurl] 306/411: rtsp: error out on empty Session ID, unified the code, gnunet, 2021/01/12
- [gnurl] 266/411: KNOWN_BUGS: mention the individual cmake issues, gnunet, 2021/01/12
- [gnurl] 362/411: KNOWN_BUGS: wakeup socket disconnect causes havoc, gnunet, 2021/01/12
- [gnurl] 317/411: FAQ: refreshed, gnunet, 2021/01/12