summaryrefslogtreecommitdiff
path: root/tests/mod-fastcgi.t
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2008-07-29 21:22:28 +0000
committerStefan Bühler <stbuehler@web.de>2008-07-29 21:22:28 +0000
commit3bb07cad076aa5c9a7d78ef6df647ab3c311dc04 (patch)
treefea63bd30718da7a841118a788739de57a794516 /tests/mod-fastcgi.t
parentcbd40dc44bed9537fd02c3c1608de68e055c2962 (diff)
downloadlighttpd-git-3bb07cad076aa5c9a7d78ef6df647ab3c311dc04.tar.gz
[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-c4023f1b3aa9
Diffstat (limited to 'tests/mod-fastcgi.t')
-rwxr-xr-xtests/mod-fastcgi.t32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/mod-fastcgi.t b/tests/mod-fastcgi.t
index 5ae3c994..d03ed2fc 100755
--- a/tests/mod-fastcgi.t
+++ b/tests/mod-fastcgi.t
@@ -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
@@ -199,6 +208,12 @@ EOF
}
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";
$tf->{CONFIGFILE} = 'fastcgi-auth.conf';
@@ -325,3 +340,10 @@ EOF
ok($tf->stop_proc == 0, "Stopping lighttpd");
}
+exit 0;
+
+cleanup: ;
+
+$tf->endspawnfcgi($php_child) if $php_child != -1;
+
+die();