test: Adds support to handle different content in log depending on the version

Some functionalities are just enabled on Apache, not part of nginx or IIS. As
example we have the "proxy", currently just supported in Apache. This patches
add to our regression test suite the ability to expect different contents
based on the targert platform.
This commit is contained in:
Felipe Zimmerle 2014-01-09 08:45:53 -08:00
parent 7ac515ee29
commit 7478faa5ce
2 changed files with 54 additions and 0 deletions

View File

@ -44,6 +44,9 @@ $UA->agent($UA_NAME);
$SIG{TERM} = $SIG{INT} = \&handle_interrupt;
my $platform = "nginx";
my %opt;
getopts('A:E:D:C:T:H:a:p:dvh', \%opt);
@ -233,6 +236,19 @@ sub runfile {
for my $key (keys %{ $t{match_response} || {}}) {
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
my $m = $t{match_response}{$key};
if (ref($m) eq "HASH") {
if ($m->{$platform}) {
$m = $m->{$platform};
}
else {
my $ap = join(", ", keys %{$m});
msg("Warning: trying to match response. Nothing " .
"to match in current platform: $platform. " .
"This test only contains cotent for: $ap.");
last;
}
}
my $match = match_response($mtype, $resp, $m);
if ($neg and defined $match) {
$rc = 1;
@ -266,6 +282,18 @@ sub runfile {
for my $key (keys %{ $t{match_log} || {}}) {
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
my $m = $t{match_log}{$key};
if (ref($m) eq "HASH") {
if ($m->{$platform}) {
$m = $m->{$platform};
}
else {
my $ap = join(", ", keys %{$m});
msg("Warning: trying to match: $mtype. Nothing " .
"to match in current platform: $platform. " .
"This test only contains cotent for: $ap.");
last;
}
}
my $match = match_log($mtype, @{$m || []});
if ($neg and defined $match) {
$rc = 1;

View File

@ -51,6 +51,8 @@ if ($HTTPD eq "\@APXS_HTTPD\@") {
$SIG{TERM} = $SIG{INT} = \&handle_interrupt;
my $platform = "apache";
my %opt;
getopts('A:E:D:C:T:H:a:p:dvh', \%opt);
@ -230,6 +232,18 @@ sub runfile {
for my $key (keys %{ $t{match_response} || {}}) {
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
my $m = $t{match_response}{$key};
if (ref($m) eq "HASH") {
if ($m->{$platform}) {
$m = $m->{$platform};
}
else {
my $ap = join(", ", keys %{$m});
msg("Warning: trying to match: $mtype. Nothing " .
"to match in current platform: $platform. " .
"This test only contains cotent for: $ap.");
last;
}
}
my $match = match_response($mtype, $resp, $m);
if ($neg and defined $match) {
$rc = 1;
@ -263,6 +277,18 @@ sub runfile {
for my $key (keys %{ $t{match_log} || {}}) {
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
my $m = $t{match_log}{$key};
if (ref($m) eq "HASH") {
if ($m->{$platform}) {
$m = $m->{$platform};
}
else {
my $ap = join(", ", keys %{$m});
msg("Warning: trying to match: $mtype. Nothing " .
"to match in current platform: $platform. " .
"This test only contains cotent for: $ap.");
last;
}
}
my $match = match_log($mtype, @{$m || []});
if ($neg and defined $match) {
$rc = 1;