Re: [patch] Re: Apache-Test breakage

2001-10-18 Thread Doug MacEachern
On Thu, 18 Oct 2001, Stas Bekman wrote:
 
> So it works when you run ./t/TEST, but when you run 'make test', for 
> some reason Makefile doesn't abort on exit from test_clean target, no 
> matter if I put exit -1, 0 or 1, and proceeds with run_tests target. 
> Does that have anything to do with the installed __DIE__ sighandler?

probably, since __DIE__ will stop the server.  where did you put the
exit(1) call?  i think it should work in the __DIE__ handler.
 
> I suggest to review the code and get rid of the __DIE__ sighandler all 
> together and instead wrap the relevant pieces of code in eval block. Are 
> there any exception handling modules bundled in the core?

if you can switch to eval {} that would be fine.
 
> In any case I think this patch can be committed without relation to the 
> __DIE__ issue.

looks good, +1




Re: Apache/2.0.27-dev and perl-framework and Darwin 1.4

2001-10-18 Thread Doug MacEachern
On Wed, 17 Oct 2001, Sander Temme wrote:

>  #0   0x0001e1a0 in load_module

aside from the -d suggestion, if darwin has an strace equiv, might help to
see what module is being loaded here.



Re: Apache-Test breakage

2001-10-18 Thread Doug MacEachern
On Thu, 18 Oct 2001, Stas Bekman wrote:
 
> this patch does that:

nice, +1

but, indentation is messed up:
 
>   my $argv = $self->{argv};
> +my @leftovers = ();

>   }
> +push @leftovers, $_;
 
>   $self->{tests} = [EMAIL PROTECTED];
> +$self->{argv}  = [EMAIL PROTECTED];
 
>   $self->split_test_args;
> +$self->die_on_invalid_args;



Re: [patch] hint why the test was skipped

2001-10-18 Thread Doug MacEachern
On Thu, 18 Oct 2001, Stas Bekman wrote:

> [Please let's decide where we discuss Apache-Test and send patches, the 
> docs say dev@perl.apache.org, but in fact it's spread across the two 
> lists. It seems that test-dev will eventually take over, since that's 
> where people report problems.]

here is fine i think.
 
> People already start complaining because they don't know why this or 
> that test gets skipped, but they are techy enough to look at the code to 
> figure out. Once we release Apache-Test, many people won't know to 
> figure out why some tests are skipped. Therefore I've tried to solve 
> this, so if I require have_module Chatbot::Eliza1 I get:

i like the idea of hinting why a test is skipped.  only thing is
"Missing foo" might not be very informative, for example the tests that
run against c-modules.  none of the c-modules will be "missing", but they
might not be built because:

- apxs is not available
- the module requires 2.0
- etc

"missing mod_echo_post" won't be very helpful in that case.

then there are tests that are skipped unless 'have_apache 2.0',
'have_perl "ithreads"', etc.

maybe just extend your patch so a .t can define:
$Apache::Test::SkipReason = 'requires apxs and apache-2.0';

and the skip code does this:
my $real_reason = $Apache::Test::SkipReason || $reason;
print "1..0 # skipped: $real_reason \n";

since each .t has its own process, there won't be a clash using the
$Apache::TestSkip::Reason variable.





Re: [patch] hint why the test was skipped

2001-10-18 Thread Stas Bekman
William A. Rowe, Jr. wrote:
From: "Stas Bekman" <[EMAIL PROTECTED]>
Sent: Wednesday, October 17, 2001 11:14 PM

William A. Rowe, Jr. wrote:

From: "Stas Bekman" <[EMAIL PROTECTED]>
Sent: Wednesday, October 17, 2001 10:40 PM

exec ./t/TEST protocol/eliza
protocol/elizaskipped: missing Chatbot::Eliza1
All tests successful, 1 test skipped.
The extension of Test::plan is already somewhat tricky, so in order to 
preserve the trick we have to make sure that our extension always 
returns a zero or one value. Since CODE and ARRAY refs were already 
taken I've used the available HASH ref. Now have module returns a reason 
for its failure, the CODE and ARRAY refs do or can do the same, here is 
how it works (this is incomplete, just to see if you like it):


