Daniel Stenberg <[email protected]> wrote: > On Thu, 7 Aug 2014, Fabian Keil wrote: > > > Such an option could also obsolete my patch that adds an -H option to > > change > > the "IPv4 host IP address": > > > > ./runtests.pl -o TESTDIR=$privoxy_curl_test_dir -o HOSTIP=10.0.0.1 ... > > I like this approach a lot. Very subtle and unobtrusive to the actual script > and yet gives the invoking the script a lot of power. The attached patch 0002 is one way to add the suggested -o option.
It contains an (incomplete) white list of characters that are commonly used in (Unix) paths and IPv4 and IPv6 addresses. Given that the input is trusted, white listing probably isn't necessary from a security point of view and may prevent valid use cases in the future. The current white list works for me but I could also live with a different white list or no sanity checks at all. The attached patch 0001 fixes a line ending issue in test61 which affects external proxies. Fabian
0001-test61-Replace-stray-M-5e-4d-at-the-end-of-a-cookie-.patch.gz
Description: application/gzip
From f9afc7642ad4f74076ba59bb0bb6e9cfc3bd2991 Mon Sep 17 00:00:00 2001 From: Fabian Keil <[email protected]> Date: Thu, 9 Oct 2014 15:48:19 +0200 Subject: [PATCH 2/2] runtests.pl: Add an -o option to change internal variables runtests.pl has lots of internal variables one might want to change in certain situations, but adding a dedicated option for every single one of them isn't practical. Usage: ./runtests.pl -o TESTDIR=$privoxy_curl_test_dir -o HOSTIP=10.0.0.1 ... --- tests/runtests.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/runtests.pl b/tests/runtests.pl index 5db2724..3daed84 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -4694,6 +4694,15 @@ while(@ARGV) { # run the tests cases event based if possible $run_event_based=1; } + elsif($ARGV[0] eq "-o") { + shift @ARGV; + if ($ARGV[0] =~ /^(\w+)=([\w.:\/\[\]-]+)$/) { + my ($variable, $value) = ($1, $2); + eval "\$$variable='$value'" or die "Failed to set \$$variable to $value: $@"; + } else { + die "Failed to parse '-o $ARGV[0]'. May contain unexpected characters.\n"; + } + } elsif($ARGV[0] eq "-p") { $postmortem=1; } @@ -4774,6 +4783,7 @@ Usage: runtests.pl [options] [test selection(s)] -l list all test case names/descriptions -m file load the specifed test manifest to decide which tests get executed -n no valgrind + -o variable=value set internal variable to the specified value -p print log file contents when a test fails -P proxy use the specified proxy -r run time statistics -- 1.9.0
signature.asc
Description: PGP signature
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
