Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2004-03-05 Thread Stas Bekman
Geoffrey Young wrote:
$ENV{APACHE_TEST_STARTUP_TIMEOUT} now supersedes -startup_timeout
[...]

What's the reason for this change? 

it was a follow up from something on modperl@

I almost always expect that command
line arguments supercede env variables.. i.e.
$> CVSROOT=foo cvs -d bar co foo
Bad CVSROOT: `bar'.
What you can see should win over what you can't see, IMO

yeah, I thought about this after committing it - it's definitely better the
way it was.  but it leaves mod_perl users in a lurch if they want to up the
startup time.  the better solution is probably to have ModPerl::TestRun look
at %ENV before it sets the startup timeout.
I'll fit that tomorrow unless you or stas beat me to it.
I've committed that change already. But I'll leave it to you to revert the one 
you committed ;)

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2004-03-05 Thread Geoffrey Young

>>  $ENV{APACHE_TEST_STARTUP_TIMEOUT} now supersedes -startup_timeout
>>[...]
> 
> 
> What's the reason for this change? 

it was a follow up from something on modperl@

> I almost always expect that command
> line arguments supercede env variables.. i.e.
> 
> $> CVSROOT=foo cvs -d bar co foo
> Bad CVSROOT: `bar'.
> 
> What you can see should win over what you can't see, IMO

yeah, I thought about this after committing it - it's definitely better the
way it was.  but it leaves mod_perl users in a lurch if they want to up the
startup time.  the better solution is probably to have ModPerl::TestRun look
at %ENV before it sets the startup timeout.

I'll fit that tomorrow unless you or stas beat me to it.

--Geoff



Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2004-03-05 Thread Stas Bekman
Philippe M. Chiasson wrote:
On Thu, 2004-03-04 at 22:21 +, [EMAIL PROTECTED] wrote:
geoff   2004/03/04 14:21:27
 Modified:perl-framework/Apache-Test Changes
  perl-framework/Apache-Test/lib/Apache TestServer.pm
 Log:
 $ENV{APACHE_TEST_STARTUP_TIMEOUT} now supersedes -startup_timeout
[...]

What's the reason for this change? I almost always expect that command
line arguments supercede env variables.. i.e.
$> CVSROOT=foo cvs -d bar co foo
Bad CVSROOT: `bar'.
What you can see should win over what you can't see, IMO
Yup, I've already pointed that out. I guess Geoff is not around.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2004-03-05 Thread Philippe M. Chiasson
On Thu, 2004-03-04 at 22:21 +, [EMAIL PROTECTED] wrote:
> geoff   2004/03/04 14:21:27
> 
>   Modified:perl-framework/Apache-Test Changes
>perl-framework/Apache-Test/lib/Apache TestServer.pm
>   Log:
>   $ENV{APACHE_TEST_STARTUP_TIMEOUT} now supersedes -startup_timeout
> [...]

What's the reason for this change? I almost always expect that command
line arguments supercede env variables.. i.e.

$> CVSROOT=foo cvs -d bar co foo
Bad CVSROOT: `bar'.

What you can see should win over what you can't see, IMO
-- 
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: This is a digitally signed message part


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2004-02-24 Thread Stas Bekman
Geoffrey Young wrote:
  sub config_defines {
 +my $self = shift;
 +
  my @defines = ();
  
  for my $item (qw(useithreads)) {
 @@ -88,7 +90,9 @@
  push @defines, "-DPERL_\U$item";
  }
  
 -push @defines, map { "-D$_" } split " ", shift->{config}->{vars}->{defines};
 +if (my $defines = $self->{config}->{vars}->{defines}) {
 +push @defines, map { "-D$_" } split " ", $defines;
 +}
  
  "@defines";
  }

were you seeing specific undef warnings?  I ran it with and without the
-defines option and didn't run across anything.  was there a specific case
where {vars}->{defines} wasn't initalized properly in the constructor (like
t/SMOKE or something)?
Yup, t/SMOKE was the one. It needs more polishing, but for now this fix was 
neded to get it running.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2004-02-24 Thread Geoffrey Young

>sub config_defines {
>   +my $self = shift;
>   +
>my @defines = ();
>
>for my $item (qw(useithreads)) {
>   @@ -88,7 +90,9 @@
>push @defines, "-DPERL_\U$item";
>}
>
>   -push @defines, map { "-D$_" } split " ", 
> shift->{config}->{vars}->{defines};
>   +if (my $defines = $self->{config}->{vars}->{defines}) {
>   +push @defines, map { "-D$_" } split " ", $defines;
>   +}
>
>"@defines";
>}

