File: TEST

package info (click to toggle)
apache-perl 1.3.9-14.1-1.21.20000309-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,524 kB
  • ctags: 1,743
  • sloc: ansic: 9,017; perl: 7,822; sh: 864; makefile: 695
file content (104 lines) | stat: -rwxr-xr-x 2,094 bytes parent folder | download | duplicates (4)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/local/bin/perl

$|++;
use Config;

# First we check if we already are within the "t" directory
if (-d "t") {
    # try to move into test directory
    chdir "t" or die "Can't chdir: $!";

    # fix all relative library locations
    foreach (@INC) {
	$_ = "../$_" unless m,^(/)|([a-f]:),i;
    }
}
# Pick up the library files from the ../blib directory
unshift(@INC, "../blib/lib", "../blib/arch");
#print "@INC\n";

use Test::Harness;
$Test::Harness::verbose = shift
  if $ARGV[0] =~ /^\d+$/ || $ARGV[0] eq "-v";

if (@ARGV) {
    for (@ARGV) {
	if (-d $_) {
	    push(@tests, <$_/*.t>);
	} else {
            $_ .= ".t" unless /\.t$/;
	    push(@tests, $_);
	}
    }
} else {

    #shutdown httpd before make aborts
    $SIG{'__DIE__'} = sub {
	return unless $_[0] =~ /^Failed/i; 
	my $el = "../t/logs/httpd.pid";
	if(-e $el) {
	    system "kill `cat $el`";
	}
	else {
	    warn "can't stat $el $!\n";
	}
	warn "httpd terminated\n";
    };

    eval { require LWP::UserAgent; };
    if ($@) {
	print <<"EOM";
$@
I still can't find LWP::UserAgent, try:
$^X -MCPAN -e install LWP

		or

http://www.perl.com/cgi-bin/cpan_mod?module=LWP

Must skip important tests without LWP...

EOM
	sleep(2);
        exit;
    }
    else {
       push(@tests, <modules/*.t>, <internal/*.t>);
    }
}

unshift @INC, '.';
require Apache::test;
Apache::test->import('simple_fetch');
use subs 'simple_fetch';

unless (simple_fetch "/test.html") {
    if ($^O eq "solaris" and $Config{myhostname} eq "ramona") {
        print "go hang in the chill room $ENV{USER}, ramona is doggin...";
    }  
    else {
        print "still waiting for server to warm up...";
    }
    for (1..4) {
        sleep $_;
        if (simple_fetch "/test.html") {
            print "ok\n";
        }
        else {
            print "...";
        }
    }
}

unless (simple_fetch "/test.html") {
    print "not ok\n"; 
    die "server failed to start! (please examine t/logs/error_log)";
}

runtests @tests;

use File::Find;
my $dir = -e "t" ? ".." : ".";
find(sub { 
     /core/ and die "uh,oh httpd dumped core!\n";
}, $dir);