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

« back to all changes in this revision

Viewing changes to Apache-Test/lib/Apache/TestHarness.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::TestHarness;
2
16
 
3
17
use strict;
4
18
use warnings FATAL => 'all';
5
19
 
6
20
use Test::Harness ();
 
21
use Apache::Test ();
7
22
use Apache::TestSort ();
8
23
use Apache::TestTrace;
9
 
use File::Spec::Functions qw(catfile);
 
24
use File::Spec::Functions qw(catfile catdir);
10
25
use File::Find qw(finddepth);
11
26
use File::Basename qw(dirname);
12
27
 
13
 
sub chdir_t {
14
 
    chdir 't' if -d 't';
15
 
#Apache::TestConfig->new takes care of @INC
16
 
#    inc_fixup();
17
 
}
18
 
 
19
28
sub inc_fixup {
20
29
    # use blib
21
30
    unshift @INC, map "blib/$_", qw(lib arch);
29
38
#skip tests listed in t/SKIP
30
39
sub skip {
31
40
    my($self, $file) = @_;
32
 
    $file ||= 'SKIP';
 
41
    $file ||= catfile Apache::Test::vars('serverroot'), 'SKIP';
33
42
 
34
43
    return unless -e $file;
35
44
 
54
63
sub run_t {
55
64
    my($self, $file) = @_;
56
65
    my $ran = 0;
57
 
    my $cmd = "$^X -Mlib=../Apache-Test/lib $file";
 
66
    my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
 
67
    my $cmd = qq[$^X -Mlib="$lib" $file];
58
68
 
59
69
    my $h = Symbol::gensym();
60
70
    open $h, "$cmd|" or die "open $cmd: $!";
101
111
    my $args = shift;
102
112
    my @tests = ();
103
113
 
104
 
    chdir_t();
 
114
    my $base = -d 't' ? catdir('t', '.') : '.';
105
115
 
106
116
    my $ts = $args->{tests} || [];
107
117
 
108
118
    if (@$ts) {
109
119
        for (@$ts) {
110
120
            if (-d $_) {
111
 
                push(@tests, sort <$_/*.t>);
 
121
                push(@tests, sort <$base/$_/*.t>);
112
122
            }
113
123
            else {
114
124
                $_ .= ".t" unless /\.t$/;
118
128
    }
119
129
    else {
120
130
        if ($args->{tdirs}) {
121
 
            push @tests, map { sort <$_/*.t> } @{ $args->{tdirs} };
 
131
            push @tests, map { sort <$base/$_/*.t> } @{ $args->{tdirs} };
122
132
        }
123
133
        else {
124
134
            finddepth(sub {
127
137
                          my $dotslash = catfile '.', "";
128
138
                          $t =~ s:^\Q$dotslash::;
129
139
                          push @tests, $t
130
 
                      }, '.');
 
140
                      }, $base);
131
141
            @tests = sort @tests;
132
142
        }
133
143
    }