Skip to content

Commit 7478faa

Browse files
author
Felipe Zimmerle
committed
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.
1 parent 7ac515e commit 7478faa

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

tests/run-regression-tests-nginx.pl

+28
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444

4545
$SIG{TERM} = $SIG{INT} = \&handle_interrupt;
4646

47+
48+
my $platform = "nginx";
49+
4750
my %opt;
4851
getopts('A:E:D:C:T:H:a:p:dvh', \%opt);
4952

@@ -233,6 +236,19 @@ sub runfile {
233236
for my $key (keys %{ $t{match_response} || {}}) {
234237
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
235238
my $m = $t{match_response}{$key};
239+
if (ref($m) eq "HASH") {
240+
if ($m->{$platform}) {
241+
$m = $m->{$platform};
242+
}
243+
else {
244+
my $ap = join(", ", keys %{$m});
245+
msg("Warning: trying to match response. Nothing " .
246+
"to match in current platform: $platform. " .
247+
"This test only contains cotent for: $ap.");
248+
last;
249+
}
250+
}
251+
236252
my $match = match_response($mtype, $resp, $m);
237253
if ($neg and defined $match) {
238254
$rc = 1;
@@ -266,6 +282,18 @@ sub runfile {
266282
for my $key (keys %{ $t{match_log} || {}}) {
267283
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
268284
my $m = $t{match_log}{$key};
285+
if (ref($m) eq "HASH") {
286+
if ($m->{$platform}) {
287+
$m = $m->{$platform};
288+
}
289+
else {
290+
my $ap = join(", ", keys %{$m});
291+
msg("Warning: trying to match: $mtype. Nothing " .
292+
"to match in current platform: $platform. " .
293+
"This test only contains cotent for: $ap.");
294+
last;
295+
}
296+
}
269297
my $match = match_log($mtype, @{$m || []});
270298
if ($neg and defined $match) {
271299
$rc = 1;

tests/run-regression-tests.pl.in

+26
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ if ($HTTPD eq "\@APXS_HTTPD\@") {
5151

5252
$SIG{TERM} = $SIG{INT} = \&handle_interrupt;
5353

54+
my $platform = "apache";
55+
5456
my %opt;
5557
getopts('A:E:D:C:T:H:a:p:dvh', \%opt);
5658

@@ -230,6 +232,18 @@ sub runfile {
230232
for my $key (keys %{ $t{match_response} || {}}) {
231233
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
232234
my $m = $t{match_response}{$key};
235+
if (ref($m) eq "HASH") {
236+
if ($m->{$platform}) {
237+
$m = $m->{$platform};
238+
}
239+
else {
240+
my $ap = join(", ", keys %{$m});
241+
msg("Warning: trying to match: $mtype. Nothing " .
242+
"to match in current platform: $platform. " .
243+
"This test only contains cotent for: $ap.");
244+
last;
245+
}
246+
}
233247
my $match = match_response($mtype, $resp, $m);
234248
if ($neg and defined $match) {
235249
$rc = 1;
@@ -263,6 +277,18 @@ sub runfile {
263277
for my $key (keys %{ $t{match_log} || {}}) {
264278
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
265279
my $m = $t{match_log}{$key};
280+
if (ref($m) eq "HASH") {
281+
if ($m->{$platform}) {
282+
$m = $m->{$platform};
283+
}
284+
else {
285+
my $ap = join(", ", keys %{$m});
286+
msg("Warning: trying to match: $mtype. Nothing " .
287+
"to match in current platform: $platform. " .
288+
"This test only contains cotent for: $ap.");
289+
last;
290+
}
291+
}
266292
my $match = match_log($mtype, @{$m || []});
267293
if ($neg and defined $match) {
268294
$rc = 1;

0 commit comments

Comments
 (0)