File: prefork.t

package info (click to toggle)
libapache2-mod-perl2 2.0.13-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 12,016 kB
  • sloc: perl: 97,771; ansic: 14,493; makefile: 51; sh: 18
file content (48 lines) | stat: -rw-r--r-- 1,450 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest;
use Apache::TestConfig ();

use Apache2::Build ();

my $mpm_is_threaded = Apache2::Build->build_config->mpm_is_threaded();

my %modules = (
    registry         => 'ModPerl::Registry',
    perlrun          => 'ModPerl::PerlRun',
    registry_prefork => 'ModPerl::RegistryPrefork',
    perlrun_prefork  => 'ModPerl::PerlRunPrefork',
);

my @aliases = sort keys %modules;

plan tests => 1*@aliases, need 'mod_alias.c',
    { "can't run under threaded MPMs" => !$mpm_is_threaded };

my $script = "prefork.pl";

# very basic compilation/response test
for my $alias (qw(registry_prefork perlrun_prefork)) {
    my $url = "/$alias/$script";

    #t_debug "$url";
    ok t_cmp GET_BODY($url), "ok $script", "$modules{$alias} test";
}

# the order is important, we also want to check that prefork specific
# modules didn't affect the cwd of other modules

# the normal handlers should not find the script in the cwd, as they
# don't chdir to its directory before running the script
for my $alias (qw(registry perlrun)) {
    my $url = "/$alias/$script";

    #t_debug "$url";
    ok t_cmp GET_BODY($url), 
        qr/prefork didn't chdir into the scripts directory/,
            "$modules{$alias} test";
}