summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe')
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Changes21
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Makefile.PL221
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/README5
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/TEST.PL37
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/hello.t20
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/vhost.t7
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/extra.conf.in16
-rwxr-xr-xdebian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/modperl_extra.pl2
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Hello.pm19
-rw-r--r--debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Vhost.pm28
10 files changed, 376 insertions, 0 deletions
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Changes b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Changes
new file mode 100644
index 0000000..adf4530
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Changes
@@ -0,0 +1,21 @@
+=head1 NAME
+
+Changes - Apache::TestMe changes logfile
+
+=head1 Changes
+
+=over 4
+
+=item 0.01
+
+new test basic/vhost.t which introduces a vhost entry in .pm. also
+added a dummy vhost entry in t/conf/extra.conf.in, the setup needed by
+t/minmaxclients.t from Apache-TestItSelf [Stas]
+
+write a basic mod_perl test: basic/hello.t [Stas]
+
+starting the config test suite used by Apache::TestItSelf [Stas]
+
+=back
+
+=cut
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Makefile.PL b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Makefile.PL
new file mode 100644
index 0000000..cd2ef90
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/Makefile.PL
@@ -0,0 +1,221 @@
+use 5.005;
+
+use lib qw(../../lib); # Apache-Test/lib
+
+use Apache::TestMM qw(test clean);
+use Apache::TestMM ();
+use Apache::TestReport;
+
+use ExtUtils::MakeMaker ();
+
+my $mp_gen = satisfy_mp_generation();
+warn "Goind to build against mod_perl/$mod_perl::VERSION Perl/$]\n";
+
+Apache::TestMM::filter_args();
+
+my @scripts = qw(t/TEST);
+for (@scripts) {
+ Apache::TestMM::generate_script($_);
+}
+Apache::TestReport->generate_script;
+
+my @clean_files = (@scripts, qw(t/REPORT));
+
+
+my %common_opts = (
+ NAME => 'Apache-TestMe',
+ VERSION => '0.01',
+ clean => {
+ FILES => "@clean_files",
+ },
+);
+
+if ($mp_gen == 1) {
+ require ExtUtils::MakeMaker;
+ ExtUtils::MakeMaker::WriteMakefile(
+ %common_opts,
+ );
+
+}
+else {
+ require ModPerl::MM;
+ ModPerl::MM::WriteMakefile(
+ %common_opts,
+ );
+}
+# If a specific generation was passed as an argument,
+# if satisfied
+# return the same generation
+# else
+# die
+# else @ARGV and %ENV will be checked for specific orders
+# if the specification will be found
+# if satisfied
+# return the specified generation
+# else
+# die
+# else if any mp generation is found
+# return it
+# else
+# die
+
+sub satisfy_mp_generation {
+ my $wanted = shift || wanted_mp_generation();
+
+ unless ($wanted == 1 || $wanted == 2) {
+ die "don't know anything about mod_perl generation: $wanted\n" .
+ "currently supporting only generations 1 and 2";
+ }
+
+ my $selected = 0;
+
+ if ($wanted == 1) {
+ require_mod_perl();
+ if ($mod_perl::VERSION >= 1.99) {
+ # so we don't pick 2.0 version if 1.0 is wanted
+ die "You don't seem to have mod_perl 1.0 installed";
+ }
+ $selected = 1;
+ }
+ elsif ($wanted == 2) {
+ #warn "Looking for mod_perl 2.0";
+ require_mod_perl2();
+ if ($mod_perl::VERSION < 1.99) {
+ die "You don't seem to have mod_perl 2.0 installed";
+ }
+ $selected = 2;
+ }
+ else {
+ $selected = eval { require_mod_perl2() or require_mod_perl() };
+ warn "Using $mod_perl::VERSION\n";
+ }
+
+ return $selected;
+}
+
+sub require_mod_perl {
+ eval { require mod_perl };
+ die "Can't find mod_perl installed\nThe error was: $@" if $@;
+ 1;
+}
+
+sub require_mod_perl2 {
+ eval { require mod_perl2 };
+ die "Can't find mod_perl installed\nThe error was: $@" if $@;
+ 2;
+}
+
+
+# the function looks at %ENV and Makefile.PL option to figure out
+# whether a specific mod_perl generation was requested.
+# It uses the following logic:
+# via options:
+# perl Makefile.PL MOD_PERL=2
+# or via %ENV:
+# env MOD_PERL=1 perl Makefile.PL
+#
+# return value is:
+# 1 or 2 if the specification was found (mp 1 and mp 2 respectively)
+# 0 otherwise
+sub wanted_mp_generation {
+
+ # check if we have a command line specification
+ # flag: 0: unknown, 1: mp1, 2: mp2
+ my $flag = 0;
+ my @pass;
+ while (@ARGV) {
+ my $key = shift @ARGV;
+ if ($key =~ /^MOD_PERL=(\d)$/) {
+ $flag = $1;
+ }
+ else {
+ push @pass, $key;
+ }
+ }
+ @ARGV = @pass;
+
+ # check %ENV
+ my $env = exists $ENV{MOD_PERL} ? $ENV{MOD_PERL} : 0;
+
+ # check for contradicting requirements
+ if ($env && $flag && $flag != $env) {
+ die <<EOF;
+Can\'t decide which mod_perl version should be used, since you have
+supplied contradicting requirements:
+ enviroment variable MOD_PERL=$env
+ Makefile.PL option MOD_PERL=$flag
+EOF
+ }
+
+ my $wanted = 0;
+ $wanted = 2 if $env == 2 || $flag == 2;
+ $wanted = 1 if $env == 1 || $flag == 1;
+
+ unless ($wanted) {
+ # if still unknown try to require mod_perl.pm
+ eval { require mod_perl2 or require mod_perl };
+ unless ($@) {
+ $wanted = $mod_perl::VERSION >= 1.99 ? 2 : 1;
+ }
+ }
+
+ return $wanted;
+}
+
+
+# the function looks at %ENV and Makefile.PL option to figure out
+# whether a specific mod_perl generation was requested.
+# It uses the following logic:
+# via options:
+# perl Makefile.PL MOD_PERL=2
+# or via %ENV:
+# env MOD_PERL=1 perl Makefile.PL
+#
+# return value is:
+# 1 or 2 if the specification was found (mp 1 and mp 2 respectively)
+# 0 otherwise
+sub wanted_mp_generation {
+
+ # check if we have a command line specification
+ # flag: 0: unknown, 1: mp1, 2: mp2
+ my $flag = 0;
+ my @pass;
+ while (@ARGV) {
+ my $key = shift @ARGV;
+ if ($key =~ /^MOD_PERL=(\d)$/) {
+ $flag = $1;
+ }
+ else {
+ push @pass, $key;
+ }
+ }
+ @ARGV = @pass;
+
+ # check %ENV
+ my $env = exists $ENV{MOD_PERL} ? $ENV{MOD_PERL} : 0;
+
+ # check for contradicting requirements
+ if ($env && $flag && $flag != $env) {
+ die <<EOF;
+Can\'t decide which mod_perl version should be used, since you have
+supplied contradicting requirements:
+ enviroment variable MOD_PERL=$env
+ Makefile.PL option MOD_PERL=$flag
+EOF
+ }
+
+ my $wanted = 0;
+ $wanted = 2 if $env == 2 || $flag == 2;
+ $wanted = 1 if $env == 1 || $flag == 1;
+
+ unless ($wanted) {
+ # if still unknown try to require mod_perl.pm
+ eval { require mod_perl2 or require mod_perl };
+ unless ($@) {
+ $wanted = $mod_perl::VERSION >= 1.99 ? 2 : 1;
+ }
+ }
+
+ return $wanted;
+}
+
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/README b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/README
new file mode 100644
index 0000000..bc79ea1
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/README
@@ -0,0 +1,5 @@
+This package contains an Apache-Test test suite used by
+Apache-TestItSelf. We use a dedicated test suite, so we can re-create
+cases which normally won't fit into the core Apache-Test test suite.
+This is the test suite that should be run from Apache-TestTestItSelf
+as explained in Apache-TestItSelf/README
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/TEST.PL b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/TEST.PL
new file mode 100644
index 0000000..b5d3494
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/TEST.PL
@@ -0,0 +1,37 @@
+use strict;
+
+use FindBin;
+# test against the A-T source lib for easier dev
+use lib "$FindBin::Bin/../../../lib";
+
+use lib qw(lib ../lib);
+
+use warnings FATAL => 'all';
+
+use Apache::TestRunPerl ();
+
+package MyTest;
+
+use vars qw(@ISA);
+@ISA = qw(Apache::TestRunPerl);
+
+sub new_test_config {
+ my $self = shift;
+
+ #$self->{conf_opts}->{authname} = 'gold club';
+
+ return $self->SUPER::new_test_config;
+}
+
+sub bug_report {
+ my $self = shift;
+
+ print <<EOI;
++-----------------------------------------------------+
+| To report problems please refer to the SUPPORT file |
++-----------------------------------------------------+
+EOI
+}
+
+MyTest->new->run(@ARGV);
+
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/hello.t b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/hello.t
new file mode 100644
index 0000000..ced9f86
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/hello.t
@@ -0,0 +1,20 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+
+plan tests => 3, have_lwp;
+
+my $response = GET '/TestBasic__Hello';
+
+ok t_cmp $response->code, 200, '/handler returned HTTP_OK';
+
+ok t_cmp $response->header('Content-Type'), 'text/plain',
+ '/handler set proper Content-Type';
+
+chomp(my $content = $response->content);
+
+ok t_cmp $content, 'Hello', '/handler returned proper content';
+
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/vhost.t b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/vhost.t
new file mode 100644
index 0000000..4b4d315
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/basic/vhost.t
@@ -0,0 +1,7 @@
+use Apache::TestUtil;
+use Apache::TestRequest 'GET_BODY_ASSERT';
+
+my $module = 'TestBasic::Vhost';
+my $url = Apache::TestRequest::module2url($module);
+t_debug("connecting to $url");
+print GET_BODY_ASSERT $url;
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/extra.conf.in b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/extra.conf.in
new file mode 100644
index 0000000..e16d963
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/extra.conf.in
@@ -0,0 +1,16 @@
+# this vhost entry is needed to check that when t/TEST -maxclients 1
+# or similar is called after t/TEST -conf was run, and extra.conf
+# includes a vhost entry and httpd.conf includes an autogenerated
+# vhost entry from some .pm file, we used to have a collision, since
+# extra.conf wasn't reparsed and the same port was getting assigned to
+# more than one vhost entry, preventing server startup:
+#
+#default_ VirtualHost overlap on port 8530, the first has precedence
+#(98)Address already in use: make_sock: could not bind to address
+#0.0.0.0:8530 no listening sockets available, shutting down
+#
+# XXX: for now using a dummy vhost entry. later if needed to put a
+# real vhost entry in ths file, the dummy one can be removed
+#
+<VirtualHost foo_bar_tar>
+</VirtualHost>
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/modperl_extra.pl b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/modperl_extra.pl
new file mode 100755
index 0000000..a9f939a
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/conf/modperl_extra.pl
@@ -0,0 +1,2 @@
+
+1;
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Hello.pm b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Hello.pm
new file mode 100644
index 0000000..953df81
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Hello.pm
@@ -0,0 +1,19 @@
+package TestBasic::Hello;
+
+use Apache2::RequestRec ();
+use Apache2::RequestIO ();
+use Apache2::Const -compile => qw(OK);
+
+# XXX: adjust the test that it'll work under mp1 as well
+
+sub handler {
+
+ my $r = shift;
+
+ $r->content_type('text/plain');
+ $r->print('Hello');
+
+ return Apache2::OK;
+}
+
+1;
diff --git a/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Vhost.pm b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Vhost.pm
new file mode 100644
index 0000000..9692b49
--- /dev/null
+++ b/debian/perl-framework/Apache-Test/Apache-TestItSelf/Apache-TestMe/t/response/TestBasic/Vhost.pm
@@ -0,0 +1,28 @@
+package TestBasic::Vhost;
+
+use Apache2::Const -compile => qw(OK);
+use Apache::Test;
+
+# XXX: adjust the test that it'll work under mp1 as well
+
+sub handler {
+
+ my $r = shift;
+
+ plan $r, tests => 1;
+
+ ok 1;
+
+ return Apache2::OK;
+}
+
+1;
+__END__
+<NoAutoConfig>
+<VirtualHost TestBasic::Vhost>
+ <Location /TestBasic__Vhost>
+ SetHandler modperl
+ PerlResponseHandler TestBasic::Vhost
+ </Location>
+</VirtualHost>
+</NoAutoConfig>