From de2de93ff16bc3f4dc3976657ee73bd94c266c54 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 25 Oct 2008 15:42:05 +0000 Subject: [PATCH] Understand dependencies like: # Level 13 needs = feature status FEATURE_CONNECTION_KEEP_ALIVE Yes # Level 14 needs = feature status FEATURE_CONNECTION_KEEP_ALIVE No --- tools/privoxy-regression-test.pl | 35 ++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tools/privoxy-regression-test.pl b/tools/privoxy-regression-test.pl index 61f1b0ab..f20ad523 100755 --- a/tools/privoxy-regression-test.pl +++ b/tools/privoxy-regression-test.pl @@ -7,7 +7,7 @@ # A regression test "framework" for Privoxy. For documentation see: # perldoc privoxy-regression-test.pl # -# $Id: privoxy-regression-test.pl,v 1.159 2008/08/22 16:53:06 fk Exp $ +# $Id: privoxy-regression-test.pl,v 1.160 2008/10/25 15:39:27 fk Exp $ # # Wish list: # @@ -155,9 +155,11 @@ sub load_regressions_tests () { our $privoxy_cgi_url; our @privoxy_config; + our %privoxy_features; my @actionfiles; my $curl_url = ''; my $file_number = 0; + my $feature; $curl_url .= $privoxy_cgi_url; $curl_url .= 'show-status'; @@ -176,6 +178,15 @@ sub load_regressions_tests () { my $directive = $1 . " " . $2; push (@privoxy_config, $directive); + + } elsif (m@([^<]*)@) { + + $feature = $1; + + } elsif (m@ (Yes|No) @) { + + $privoxy_features{$feature} = $1 if defined $feature; + $feature = undef; } } @@ -539,6 +550,8 @@ sub dependency_unsatisfied ($) { my $level = shift; our %dependencies; our @privoxy_config; + our %privoxy_features; + my $dependency_problem = 0; if (defined ($dependencies{$level}{'config line'})) { @@ -549,6 +562,19 @@ sub dependency_unsatisfied ($) { foreach (@privoxy_config) { $dependency_problem = 0 if (/$dependency/); + last; + } + + } elsif (defined ($dependencies{$level}{'feature status'})) { + + my $dependency = $dependencies{$level}{'feature status'}; + $dependency_problem = 1; + my ($feature, $status) = $dependency =~ /([^\s]*)\s+(Yes|No)/; + + if (defined($privoxy_features{$feature}) + and ($privoxy_features{$feature} eq $status)) + { + $dependency_problem = 0; } } @@ -563,7 +589,12 @@ sub register_dependency ($$) { if ($dependency =~ /config line\s+(.*)/) { - $dependencies{$level}{'config line'} = $1; + $dependencies{$level}{'config line'} = $1; + + } elsif ($dependency =~ /feature status\s+(.*)/) { + + $dependencies{$level}{'feature status'} = $1; + } } -- 2.39.2