~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to Apache-Test/lib/Apache/TestServer.pm

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2004-08-19 06:23:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040819062348-jxl4koqbtvgm8v2t
Tags: 1.99.14-4
Remove the LFS CFLAGS, and build-dep against apache2-*-dev (>= 2.0.50-10)
as we're backing out of the apache2/apr ABI transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2001-2004 The Apache Software Foundation
 
2
#
 
3
# Licensed under the Apache License, Version 2.0 (the "License");
 
4
# you may not use this file except in compliance with the License.
 
5
# You may obtain a copy of the License at
 
6
#
 
7
#     http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
# Unless required by applicable law or agreed to in writing, software
 
10
# distributed under the License is distributed on an "AS IS" BASIS,
 
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
# See the License for the specific language governing permissions and
 
13
# limitations under the License.
 
14
#
1
15
package Apache::TestServer;
2
16
 
3
17
use strict;
8
22
use File::Spec::Functions qw(catfile);
9
23
 
10
24
use Apache::TestTrace;
 
25
use Apache::TestRun;
11
26
use Apache::TestConfig ();
12
27
use Apache::TestRequest ();
13
28
 
40
55
 
41
56
    $self->{version} = $self->{config}->httpd_version || '';
42
57
    $self->{mpm}     = $self->{config}->httpd_mpm     || '';
43
 
    ($self->{rev})   = $self->{version} =~ m:^Apache/(\d)\.:;
44
 
    $self->{rev}   ||= 2;
 
58
 
 
59
    # try to get the revision number from the standard Apache version
 
60
    # string and various variations made by distributions which mangle
 
61
    # that string
 
62
 
 
63
    # Apache/2.0.50-dev
 
64
    ($self->{rev})   = $self->{version} =~ m|^Apache/(\d)\.|;
 
65
 
 
66
    # Apache-AdvancedExtranetServer/1.3.29 (Mandrake Linux/1mdk)
 
67
    ($self->{rev}) ||= $self->{version} =~ m|^Apache.*?/(\d)\.|;
 
68
 
 
69
    # IBM_HTTP_SERVER/1.3.19  Apache/1.3.20 (Unix)
 
70
    ($self->{rev}) ||= $self->{version} =~ m|^.*?Apache.*?/(\d)\.|;
 
71
 
 
72
    if ($self->{rev}) {
 
73
        debug "Matched Apache revision $self->{version} $self->{rev}";
 
74
    }
 
75
    else {
 
76
        # guessing is not good as it'll only mislead users
 
77
        # and we can't die since a config object is required
 
78
        # during Makefile.PL's write_perlscript when path to httpd may
 
79
        # be unknown yet. so default to non-existing version 0 for now.
 
80
        # and let TestRun.pm figure out the required pieces
 
81
        debug "can't figure out Apache revision, from string: " .
 
82
            "'$self->{version}', using a non-existing revision 0";
 
83
        $self->{rev} = 0; # unknown
 
84
    }
45
85
 
46
86
    $self;
47
87
}
77
117
 
78
118
sub dversion {
79
119
    my $self = shift;
80
 
    "-DAPACHE$self->{rev}";
 
120
    "-D APACHE$self->{rev}";
81
121
}
82
122
 
83
123
sub config_defines {
 
124
    my $self = shift;
 
125
 
84
126
    my @defines = ();
85
127
 
86
128
    for my $item (qw(useithreads)) {
87
129
        next unless $Config{$item} and $Config{$item} eq 'define';
88
 
        push @defines, "-DPERL_\U$item";
 
130
        push @defines, "-D PERL_\U$item";
 
131
    }
 
132
 
 
133
    if (my $defines = $self->{config}->{vars}->{defines}) {
 
134
        push @defines, map { "-D $_" } split " ", $defines;
89
135
    }
90
136
 
91
137
    "@defines";
100
146
    "-d $vars->{serverroot} -f $vars->{t_conf_file} $dversion $defines";
101
147
}
102
148
 
103
 
my %one_process = (1 => '-X', 2 => '-DONE_PROCESS');
 
149
my %one_process = (1 => '-X', 2 => '-D ONE_PROCESS');
104
150
 
105
151
sub start_cmd {
106
152
    my $self = shift;
107
 
    #XXX: threaded mpm does not respond to SIGTERM with -DONE_PROCESS
 
153
    #XXX: threaded mpm does not respond to SIGTERM with -D ONE_PROCESS
108
154
    my $args = $self->args;
109
155
    return "$self->{config}->{vars}->{httpd} $args";
110
156
}
540
586
            last;
541
587
        }
542
588
        elsif ($delta > $timeout) {
543
 
            print $preamble, "giving up after $delta secs\n";
 
589
            my $suggestion = $timeout + 300;
 
590
            print $preamble, "not ok\n";
 
591
            error <<EOI;
 
592
giving up after $delta secs. If you think that your system
 
593
is slow or overloaded try again with a longer timeout value.
 
594
by setting the environment variable APACHE_TEST_STARTUP_TIMEOUT
 
595
to a high value (e.g. $suggestion) and repeat the last command.
 
596
EOI
544
597
            last;
545
598
        }
546
599
    }