Browse Source

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
svn/tags/lighttpd-1.4.3
Jan Kneschke 17 years ago
parent
commit
a732e84748
  1. 13
      tests/LightyTest.pm
  2. 2
      tests/mod-fastcgi.t
  3. 2
      tests/mod-rewrite.t

13
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 {

2
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();

2
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();

Loading…
Cancel
Save