Without groking the code, definately +1 to allow Foo::try syntax, since we
on non-unix platforms already have problems with Foo/try vs Foo\try ;)
Hmm, I guess you are talking about somethins else. What I try to do now 
is to print the reason for the skipped test.

That is, in and of itself, a great thing!
:)

Can you please expand on the problem you are talking about? And how do 
you want it to be handled?

Right now, we pass the argument to t/TEST somesuite/item.
If we adopted the Perl syntax of somesuite::item, the parsers wouldn't have
to deal with differences between somesuite/item.t and somesuite\item.t 
which would make documenting the 'invoking' feature much simpler for all
platforms.

Right now, we generally worry about the 'unixish' family, and OS2, Win32
and Netware all accept foo/bar even though their native tounge is foo\bar.
If we ever support far stranger platforms [and you seem ready with all of
the file::spec code in the tree ;-] then this will become more difficult.

Apache::Test is built on top of Test::Harness which is used by 'make 
test' of Perl itself on all platforms Perl is running on. And I think 
Perl is running on about the same platforms as Apache, if not more (I'm 
not sure). Therefore I think what's good for Test::Harness is good for 
Apache::Test. And if something is not working the fix should be done in 
Test::Harness.

The only nuance is that Apache::Test tests for the test file existance 
if you explicitly specify these, but since the path is preserved I don't 
think why there should be any problem at all. So if you call t/TEST with 
foo\\bar, Perl will test for -e foo\\bar, we just need to make sure to 
use File::Spec to correctly prepend the t/ prefix. but this is an easy 
fix. Is that the only problem with the test names?

Your suggestion to adopt foo::bar seems to be confusing, since many 
times I'm using file completion and do ./t/TEST t/foo/bar.t using the 
real path, with your proposal you cannot do this anymore, not talking 
about the fact that some tests are just grouped in the same dir, but 
have nothing to do with dir:: prefix. ... I don't know, I suggest to 
solve the problem if we have any and continue using the real paths. What 
do you think?


_
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: [patch] hint why the test was skipped

2001-10-18 Thread William A. Rowe, Jr.
From: "Stas Bekman" <[EMAIL PROTECTED]>
Sent: Wednesday, October 17, 2001 11:14 PM


> William A. Rowe, Jr. wrote:
> 
> > From: "Stas Bekman" <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 17, 2001 10:40 PM
> > 
> >>  exec ./t/TEST protocol/eliza
> >>protocol/elizaskipped: missing Chatbot::Eliza1
> >>All tests successful, 1 test skipped.
> >>
> >>The extension of Test::plan is already somewhat tricky, so in order to 
> >>preserve the trick we have to make sure that our extension always 
> >>returns a zero or one value. Since CODE and ARRAY refs were already 
> >>taken I've used the available HASH ref. Now have module returns a reason 
> >>for its failure, the CODE and ARRAY refs do or can do the same, here is 
> >>how it works (this is incomplete, just to see if you like it):
> >>
> > 
> > Without groking the code, definately +1 to allow Foo::try syntax, since we
> > on non-unix platforms already have problems with Foo/try vs Foo\try ;)
> 
> Hmm, I guess you are talking about somethins else. What I try to do now 
> is to print the reason for the skipped test.

That is, in and of itself, a great thing!

> Can you please expand on the problem you are talking about? And how do 
> you want it to be handled?

Right now, we pass the argument to t/TEST somesuite/item.

If we adopted the Perl syntax of somesuite::item, the parsers wouldn't have
to deal with differences between somesuite/item.t and somesuite\item.t 
which would make documenting the 'invoking' feature much simpler for all
platforms.

Right now, we generally worry about the 'unixish' family, and OS2, Win32
and Netware all accept foo/bar even though their native tounge is foo\bar.

If we ever support far stranger platforms [and you seem ready with all of
the file::spec code in the tree ;-] then this will become more difficult.



[patch] Re: Apache-Test breakage

2001-10-18 Thread Stas Bekman
Doug MacEachern wrote:

I think the break in the middle of config is important to fix, right?
yes.  the problem right now is if die() is thrown, files have been
generated but the Apache::TestConfig object is not committed to
t/conf/apache_test_config.pm.  so t/TEST -clean does not know about those
generated files.  either a DESTROY or __DIE__ handler could probably be
used to solve the problem.
__DIE__ is a mess to use and DESTROY cannot be easily used unless 
Apache::TestConfig is subclassed. I think the following is quite clean 
solution. I've tested it with breaking the configure by requiring all 
.pm files (if you remember the breakage I had while developing 
APACHE_TEST_CONFIGURE functionality)

