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

2004-05-06 Thread Stas Bekman
Geoffrey Young wrote:
 +# _show_results() calls uses calls die() under a few
conditions,

calls uses calls ? :)

I swear something is wrong with me lately...
You must be in love :)
__
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 TestRun.pm

2004-05-06 Thread Geoffrey Young

>>   +# _show_results() calls uses calls die() under a few
>> conditions,
> 
> 
> calls uses calls ? :)

I swear something is wrong with me lately...

--Geoff


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

2004-05-06 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
geoff   2004/05/05 18:10:22
  Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
  Log:
  make sure that die() messages from Test::Harness::_show_results() make it
  back to the user, particularly the summary printed when some tests fail
  
  Revision  ChangesPath
  1.167 +6 -0  httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm
  
  Index: TestRun.pm
  ===
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
  retrieving revision 1.166
  retrieving revision 1.167
  diff -u -r1.166 -r1.167
  --- TestRun.pm	16 Apr 2004 20:29:23 -	1.166
  +++ TestRun.pm	6 May 2004 01:10:22 -	1.167
  @@ -347,6 +347,12 @@
   
   $SIG{__DIE__} = sub {
   return unless $_[0] =~ /^Failed/i; #dont catch Test::ok failures
  +
  +# _show_results() calls uses calls die() under a few conditions,
calls uses calls ? :)
--
__
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 TestRun.pm TestSSLCA.pm

2004-02-19 Thread Stas Bekman
Stas Bekman wrote:
[EMAIL PROTECTED] wrote:
stas2004/02/09 10:07:49
  Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
TestSSLCA.pm
  Log:
  more t/ related fixes

   $self->{reconfigure} = $opts{configure} ||
 (grep { $opts{$_}->[0] } qw(preamble postamble)) ||
   (grep { $Apache::TestConfig::Usage{$_} } keys %conf_opts ) ||
  -  $self->passenv() || (! -e 'conf/httpd.conf');
  +  $self->passenv() || (! -e 't/conf/httpd.conf');
[...]
  -my $file = "conf/$name.cnf";
  +my $file = "t/conf/$name.cnf";

we probably need to add a chdir_top call which used to be chdir_t, so 
that 'TEST' will work in addition to 't/TEST". chdir_top should make 
sure we are outside of 't'.
I've added that functionality.
__
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 TestRun.pm TestSSLCA.pm

2004-02-17 Thread Stas Bekman
Joe Orton wrote:
Oh, I see I just undid your commit. Did this really work for you? 

I was always getting, from a clean checkout:
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl ./t/TEST
[warning] generating SSL CA for asf
[  error] configure() has failed:
open t/conf/ca.cnf: No such file or directory at /blah/TestSSLCA.pm line 494.
 
[warning] forcing Apache::TestConfig object save
[warning] run 't/TEST -clean' to clean up before continuing
No, I think yours is right. I guess I had the ssl conf cached so I didn't 
notice that, when doing a batch of fixes. Thanks for the fix, Joe.

