[tests] Fixed tests needing php running (if not running on port 1026, search php in env[PHP] or /usr/bin/php-cgi)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2243 152afb58-edef-0310-8abb-c4023f1b3aa9svn/tags/lighttpd-1.4.20
parent
cbd40dc44b
commit
3bb07cad07
1
NEWS
1
NEWS
|
@ -33,6 +33,7 @@ NEWS
|
|||
* fix scgi HTTP/1.* status parsing (#1638), found by met@uberstats.com
|
||||
* [tests] fixed system, use foreground daemons and waitpid
|
||||
* [tests] removed pidfile from test system
|
||||
* [tests] fixed tests needing php running (if not running on port 1026, search php in env[PHP] or /usr/bin/php-cgi)
|
||||
|
||||
- 1.4.19 - 2008-03-10
|
||||
|
||||
|
|
|
@ -7,17 +7,26 @@ BEGIN {
|
|||
}
|
||||
|
||||
use strict;
|
||||
use Test::More tests => 47;
|
||||
use Test::More tests => 49;
|
||||
use LightyTest;
|
||||
|
||||
my $tf = LightyTest->new();
|
||||
|
||||
my $t;
|
||||
my $php_child = -1;
|
||||
|
||||
my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi');
|
||||
|
||||
SKIP: {
|
||||
skip "PHP already running on port 1026", 1 if $tf->listening_on(1026);
|
||||
skip "no php binary found", 1 unless -x $phpbin;
|
||||
ok(-1 != ($php_child = $tf->spawnfcgi($phpbin, 1026)), "Spawning php");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "no PHP running on port 1026", 29 unless $tf->listening_on(1026);
|
||||
|
||||
ok($tf->start_proc == 0, "Starting lighttpd") or die();
|
||||
ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup;
|
||||
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /phpinfo.php HTTP/1.0
|
||||
|
@ -161,7 +170,7 @@ EOF
|
|||
|
||||
|
||||
$tf->{CONFIGFILE} = 'fastcgi-10.conf';
|
||||
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
|
||||
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or goto cleanup;
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /get-server-env.php?env=SERVER_NAME HTTP/1.0
|
||||
Host: zzz.example.org
|
||||
|
@ -173,7 +182,7 @@ EOF
|
|||
ok($tf->stop_proc == 0, "Stopping lighttpd");
|
||||
|
||||
$tf->{CONFIGFILE} = 'bug-06.conf';
|
||||
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
|
||||
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or goto cleanup;
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /indexfile/ HTTP/1.0
|
||||
Host: www.example.org
|
||||
|
@ -185,7 +194,7 @@ EOF
|
|||
ok($tf->stop_proc == 0, "Stopping lighttpd");
|
||||
|
||||
$tf->{CONFIGFILE} = 'bug-12.conf';
|
||||
ok($tf->start_proc == 0, "Starting lighttpd with bug-12.conf") or die();
|
||||
ok($tf->start_proc == 0, "Starting lighttpd with bug-12.conf") or goto cleanup;
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
POST /indexfile/abc HTTP/1.0
|
||||
Host: www.example.org
|
||||
|
@ -198,6 +207,12 @@ EOF
|
|||
ok($tf->stop_proc == 0, "Stopping lighttpd");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "PHP not started, cannot stop it", 1 unless $php_child != -1;
|
||||
ok(0 == $tf->endspawnfcgi($php_child), "Stopping php");
|
||||
$php_child = -1;
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "no fcgi-auth found", 4 unless -x $tf->{BASEDIR}."/tests/fcgi-auth" || -x $tf->{BASEDIR}."/tests/fcgi-auth.exe";
|
||||
|
||||
|
@ -325,3 +340,10 @@ EOF
|
|||
ok($tf->stop_proc == 0, "Stopping lighttpd");
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
cleanup: ;
|
||||
|
||||
$tf->endspawnfcgi($php_child) if $php_child != -1;
|
||||
|
||||
die();
|
||||
|
|
|
@ -8,17 +8,25 @@ BEGIN {
|
|||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 7;
|
||||
use LightyTest;
|
||||
|
||||
my $tf = LightyTest->new();
|
||||
my $t;
|
||||
my $php_child = -1;
|
||||
|
||||
my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi');
|
||||
|
||||
SKIP: {
|
||||
skip "PHP already running on port 1026", 1 if $tf->listening_on(1026);
|
||||
skip "no php binary found", 1 unless -x $phpbin;
|
||||
ok(-1 != ($php_child = $tf->spawnfcgi($phpbin, 1026)), "Spawning php");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "no PHP running on port 1026", 5 unless $tf->listening_on(1026);
|
||||
|
||||
ok($tf->start_proc == 0, "Starting lighttpd") or die();
|
||||
ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup;
|
||||
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /rewrite/foo HTTP/1.0
|
||||
|
@ -27,7 +35,7 @@ EOF
|
|||
);
|
||||
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
|
||||
ok($tf->handle_http($t) == 0, 'valid request');
|
||||
|
||||
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /rewrite/foo?a=b HTTP/1.0
|
||||
Host: www.example.org
|
||||
|
@ -46,3 +54,17 @@ EOF
|
|||
|
||||
ok($tf->stop_proc == 0, "Stopping lighttpd");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "PHP not started, cannot stop it", 1 unless $php_child != -1;
|
||||
ok(0 == $tf->endspawnfcgi($php_child), "Stopping php");
|
||||
}
|
||||
|
||||
|
||||
exit 0;
|
||||
|
||||
cleanup: ;
|
||||
|
||||
$tf->endspawnfcgi($php_child) if $php_child != -1;
|
||||
|
||||
die();
|
||||
|
|
Loading…
Reference in New Issue