So it works when you run ./t/TEST, but when you run 'make test', for 
some reason Makefile doesn't abort on exit from test_clean target, no 
matter if I put exit -1, 0 or 1, and proceeds with run_tests target. 
Does that have anything to do with the installed __DIE__ sighandler?

I suggest to review the code and get rid of the __DIE__ sighandler all 
together and instead wrap the relevant pieces of code in eval block. Are 
there any exception handling modules bundled in the core?

In any case I think this patch can be committed without relation to the 
__DIE__ issue.

-- 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.59
diff -u -r1.59 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	2001/10/17 02:56:24	1.59
+++ Apache-Test/lib/Apache/TestRun.pm	2001/10/18 05:14:11
@@ -483,7 +483,16 @@
 $self->opt_clean(1);
 }

-$self->configure;
+# if configure() fails for some reason before it has flushed the
+# config to a file, save it so -clean will be able to clean
+eval { $self->configure; };
+if ($@) {
+error "configure() has failed:\n$@";
+warning "forcing Apache::TestConfig object save";
+$self->{test_config}->save;
+warning "run 't/TEST -clean' to clean up before continuing";
+exit;
+}
 if ($self->{opts}->{configure}) {
 warning "reconfiguration done";

_
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: Apache/2.0.27-dev and perl-framework and Darwin 1.4

2001-10-18 Thread Stas Bekman
Sander Temme wrote:
The following invocations:
% perl Makefile.PL httpd /tmp/apache2/bin/httpd apxs /tmp/apache2/bin/apxs
% t/TEST
Give me the following crash dump of httpd:
Date/Time:  2001-10-17 20:52:32 -0700
OS Version: 10.1 (Build 5G64)
Command:httpd
PID:15743
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_PROTECTION_FAILURE (0x0002) at 0x0004567c
Thread 0:
 #0   0x0001e1a0 in load_module
 #1   0x00030590 in invoke_cmd
 #2   0x00031758 in execute_now
 #3   0x00030e50 in ap_build_config_sub
 #4   0x0003135c in ap_build_config
 #5   0x00031bfc in ap_process_resource_config
 #6   0x00032354 in ap_read_config
 #7   0x000207a4 in main
 #8   0x24ac in _start
 #9   0x22dc in start
PPC Thread State:
  srr0: 0x0001e1a0 srr1: 0xf030vrsave: 0x
   xer: 0x0020   lr: 0x0001e144  ctr: 0x41112bbc   mq: 0x
r0: 0x41503230   r1: 0xbfffd360   r2: 0x001edbc0   r3: 0x
r4: 0x   r5: 0x   r6: 0x0005   r7: 0x0038f268
r8: 0x0038f2ec   r9: 0x00236278  r10: 0x0038f2d4  r11: 0x0078
   r12: 0x4114b230  r13: 0x  r14: 0x0036  r15: 0x0004a010
   r16: 0xbfffee70  r17: 0x  r18: 0x0014  r19: 0x4007
   r20: 0x  r21: 0x001c  r22: 0x70004bc4  r23: 0x70004c58
   r24: 0x0001  r25: 0x0004b060  r26: 0x  r27: 0x003b2b60
   r28: 0x  r29: 0xbfffef00  r30: 0x  r31: 0x0001
**
On the following system:
[monalisa:~] sctemme% uname -a
Darwin MonaLisa 1.4 Darwin Kernel Version 1.4: Sun Sep  9 15:39:59 PDT 2001;
root:xnu/xnu-201.obj~1/RELEASE_PPC  Power Macintosh powerpc
And with Apache thusly configured:
# ./configure  --prefix=/tmp/apache2 --enable-so
Where should I look to debug this? By itself, the server starts and has been
seen to serve pages. Oh,

Try running in debug mode:
=head2 'make test' Debug
mod_perl-2.0 provides built in 'make test' debug facility. So in case
you get a core dump during make test, or just for fun, run in one shell:
  % ./t/TEST -debug
in another shell:
  % ./t/TEST -run
then the I<-debug> shell will have a (gdb) prompt, type 'where' for
stacktrace.
You can change the default debugger by supplying the name of the
debugger as an argument to I<-debug>. E.g. to run the server under
C:
  % ./t/TEST -debug=ddd
the whole docs is here (or get it from modperl-2.0 rep):
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/pod/modperl_dev.pod?rev=1.41&content-type=text/vnd.viewcvs-markup
[monalisa:~/projects/httpd-test/perl-framework] sctemme% echo \
$DYLD_LIBRARY_PATH 
/tmp/apache2/lib

...or Apache will not start for lack of apr and apr-util.
The perl-framework works fine with Apache 1.3 on the same system.
Any pointers?

--
_
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: [patch] hint why the test was skipped

2001-10-18 Thread Stas Bekman
William A. Rowe, Jr. wrote:
From: "Stas Bekman" <[EMAIL PROTECTED]>
Sent: Wednesday, October 17, 2001 10:40 PM

 exec ./t/TEST protocol/eliza
protocol/elizaskipped: missing Chatbot::Eliza1
All tests successful, 1 test skipped.
The extension of Test::plan is already somewhat tricky, so in order to 
preserve the trick we have to make sure that our extension always 
returns a zero or one value. Since CODE and ARRAY refs were already 
taken I've used the available HASH ref. Now have module returns a reason 
for its failure, the CODE and ARRAY refs do or can do the same, here is 
how it works (this is incomplete, just to see if you like it):

Without groking the code, definately +1 to allow Foo::try syntax, since we
on non-unix platforms already have problems with Foo/try vs Foo\try ;)
Hmm, I guess you are talking about somethins else. What I try to do now 
is to print the reason for the skipped test.