were you seeing specific undef warnings?  I ran it with and without the
-defines option and didn't run across anything.  was there a specific case
where {vars}->{defines} wasn't initalized properly in the constructor (like
t/SMOKE or something)?

--Geoff



Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-04-07 Thread Stas Bekman
Doug MacEachern wrote:
it is a nice feature when it works, so i've re-enabled for linux only.
for the other platforms in the current state, its better to wait 60 
seconds if the server fails to start than to throw and error and die when 
it has successfully started.
that's a nice alternative :)
Hopefully those with access to platforms where it doesn't work, figure 
out what's the problem.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-04-07 Thread Doug MacEachern
it is a nice feature when it works, so i've re-enabled for linux only.
for the other platforms in the current state, its better to wait 60 
seconds if the server fails to start than to throw and error and die when 
it has successfully started.




Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-04-07 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
dougm   02/04/06 18:14:40
  Modified:perl-framework/Apache-Test/lib/Apache TestServer.pm
  Log:
  this $SIG{CHLD} / $? status checking stuff does not work well on
  solaris or hpux.  more often than not get:
  
   waiting for server to start: 00:02
   server has died with status 255 (please examine t/logs/error_log)
   Terminated
  
  and yet the server has started just fine, can run t/TEST -run and all
  tests pass.
  disabling this until somebody can make the code work properly on all
  platforms.
That somebody doesn't have access to hpux/solaris to debug the problem. 
Anybody to help me here.

Now that you've disable the SIGCHLD if something goes wrong, user will 
have to wait for 60 secs before will be dropped to the shell.
Hmm, how about this approach:

change SIGCHLD to ping the server before checking the status? May not 
work properly on slower machines.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Doug MacEachern
On Mon, 7 Jan 2002, Stas Bekman wrote:
 
> better move it to the top, in case it needs to be used earlier.

not sure what you mean by earlier?  i don't see any problems with the way
it is, $parent_pid will be set before any of the subroutines are called.




Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Stas Bekman
Doug MacEachern wrote:
On Mon, 7 Jan 2002, Stas Bekman wrote:
 

I needed it TestRun, whereas the fork was happening in TestServer. So it 
was definitely easier to do it locally.

are you saying the following patch would not work?
+1
better move it to the top, in case it needs to be used earlier.
_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Doug MacEachern
On Mon, 7 Jan 2002, Stas Bekman wrote:
 
> I needed it TestRun, whereas the fork was happening in TestServer. So it 
> was definitely easier to do it locally.

are you saying the following patch would not work?

Index: Apache-Test/lib/Apache/TestRun.pm
===
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.82
diff -u -r1.82 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm   6 Jan 2002 07:08:05 -   1.82
+++ Apache-Test/lib/Apache/TestRun.pm   6 Jan 2002 18:45:46 -
@@ -248,6 +248,9 @@
 $opts->{'run-tests'} ||= @$tests;
 }
 