On Mon, Feb 09, 2004 at 06:07:49PM -, [EMAIL PROTECTED] wrote:
 --- TestSSLCA.pm	8 Jan 2004 17:15:37 -	1.15
 +++ TestSSLCA.pm	9 Feb 2004 18:07:49 -	1.16
 @@ -170,7 +170,7 @@
  sub config_file {
  my $name = shift;
  
 -my $file = "conf/$name.cnf";
 +my $file = "t/conf/$name.cnf";
  return $file if -e $file;
  
  my $dn = dn($name);

--
__
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 TestRun.pm TestSSLCA.pm

2004-02-17 Thread Joe Orton
Oh, I see I just undid your commit. Did this really work for you? 

I was always getting, from a clean checkout:

[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl ./t/TEST
[warning] generating SSL CA for asf
[  error] configure() has failed:
open t/conf/ca.cnf: No such file or directory at /blah/TestSSLCA.pm line 494.
 
[warning] forcing Apache::TestConfig object save
[warning] run 't/TEST -clean' to clean up before continuing

On Mon, Feb 09, 2004 at 06:07:49PM -, [EMAIL PROTECTED] wrote:
>   --- TestSSLCA.pm8 Jan 2004 17:15:37 -   1.15
>   +++ TestSSLCA.pm9 Feb 2004 18:07:49 -   1.16
>   @@ -170,7 +170,7 @@
>sub config_file {
>my $name = shift;
>
>   -my $file = "conf/$name.cnf";
>   +my $file = "t/conf/$name.cnf";
>return $file if -e $file;
>
>my $dn = dn($name);
>   
>   
>   


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

2004-02-09 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
stas2004/02/09 10:07:49
  Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
TestSSLCA.pm
  Log:
  more t/ related fixes

   $self->{reconfigure} = $opts{configure} ||
 (grep { $opts{$_}->[0] } qw(preamble postamble)) ||
   (grep { $Apache::TestConfig::Usage{$_} } keys %conf_opts ) ||
  -  $self->passenv() || (! -e 'conf/httpd.conf');
  +  $self->passenv() || (! -e 't/conf/httpd.conf');
[...]
  -my $file = "conf/$name.cnf";
  +my $file = "t/conf/$name.cnf";
we probably need to add a chdir_top call which used to be chdir_t, so that 
'TEST' will work in addition to 't/TEST". chdir_top should make sure we are 
outside of 't'.

__
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 TestRun.pm

2004-01-18 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
stas2004/01/18 00:08:39

  +if $self->{reconfigure} is true, make sure to perform a complete
  +reconfiguration, to solve the bug where conf.in files weren't reparsed
  +and vhost hostport info was getting lost on subsequent runs when
  +APACHE env var was set (one of the cases when $self->{reconfigure} is
  +true). [Stas]
  +
[...]
   
  +if (!$refreshed && $self->{reconfigure}) {
  +# XXX: there is a whole bunch of reasons, see above where
  +# $self->{reconfigure} is defined, could add reasons there or
  +# may be move the logic from there here?
  +warning "forcing re-configuration";
  +unless ($refreshed) {
  +$self->refresh;
  +$refreshed = 1;
  +$test_config = $self->{test_config};
  +}
  +}
  +
That configure/reconfigure logic becomes more and more twisted and it takes 
ages to figure out what's going wrong if there is a problem :( Hope one day 
someone will be up to rewrite this growing spaghetti. But I think what we 
really need first, is a test suite for A-T itself (with hundreds of possible 
invocation options and various sequences), since it's so easy to break things 
when fixing other things. once we have it it safe to start thinking about 
rewrite/refactoring, may be in chunks, since we know we won't break what we 
have already.

__
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 TestRun.pm

2003-12-19 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
stas2003/12/19 01:12:12
  Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
  Log:
  if the test suite was aborted because of a user-error we don't want
  to call the bugreport and invite users to submit a bug report -
  after all it's a user error. but we still want the program to fail,
  so add an accessor to set/read this flag. bugreport will run the report sub 
only if
  the test suite has failed and this flag is not on.
As we added the bugreport facility we have forgotten that some of the failures 
are user-errors and inviting users to submit a bug report is plain wrong. So 
I've added a possible solution for the running as root problem as I don't want 
us to get flooded with reports, which we can't do much about and the diagnosis 
message is already pretty clear.

There are a few other user errors that we need to raise this flag, to avoid 
the bugreport banner.

Feel free to suggest a different way to handle this issue, it's an internal 
change and shouldn't affect users.

  Revision  ChangesPath
  1.129 +16 -3 httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm
  
  Index: TestRun.pm
  ===
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -u -r1.128 -r1.129
  --- TestRun.pm	16 Dec 2003 21:03:44 -	1.128
  +++ TestRun.pm	19 Dec 2003 09:12:12 -	1.129
  @@ -67,6 +67,17 @@
   $^X = $Config{perlpath} unless -e $^X;
   }
   
  +# if the test suite was aborted because of a user-error we don't want
  +# to call the bugreport and invite users to submit a bug report -
  +# after all it's a user error. but we still want the program to fail,
  +# so raise this flag in such a case.
  +my $user_error = 0;
  +sub user_error {
  +my $self = shift;
  +$user_error = shift if @_;
  +$user_error;
  +}
  +
   sub new {
   my $class = shift;
   
  @@ -322,8 +333,8 @@
   
   sub try_bug_report {
   my $self = shift;
  -if ($? && $self->{opts}->{bugreport} && 
  -  $self->can('bug_report')) {
  +if ($? && !$self->user_error &&
  +$self->{opts}->{bugreport} && $self->can('bug_report')) {
   $self->bug_report;
   }
   }
  @@ -869,8 +880,9 @@
   my $res = qx[$check] || '';
   warning "result: $res";
   unless ($res eq 'OK') {
  +$self->user_error(1);
   #$self->restore_t_perms;
  -error(<<"EOI") && die "\n";
  +error <<"EOI";
   You are running the test suite under user 'root'.
   Apache cannot spawn child processes as 'root', therefore
   we attempt to run the test suite with user '$user' ($uid:$gid).
  @@ -889,6 +901,7 @@
 % $check
   from that directory.
   EOI
  +exit_perl 0;
   }
   }

__
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 TestRun.pm

2003-01-31 Thread Stas Bekman
Randy Kobes wrote:
On Fri, 31 Jan 2003, Stas Bekman wrote:

Is the whole test-under-'root' issue moot under win32, and can
be safely skipped without messing the code?

Hi Stas,
  There is a concept of permissions under Win32 (some flavours)
which in principle can enter this (for example, an Administrator
can block users from modifying certain system settings). However,
I've not had, or heard of, such problems in this context of
testing Apache. Probably if they did arise a much different
logic would have to be used.
Thanks Randy, so I'll just change the code to skip the function for win32.

__
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 TestRun.pm

2003-01-31 Thread Randy Kobes
On Fri, 31 Jan 2003, Stas Bekman wrote:

> Is the whole test-under-'root' issue moot under win32, and can
> be safely skipped without messing the code?

Hi Stas,
  There is a concept of permissions under Win32 (some flavours)
which in principle can enter this (for example, an Administrator
can block users from modifying certain system settings). However,
I've not had, or heard of, such problems in this context of
testing Apache. Probably if they did arise a much different
logic would have to be used.
  
-- 
best regards,
randy



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

2003-01-31 Thread Stas Bekman
Randy Kobes wrote:
On Fri, 31 Jan 2003, Stas Bekman wrote:

[EMAIL PROTECTED] wrote:
stas2003/01/30 16:53:45
 Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
 Log:
 # handle the cases when the test suite is run under 'root':
 #
 # 1. When user 'bar' is chosen to run Apache with, files and dirs
 #created by 'root' might be not writable/readable by 'bar'
 #
 # 2. when the source is extracted as user 'foo', and the chosen user
 #to run Apache under is 'bar', in which case normally 'bar' won't
 #have the right permissions to write into the fs created by 'foo'.
 #
 # We solve that by 'chown -R bar.bar t/' in a portable way.
 #
 # at the end of the run we restore the perms to the original ones
Randy, can you please check that this handles the win32 case as well? I've no 
clue whether the concept of 'root' applies there.

Hi Stas,
   On Win32, I get an error about getpwuid($>) being 
unimplemented. This diff
Thanks Randy!
Is the whole test-under-'root' issue moot under win32, and can be safely 
skipped without messing the code?

==
Index: Apache-Test/lib/Apache/TestRun.pm
===
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.100
diff -u -r1.100 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	31 Jan 2003 00:53:45 -	1.100
+++ Apache-Test/lib/Apache/TestRun.pm	31 Jan 2003 04:38:35 -
@@ -667,7 +667,7 @@
 my $self = shift;
 %original_t_perms = (); # reset global
 
-my $user = getpwuid($>) || '';
+my $user = Apache::TestConfig::WIN32 ? '' : (getpwuid($>) || '');
 if ($user eq 'root') {
 my $vars = $self->{test_config}->{vars};
 my $user = $vars->{user};
===

allows things to run.

--
__
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 TestRun.pm

2003-01-31 Thread Randy Kobes
On Fri, 31 Jan 2003, Stas Bekman wrote:

> [EMAIL PROTECTED] wrote:
> > stas2003/01/30 16:53:45
> > 
> >   Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
> >   Log:
> >   # handle the cases when the test suite is run under 'root':
> >   #
> >   # 1. When user 'bar' is chosen to run Apache with, files and dirs
> >   #created by 'root' might be not writable/readable by 'bar'
> >   #
> >   # 2. when the source is extracted as user 'foo', and the chosen user
> >   #to run Apache under is 'bar', in which case normally 'bar' won't
> >   #have the right permissions to write into the fs created by 'foo'.
> >   #
> >   # We solve that by 'chown -R bar.bar t/' in a portable way.
> >   #
> >   # at the end of the run we restore the perms to the original ones
> 
> Randy, can you please check that this handles the win32 case as well? I've no 
> clue whether the concept of 'root' applies there.

Hi Stas,
   On Win32, I get an error about getpwuid($>) being 
unimplemented. This diff

==
Index: Apache-Test/lib/Apache/TestRun.pm
===
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.100
diff -u -r1.100 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm   31 Jan 2003 00:53:45 -  1.100
+++ Apache-Test/lib/Apache/TestRun.pm   31 Jan 2003 04:38:35 -
@@ -667,7 +667,7 @@
 my $self = shift;
 %original_t_perms = (); # reset global
 
-my $user = getpwuid($>) || '';
+my $user = Apache::TestConfig::WIN32 ? '' : (getpwuid($>) || '');
 if ($user eq 'root') {
 my $vars = $self->{test_config}->{vars};
 my $user = $vars->{user};
===

allows things to run.

-- 
best regards,
randy



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

2003-01-31 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
stas2003/01/30 16:53:45
  Modified:perl-framework/Apache-Test/lib/Apache TestRun.pm
  Log:
  # handle the cases when the test suite is run under 'root':
  #
  # 1. When user 'bar' is chosen to run Apache with, files and dirs
  #created by 'root' might be not writable/readable by 'bar'
  #
  # 2. when the source is extracted as user 'foo', and the chosen user
  #to run Apache under is 'bar', in which case normally 'bar' won't
  #have the right permissions to write into the fs created by 'foo'.
  #
  # We solve that by 'chown -R bar.bar t/' in a portable way.
  #
  # at the end of the run we restore the perms to the original ones
Randy, can you please check that this handles the win32 case as well? I've no 
clue whether the concept of 'root' applies there.

  Revision  ChangesPath
  1.100 +46 -0 httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm
  
  Index: TestRun.pm
  ===
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- TestRun.pm	30 Jan 2003 23:59:40 -	1.99
  +++ TestRun.pm	31 Jan 2003 00:53:45 -	1.100
  @@ -20,6 +20,7 @@
   use subs qw(exit_shell exit_perl);
   
   my %core_files  = ();
  +my %original_t_perms = ();
   
   my @std_run  = qw(start-httpd run-tests stop-httpd);
   my @others   = qw(verbose configure clean help ssl http11);
  @@ -451,6 +452,8 @@
   }
   }
   
  +$self->adjust_t_perms();
  +
   if ($opts->{'start-httpd'}) {
   exit_perl 0 unless $server->start;
   }
  @@ -489,6 +492,8 @@
   sub stop {
   my $self = shift;
   
  +$self->restore_t_perms;
  +
   return $self->{server}->stop if $self->{opts}->{'stop-httpd'};
   }
   
  @@ -645,6 +650,47 @@
   # old core file at the end of the run and not complain then
   $core_files{$core} = -M $core;
   }, $vars->{top_dir});
  +}
  +
  +# this function handles the cases when the test suite is run under
  +# 'root':
  +#
  +# 1. When user 'bar' is chosen to run Apache with, files and dirs
  +#created by 'root' might be not writable/readable by 'bar'
  +#
  +# 2. when the source is extracted as user 'foo', and the chosen user
  +#to run Apache under is 'bar', in which case normally 'bar' won't
  +#have the right permissions to write into the fs created by 'foo'.
  +#
  +# We solve that by 'chown -R bar.bar t/' in a portable way.
  +sub adjust_t_perms {
  +my $self = shift;
  +%original_t_perms = (); # reset global
  +
  +my $user = getpwuid($>) || '';
  +if ($user eq 'root') {
  +my $vars = $self->{test_config}->{vars};
  +my $user = $vars->{user};
  +my($uid, $gid) = (getpwnam($user))[2..3]
  +or die "Can't find out uid/gid of '$user'";
  +warning "root mode: changing the fs ownership to '$user' ($uid:$gid)";
  +finddepth(sub {
  +$original_t_perms{$File::Find::name} = [(stat $_)[4..5]];
  +chown $uid, $gid, $_;
  +}, $vars->{t_dir});
  +}
  +}
  +
  +sub restore_t_perms {
  +my $self = shift;
  +
  +if (%original_t_perms) {
  +my $vars = $self->{test_config}->{vars};
  +while (my($file, $ids) = each %original_t_perms) {
  +next unless -e $file; # files could be deleted
  +chown @$ids, $file;
  +}
  +}
   }
   
   sub run_request {
  
  
  

--
__
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