Can you please expand on the problem you are talking about? And how do 
you want it to be handled?

_
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/


Apache/2.0.27-dev and perl-framework and Darwin 1.4

2001-10-18 Thread Sander Temme
The following invocations:

% perl Makefile.PL httpd /tmp/apache2/bin/httpd apxs /tmp/apache2/bin/apxs
% t/TEST

Give me the following crash dump of httpd:

Date/Time:  2001-10-17 20:52:32 -0700
OS Version: 10.1 (Build 5G64)

Command:httpd
PID:15743

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_PROTECTION_FAILURE (0x0002) at 0x0004567c

Thread 0:
 #0   0x0001e1a0 in load_module
 #1   0x00030590 in invoke_cmd
 #2   0x00031758 in execute_now
 #3   0x00030e50 in ap_build_config_sub
 #4   0x0003135c in ap_build_config
 #5   0x00031bfc in ap_process_resource_config
 #6   0x00032354 in ap_read_config
 #7   0x000207a4 in main
 #8   0x24ac in _start
 #9   0x22dc in start


PPC Thread State:
  srr0: 0x0001e1a0 srr1: 0xf030vrsave: 0x
   xer: 0x0020   lr: 0x0001e144  ctr: 0x41112bbc   mq: 0x
r0: 0x41503230   r1: 0xbfffd360   r2: 0x001edbc0   r3: 0x
r4: 0x   r5: 0x   r6: 0x0005   r7: 0x0038f268
r8: 0x0038f2ec   r9: 0x00236278  r10: 0x0038f2d4  r11: 0x0078
   r12: 0x4114b230  r13: 0x  r14: 0x0036  r15: 0x0004a010
   r16: 0xbfffee70  r17: 0x  r18: 0x0014  r19: 0x4007
   r20: 0x  r21: 0x001c  r22: 0x70004bc4  r23: 0x70004c58
   r24: 0x0001  r25: 0x0004b060  r26: 0x  r27: 0x003b2b60
   r28: 0x  r29: 0xbfffef00  r30: 0x  r31: 0x0001

**

On the following system:

[monalisa:~] sctemme% uname -a
Darwin MonaLisa 1.4 Darwin Kernel Version 1.4: Sun Sep  9 15:39:59 PDT 2001;
root:xnu/xnu-201.obj~1/RELEASE_PPC  Power Macintosh powerpc

And with Apache thusly configured:

# ./configure  --prefix=/tmp/apache2 --enable-so

Where should I look to debug this? By itself, the server starts and has been
seen to serve pages. Oh,