+my $parent_pid = $$;
+sub is_parent { $$ == $parent_pid }
+
 my $caught_sig_int = 0;
 
 sub install_sighandlers {
@@ -276,9 +279,8 @@
 #must eval "" to "install" this END block, otherwise it will
 #always run, a subclass might not want that
 
-eval 'my $parent_pid = $$;
-  END {
- return unless $$ == $parent_pid; # because of fork
+eval 'END {
+ return unless is_parent(); # because of fork
  local $?; # preserve the exit status
  eval {
 Apache::TestRun->new(test_config =>




Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Stas Bekman
Doug MacEachern wrote:
On Sun, 6 Jan 2002, Stas Bekman wrote:
 

I've done with this:
-eval 'END {
+eval 'my $parent_pid = $$;
+  END {
+ return unless $$ == $parent_pid; # because of fork
ok.  i thought is_parent() could be useful elsewhere, but i guess we could
worry about that later if needed.
I needed it TestRun, whereas the fork was happening in TestServer. So it 
was definitely easier to do it locally.

_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Doug MacEachern
On Sun, 6 Jan 2002, Stas Bekman wrote:
 
> I've done with this:
> 
> 
> -eval 'END {
> +eval 'my $parent_pid = $$;
> +  END {
> + return unless $$ == $parent_pid; # because of fork

ok.  i thought is_parent() could be useful elsewhere, but i guess we could
worry about that later if needed.



Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Stas Bekman
Doug MacEachern wrote:
On Fri, 4 Jan 2002, Stas Bekman wrote:
 

Any idea how to disable the END blocks inheritance in the forked child? 

my $Pid = $$;
sub is_parent {
$$ == $Pid;
}
my $pid = fork;
exit unless $pid;
END {
print "END pid=$$\n";
return unless is_parent();
print "stuff\n";
}
prints:
END pid=2687
END pid=2688
stuff
without 'return unless is_parent()' prints 'stuff' twice.

nice :) I was thinking there is some magic way to tell Perl not to run END 
block.
I've done with this:
-eval 'END {
+eval 'my $parent_pid = $$;
+  END {
+ return unless $$ == $parent_pid; # because of fork
  local $?; # preserve the exit status
--
_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-06 Thread Doug MacEachern
On Fri, 4 Jan 2002, Stas Bekman wrote:
 
> Any idea how to disable the END blocks inheritance in the forked child? 

my $Pid = $$;

sub is_parent {
$$ == $Pid;
}

my $pid = fork;

exit unless $pid;

END {
print "END pid=$$\n";
return unless is_parent();
print "stuff\n";
}

prints:
END pid=2687
END pid=2688
stuff

without 'return unless is_parent()' prints 'stuff' twice.




Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-01-04 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
stas02/01/03 20:48:58
  Modified:perl-framework/Apache-Test/lib/Apache TestServer.pm
  Log:
  - use explicit fork for spawning httpd, now works with 1.3 and 2.0
  
  Revision  ChangesPath
  1.48  +10 -1 httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm

The only trouble this fix has introduced is that now the forked child 
inherits END blocks from the parent and runs them on exit. So you get 
the output of the core_scan in the middle of the parent print.

As I said earlier httpd-2.0 restarts itself in a way that:
  system "httpd ...";
returns immediately, no matter whether the startup was successful or 
not. But 1.3 doesn't return at all, unless the startup wasn't 
successful. So this fork is needed only for 1.3

Any idea how to disable the END blocks inheritance in the forked child? 
I guess we could silence it, by closing STD*. but in the future we may 
have other END blocks which can be undesired to be run in the forked 
sub-process.


  Index: TestServer.pm
  ===
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- TestServer.pm	31 Dec 2001 10:58:22 -	1.47
  +++ TestServer.pm	4 Jan 2002 04:48:58 -	1.48
  @@ -433,7 +433,16 @@
   }
   }
   };
  -$child_pid = open $child_in_pipe, "|$cmd";
  +
  +defined(my $pid = fork) or die "Can't fork: $!";
  +unless ($pid) { # child
  +my $status = system "$cmd";
  +if ($status) {
  +$status  = $? >> 8;
  +#error "httpd didn't start! $status";
  +}
  +CORE::exit $status;
  +}
   }
   
   while ($old_pid and $old_pid == $self->pid) {
_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2001-11-01 Thread Doug MacEachern
On Sun, 21 Oct 2001, Stas Bekman wrote:

> [EMAIL PROTECTED] wrote:
> 
> > dougm   01/10/20 11:01:32
> > 
> >   Modified:perl-framework/Apache-Test/lib/Apache TestServer.pm
> >   Log:
> >   make sure only 1 process is started for win32; else Kill will only 
> > shutdown the parent
> 
> 
> doesn't it contradict with being able to override maxclients? So if a 
> certain test relies on the fact that it needs 2 servers at the same 
> time, this will hang.

no.  win32 and all mpms aside from prefork can handle concurrent 
requests > 1 with -DONE_PROCESS  




Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2001-10-21 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
dougm   01/10/20 11:01:32
  Modified:perl-framework/Apache-Test/lib/Apache TestServer.pm
  Log:
  make sure only 1 process is started for win32; else Kill will only shutdown 
the parent

doesn't it contradict with being able to override maxclients? So if a 
certain test relies on the fact that it needs 2 servers at the same 
time, this will hang.

At the end I didn't need 2 clients for ModPerl::Registry tests (so far) 
but it's possible that me or some other project using Apache::Test will 
need this functionality.

I suggest to at least warn if maxclients =! 1 and WIN32 and we can solve 
it later.

Or does it mean that the tests that require 1+ servers need to skip on 
WIN32?

_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/