# A regression test "framework" for Privoxy. For documentation see:
# perldoc privoxy-regression-test.pl
#
-# $Id: privoxy-regression-test.pl,v 1.58 2009/10/29 16:46:42 fabiankeil Exp $
+# $Id: privoxy-regression-test.pl,v 1.64 2011/02/19 13:59:59 fabiankeil Exp $
#
# Wish list:
#
# - Document magic Expect Header values
# - Internal fuzz support?
#
-# Copyright (c) 2007-2009 Fabian Keil <fk@fabiankeil.de>
+# Copyright (c) 2007-2011 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
use Getopt::Long;
use constant {
- PRT_VERSION => 'Privoxy-Regression-Test 0.3',
+ PRT_VERSION => 'Privoxy-Regression-Test 0.4',
CURL => 'curl',
s@\s*$@@;
# Reverse HTML-encoding
- # XXX: Seriously imcomplete.
+ # XXX: Seriously incomplete.
s@"@"@g;
s@&@&@g;
$ri++;
$count++;
enlist_new_test(\@regression_tests, $token, $value, $si, $ri, $count);
+ $no_checks = 1; # Already validated by enlist_new_test().
}
if ($token =~ /level\s+(\d+)/i) {
# We don't use it, so we don't need
$no_checks = 1;
+ l(LL_STATUS, "Enabling no_checks for $token") unless $no_checks;
+ }
+
+ # XXX: Necessary?
+ unless ($no_checks) {
+ check_for_forbidden_characters($value);
+ check_for_forbidden_characters($token);
}
- # XXX: Neccessary?
- check_for_forbidden_characters($value) unless $no_checks;
- check_for_forbidden_characters($token);
}
}
my $redirect_destination;
my $expected_redirect_destination = $test->{'redirect destination'};
- # XXX: Check if a redirect actualy applies before doing the request.
+ # XXX: Check if a redirect actually applies before doing the request.
# otherwise the test may hit a real server in failure cases.
$curl_parameters .= '--head ';
}
sub print_version () {
- printf PRT_VERSION . "\n" . 'Copyright (C) 2007-2009 Fabian Keil <fk@fabiankeil.de>' . "\n";
+ printf PRT_VERSION . "\n" . 'Copyright (C) 2007-2011 Fabian Keil <fk@fabiankeil.de>' . "\n";
+}
+
+sub list_test_types () {
+ my %test_types = (
+ 'Client header test' => CLIENT_HEADER_TEST,
+ 'Server header test' => 2,
+ 'Dumb fetch test' => 3,
+ 'Method test' => 4,
+ 'Sticky action test' => 5,
+ 'Trusted CGI test' => 6,
+ 'Block test' => 7,
+ 'Redirect test' => 108,
+ );
+
+ print "\nThe supported test types and their default levels are:\n";
+ foreach my $test_type (sort { $test_types{$a} <=> $test_types{$b} } keys %test_types) {
+ printf " %-20s -> %3.d\n", $test_type, $test_types{$test_type};
+ }
}
sub help () {
[--test-number]
[--verbose]
[--version]
-see "perldoc $0" for more information
EOF
;
+
+ list_test_types();
+
+ print << " EOF"
+
+Try "perldoc $0" for more information
+ EOF
+ ;
+
exit(0);
}
'test-number=s' => \$cli_options{'test-number'},
'verbose' => \$cli_options{'verbose'},
'version' => sub {print_version && exit(0)}
- );
+ ) or exit(1);
$log_level |= $cli_options{'debug'};
}
B<--show-skipped-tests> Log skipped tests even if verbose mode is off.
-B<--verbose> Log succesful tests as well. By default only
+B<--verbose> Log successful tests as well. By default only
the failures are logged.
B<--version> Print version and exit.