[monalisa:~/projects/httpd-test/perl-framework] sctemme% echo \
$DYLD_LIBRARY_PATH 
/tmp/apache2/lib

...or Apache will not start for lack of apr and apr-util.

The perl-framework works fine with Apache 1.3 on the same system.

Any pointers?

Most gratefully,

S.

-- 
Covalent Technologies [EMAIL PROTECTED]
Engineering groupVoice: (415) 536 5214
645 Howard St. Fax: (415) 536 5210
San Francisco CA 94105

   PGP Fingerprint: 1E74 4E58 DFAC 2CF5 6A03  5531 AFB1 96AF B584 0AB1

===
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message
===



Re: [patch] hint why the test was skipped

2001-10-18 Thread William A. Rowe, Jr.
From: "Stas Bekman" <[EMAIL PROTECTED]>
Sent: Wednesday, October 17, 2001 10:40 PM


>   exec ./t/TEST protocol/eliza
> protocol/elizaskipped: missing Chatbot::Eliza1
> All tests successful, 1 test skipped.
> 
> The extension of Test::plan is already somewhat tricky, so in order to 
> preserve the trick we have to make sure that our extension always 
> returns a zero or one value. Since CODE and ARRAY refs were already 
> taken I've used the available HASH ref. Now have module returns a reason 
> for its failure, the CODE and ARRAY refs do or can do the same, here is 
> how it works (this is incomplete, just to see if you like it):

Without groking the code, definately +1 to allow Foo::try syntax, since we
on non-unix platforms already have problems with Foo/try vs Foo\try ;)

Bill



Re: Apache-Test breakage

2001-10-18 Thread Stas Bekman
Doug MacEachern wrote:
On Thu, 18 Oct 2001, Stas Bekman wrote:
 

is there anything else we need to do with opts parsing at this stage?
now that we know all args and which are meant as test files, anything else
should throw an error.  for example what ken saw:
% t/TEST t/notexist
currently ignores t/notexist and runs all tests instead.

this patch does that:
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.60
diff -u -r1.60 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	2001/10/18 02:44:36	1.60
+++ Apache-Test/lib/Apache/TestRun.pm	2001/10/18 03:43:04
@@ -88,6 +88,7 @@
 my(@tests);

 my $argv = $self->{argv};
+my @leftovers = ();
 for (@$argv) {
 my $arg = $_;
 #need the t/ for stat-ing, but dont want to include it in test 
output
@@ -117,11 +118,25 @@
 next;
 }
 }
+push @leftovers, $_;
 }

 $self->{tests} = [EMAIL PROTECTED];
+$self->{argv}  = [EMAIL PROTECTED];
 }
+sub die_on_invalid_args {
+my($self) = @_;
+
+# at this stage $self->{argv} should be empty
+my @invalid_argv = @{ $self->{argv} };
+if (@invalid_argv) {
+error "unknown opts or test names: @invalid_argv";
+exit;
+}
+
+}
+
 sub passenv {
 my $passenv = Apache::TestConfig->passenv;
 for (keys %$passenv) {
@@ -517,6 +532,8 @@
 $self->default_run_opts;
 $self->split_test_args;
+
+$self->die_on_invalid_args;
 $self->start;

_
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/


[patch] hint why the test was skipped

2001-10-18 Thread Stas Bekman
[Please let's decide where we discuss Apache-Test and send patches, the 
docs say dev@perl.apache.org, but in fact it's spread across the two 
lists. It seems that test-dev will eventually take over, since that's 
where people report problems.]

People already start complaining because they don't know why this or 
that test gets skipped, but they are techy enough to look at the code to 
figure out. Once we release Apache-Test, many people won't know to 
figure out why some tests are skipped. Therefore I've tried to solve 
this, so if I require have_module Chatbot::Eliza1 I get:

 exec ./t/TEST protocol/eliza
protocol/elizaskipped: missing Chatbot::Eliza1
All tests successful, 1 test skipped.
The extension of Test::plan is already somewhat tricky, so in order to 
preserve the trick we have to make sure that our extension always 
returns a zero or one value. Since CODE and ARRAY refs were already 
taken I've used the available HASH ref. Now have module returns a reason 
for its failure, the CODE and ARRAY refs do or can do the same, here is 
how it works (this is incomplete, just to see if you like it):

Index: Apache-Test/lib/Apache/Test.pm
===
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm,v
retrieving revision 1.26
diff -u -r1.26 Test.pm
--- Apache-Test/lib/Apache/Test.pm	2001/10/16 20:30:57	1.26
+++ Apache-Test/lib/Apache/Test.pm	2001/10/18 03:31:12
@@ -81,6 +81,7 @@
 my $condition = pop @_;
 my $ref = ref $condition;
 my $meets_condition = 0;
+my $reason = '';
 if ($ref) {
 if ($ref eq 'CODE') {
 #plan tests $n, \&has_lwp
@@ -88,16 +89,17 @@
 }
 elsif ($ref eq 'ARRAY') {
 #plan tests $n, [qw(php4 rewrite)];
-$meets_condition = have_module($condition);
+($meets_condition, $reason) = %{ have_module($condition) }
 }
-}
-else {
-# we have the verdict already: true/false
-$meets_condition = $condition ? 1 : 0;
+elsif ($ref eq 'HASH')  {
+# we have the verdict already: true/false
+($meets_condition, $reason) = %$condition;
+$meets_condition = $meets_condition ? 1 : 0;
+}
 }

 unless ($meets_condition) {
-print "1..0\n";
+print "1..0 # skipped: $reason \n";
 exit; #XXX: Apache->exit
 }
 }
@@ -119,10 +121,10 @@
 die "bogus module name $_" unless /^[\w:.]+$/;
 eval "require $_";
 #print $@ if $@;
-return 0 if $@;
+return {0 => "missing $_"} if $@;
 }
