diff options
author | Jan Kneschke <jan@kneschke.de> | 2005-09-01 12:10:59 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2005-09-01 12:10:59 +0000 |
commit | a732e8474826bfce9ce93f693ee81e7d54b75cd9 (patch) | |
tree | 56d7c5d8bb16fb658defec9ccf2f979c8d97fab1 /tests | |
parent | 6f3e816fba8d5e39a0fb2b4be5a6394ab0bb4f28 (diff) | |
download | lighttpd-git-a732e8474826bfce9ce93f693ee81e7d54b75cd9.tar.gz |
use netstat to check if a process is listening on port 1026
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@673 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/LightyTest.pm | 13 | ||||
-rwxr-xr-x | tests/mod-fastcgi.t | 2 | ||||
-rwxr-xr-x | tests/mod-rewrite.t | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm index 120db313..97e138e5 100755 --- a/tests/LightyTest.pm +++ b/tests/LightyTest.pm @@ -38,20 +38,17 @@ sub new { return $self; } -sub pidof { +sub listening_on { my $self = shift; my $prog = shift; - open F, "ps ax | grep $prog | grep -v grep | awk '{ print \$1 }'|" or - open F, "ps -ef | grep $prog | grep -v grep | awk '{ print \$2 }'|" or - return -1; + open F, "netstat -an | grep :1026|" or return 0; - my $pid = <F>; - close F; + my $foo = <F>; - if (defined $pid) { return $pid; } + close F; - return -1; + return (defined $foo ? 1 : 0); } sub stop_proc { diff --git a/tests/mod-fastcgi.t b/tests/mod-fastcgi.t index a5a88a3c..c6acec7e 100755 --- a/tests/mod-fastcgi.t +++ b/tests/mod-fastcgi.t @@ -15,7 +15,7 @@ my $tf = LightyTest->new(); my $t; SKIP: { - skip "no PHP running on port 1026", 28 if $tf->pidof("php") == -1; + skip "no PHP running on port 1026", 28 unless $tf->listening_on(1026); ok($tf->start_proc == 0, "Starting lighttpd") or die(); diff --git a/tests/mod-rewrite.t b/tests/mod-rewrite.t index cb37a421..31c7d1ae 100755 --- a/tests/mod-rewrite.t +++ b/tests/mod-rewrite.t @@ -16,7 +16,7 @@ my $t; SKIP: { - skip "no PHP running on port 1026", 5 if $tf->pidof("php") == -1; + skip "no PHP running on port 1026", 5 unless $tf->listening_on(1026); ok($tf->start_proc == 0, "Starting lighttpd") or die(); |