summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/ab/base.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:33:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:33:51 +0000
commit4f0770f3df78ecd5dcaefbd214f7a1415366bca6 (patch)
tree72661b8f81594b855bcc967b819263f63fa30e17 /debian/perl-framework/t/ab/base.t
parentAdding upstream version 2.4.56. (diff)
downloadapache2-4f0770f3df78ecd5dcaefbd214f7a1415366bca6.tar.xz
apache2-4f0770f3df78ecd5dcaefbd214f7a1415366bca6.zip
Adding debian version 2.4.56-1~deb11u2.debian/2.4.56-1_deb11u2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/t/ab/base.t')
-rw-r--r--debian/perl-framework/t/ab/base.t46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/perl-framework/t/ab/base.t b/debian/perl-framework/t/ab/base.t
new file mode 100644
index 0000000..fe565f6
--- /dev/null
+++ b/debian/perl-framework/t/ab/base.t
@@ -0,0 +1,46 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestConfig;
+use Apache::TestUtil qw(t_debug);
+use IPC::Open3;
+use Symbol;
+use File::Spec::Functions qw(catfile);
+use Data::Dumper;
+
+my $vars = Apache::Test::vars();
+
+plan tests => ($vars->{ssl_module_name} ? 5 : 2);
+
+sub run_and_gather_output {
+ my $command = shift;
+ t_debug "# running: ", $command, "\n";
+ my ($cin, $cout, $cerr);
+ $cerr = gensym();
+ my $pid = open3($cin, $cout, $cerr, $command);
+ waitpid( $pid, 0 );
+ my $status = $? >> 8;
+ my @cstdout = <$cout>;
+ my @cstderr = <$cerr>;
+ return { status => $status, stdout => \@cstdout, stderr => \@cstderr };
+}
+
+my $ab_path = catfile $vars->{bindir}, "ab";
+
+my $http_url = Apache::TestRequest::module2url("core", {scheme => 'http', path => '/'});
+my $http_results = run_and_gather_output("ASAN_OPTIONS='detect_leaks=0' $ab_path -B 127.0.0.1 -q -n 10 $http_url");
+ok $http_results->{status}, 0;
+ok scalar(@{$http_results->{stderr}}), 0;
+
+if ($vars->{ssl_module_name}) {
+ my $https_url = Apache::TestRequest::module2url($vars->{ssl_module_name}, {scheme => 'https', path => '/'});
+ my $https_results = run_and_gather_output("ASAN_OPTIONS='detect_leaks=0' $ab_path -B 127.0.0.1 -q -n 10 $https_url");
+ ok $https_results->{status}, 0;
+ ok (scalar(@{$https_results->{stderr}}), 0,
+ "https had stderr output:" . Dumper $https_results->{stderr});
+
+ #XXX: For some reason, stderr is getting pushed into stdout. This test will at least catch known SSL failures
+ ok (scalar(grep(/SSL.*(fail|err)/i, @{$https_results->{stdout}})), 0,
+ "https stdout had some possibly alarming content:" . Dumper $https_results->{stdout} );
+}