-return 1;
+return {1 => undef};
 }
 sub have_cgi {
_
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: Apache-Test breakage

2001-10-18 Thread Doug MacEachern
On Thu, 18 Oct 2001, Stas Bekman wrote:
 
> is there anything else we need to do with opts parsing at this stage?

now that we know all args and which are meant as test files, anything else
should throw an error.  for example what ken saw:

% t/TEST t/notexist

currently ignores t/notexist and runs all tests instead.

> I think the break in the middle of config is important to fix, right?

yes.  the problem right now is if die() is thrown, files have been
generated but the Apache::TestConfig object is not committed to
t/conf/apache_test_config.pm.  so t/TEST -clean does not know about those
generated files.  either a DESTROY or __DIE__ handler could probably be
used to solve the problem.




Re: Apache-Test breakage

2001-10-18 Thread Stas Bekman
Doug MacEachern wrote:
On Thu, 18 Oct 2001, Stas Bekman wrote:
 

no prob, let's finish with --? and then I'll try to fix this one too.
actually, it is working with your new patch.
fantastic!

ok, got it, here is a new patch which doesn't use the original @ARGV at
all:
looks good, all problems are fixed now, +1 and thanks!

:)
is there anything else we need to do with opts parsing at this stage?
I think the break in the middle of config is important to fix, right?
_
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: Apache-Test breakage

2001-10-18 Thread Doug MacEachern
On Thu, 18 Oct 2001, Stas Bekman wrote:
 
> no prob, let's finish with --? and then I'll try to fix this one too.

actually, it is working with your new patch.
 
> ok, got it, here is a new patch which doesn't use the original @ARGV at
> all:

looks good, all problems are fixed now, +1 and thanks!




Re: Apache-Test breakage

2001-10-18 Thread Stas Bekman
On Wed, 17 Oct 2001, Doug MacEachern wrote:

> On Wed, 17 Oct 2001, Stas Bekman wrote:
>
> >>t/TEST -proxy t/foo/bar.t
> >>
> ...
> > I see exactly the same behavior with my patch and without, so I guess it
> > was broken before.
>
> yup, i already told you the same in private email.  but see the commit
> message:
>
>is not proxying requests:
>t/TEST -proxy
>
> i've not tried your new patch, but yesterday -proxy was not working as it
> was without the patch.

no prob, let's finish with --? and then I'll try to fix this one too.

> and you missed the part of the commit message that complains about this:
> > -for (@$argv) {
> > +for (@ARGV) {
>
> should use @ARGV as little as possible, if Getopts or whatever needs it,
> that's what this was for:
> > -local *ARGV = $self->{args};
>
> reason is that this:
> Apache::TestRun->new->run(@ARGV);
>
> where @ARGV is the args from t/TEST should be able to be called elsewhere
> like so:
>
> for (qw(prefork worker)) {
> Apache::TestRun->new->run(-httpd => "$apache2/$_/bin/httpd");
> }

ok, got it, here is a new patch which doesn't use the original @ARGV at
all:

Index: Apache-Test/README
===
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/README,v
retrieving revision 1.13
diff -u -r1.13 README
--- Apache-Test/README  2001/10/17 01:30:40 1.13
+++ Apache-Test/README  2001/10/18 01:34:51
@@ -7,6 +7,9 @@

 see t/TEST as an example test harness

+For an extensive documentation see
+modperl-2.0/docs/src/devel/writing_tests/writing_tests.pod.
+
 see t/*.t for example tests

 if the file t/conf/httpd.conf.in exists, it will be used instead of
@@ -45,16 +48,16 @@
 % t/TEST -configure

 run as user nobody:
-% t/TEST User nobody
+% t/TEST -User nobody

 run on a different port:
-% t/TEST Port 8799
+% t/TEST -Port 8799

 configure an httpd other than the default (that apxs figures out)
-% t/TEST httpd ~/ap/httpd-2.0/httpd
+% t/TEST -httpd ~/ap/httpd-2.0/httpd

 switch to another apxs
-% t/TEST apxs ~/ap/httpd-2.0-prefork/bin/apxs
+% t/TEST -apxs ~/ap/httpd-2.0-prefork/bin/apxs

 turn on tracing
 % t/TEST -preamble "PerlTrace all"
@@ -69,19 +72,19 @@
 % t/TEST -head

 GET url with authentication credentials
-% t/TEST -get /server-info username dougm password foo
+% t/TEST -get /server-info -username dougm -password foo

 POST url (read content from string)
-% t/TEST -post /TestApache::post content 'name=dougm&company=covalent'
+% t/TEST -post /TestApache::post -content 'name=dougm&company=covalent'

 POST url (read content from stdin)
-% t/TEST -post /TestApache::post content - < foo.txt
+% t/TEST -post /TestApache::post -content - < foo.txt

 POST url (generate a body of data 1024 bytes in length)
-% t/TEST -post /TestApache::post content x1024
+% t/TEST -post /TestApache::post -content x1024

 POST url (only print headers, e.g. useful to just check Content-length)
-% t/TEST -post -head /TestApache::post content x10
+% t/TEST -post -head /TestApache::post -content x10

 GET url (only print headers, e.g. useful to just check Content-length)
 % t/TEST -get -head /foo
Index: Apache-Test/lib/Apache/TestConfig.pm
===
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.76
diff -u -r1.76 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm2001/10/17 20:06:25 1.76
+++ Apache-Test/lib/Apache/TestConfig.pm2001/10/18 01:34:51
@@ -68,8 +68,9 @@
 }

 while (my($key, $val) = splice @filter, 0, 2) {
-if ($wanted_args->{$key}) {
-$keep{$key} = $val;
+if ($key =~ /^-?-?(.+)/ # optinal - or -- prefix
+&& exists $wanted_args->{$1}) {
+$keep{$1} = $val;
 }
 else {
 push @pass, $key, $val;
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.59
diff -u -r1.59 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm   2001/10/17 02:56:24 1.59
+++ Apache-Test/lib/Apache/TestRun.pm   2001/10/18 01:34:52
@@ -82,11 +82,12 @@
 #so we dont slurp arguments that are not tests, example:
 # httpd $HOME/apache-2.0/bin/httpd

-sub split_args {
-my($self, $argv) = @_;
+sub split_test_args {
+my($self) = @_;

-my(@tests, @args);
+my(@tests);

+my $argv = $self->{argv};
 for (@$argv) {
 my $arg = $_;
 #need the t/ for stat-ing, but dont want to include it in test output
@@ -116,12 +117,9 @@
 next;
 }
 }
-
-push @args, $_;
 }

 $self->{tests} = [EMAIL PROTECTED];
-$self->{args}  = [EMAIL PROTECTED];
 }

 sub passenv {
@@ -134,13 +132,15 @@

 sub getopts {
 my($self, $argv) = @_;
-
-$self->split_args($argv);

-#dont count test