Re: TAP - Test::More - fork

2011-11-15 Thread Michael G Schwern
On 2011.11.15 1:01 AM, Buddy Burden wrote:
> I did not know this ... just to be super-clear, obviously I know that
> if I have script.pl and it starts with
> 
> #! /usr/bin/perl -w
> 
> and I make it executable and run it directly, I get perl -w.  But
> you're saying that even if I type:
> 
> perl script.pl
> 
> I _still_ get perl -w?  That, I was not aware of.

Yep.

Now, want to have your mind blown?

$ cat ~/tmp/test
#!/usr/bin/python

def hello():
  print "Hello world!"
  return

hello();

$ python ~/tmp/test
Hello world!

$ perl ~/tmp/test
Hello world!


>> Adding -w to the #! line on your tests is a very good idea to avoid the
>> gotcha of differences between a test being run with `prove` (does not set
>> -w), ...
> 
> Well, yes, prove doesn't _normally_ set -w, but if you run prove -w,
> it does, doesn't it?

Yes.

If you don't set it in #! you, or somebody else, will forget to pass -w to
prove and then you'll spent a bunch of time scratching your head wondering why
the test is running differently from in "make test".


-- 
Just call me 'Moron Sugar'.
http://www.somethingpositive.net/sp05182002.shtml


Re: TAP - Test::More - fork

2011-11-15 Thread Buddy Burden
Schwern,

On Thu, Nov 10, 2011 at 5:57 PM, Michael G Schwern  wrote:
> On 2011.11.10 4:59 PM, Buddy Burden wrote:
>> Does that do anything?  I didn't think prove respected the shebang
>> line.  Anyway, I thought the -w to prove would be effectively doing
>> that all along.
>
> Perl respects the *options* on the #! line, prove only adds to them.

I did not know this ... just to be super-clear, obviously I know that
if I have script.pl and it starts with

#! /usr/bin/perl -w

and I make it executable and run it directly, I get perl -w.  But
you're saying that even if I type:

perl script.pl

I _still_ get perl -w?  That, I was not aware of.

> Adding -w to the #! line on your tests is a very good idea to avoid the
> gotcha of differences between a test being run with `prove` (does not set
> -w), ...

Well, yes, prove doesn't _normally_ set -w, but if you run prove -w,
it does, doesn't it?


            -- Buddy


Re: TAP - Test::More - fork

2011-11-11 Thread Michael G Schwern

On 2011.11.10 7:44 PM, chromatic wrote:

On Thursday, November 10, 2011 at 05:57 PM, Michael G wrote:

If you don't want global warnings, explicitly turn them off with BEGIN { $^W
= 0 }.


I thought the argument that test modules should set global policy unilaterally
died out when I made Test::MockObject *not* enable UNIVERSAL::isa and
UNIVERSAL::can by default.


That argument happened well after Test::Harness was written to set -w.  If 
nothing else, it's a major compatibility issue.




It's the 21st century. Why can't Test::Harness find a nice middle ground and
respect the lexical encapsulation of warnings introduced in 2000? (I think it
just might catch on.)


We're discussing how to deal with the reality and smooth over the existing 
differences between the various ways to run a test.


If you want to crack open the -w in testing discussion, start another thread 
and lay out your argument.



--
Whip me, beat me, make my code compatible with VMS!


Re: TAP - Test::More - fork

2011-11-10 Thread chromatic
On Thursday, November 10, 2011 at 05:57 PM, Michael G wrote:

> If you don't want global warnings, explicitly turn them off with BEGIN { $^W 
= 
> 0 }.

I thought the argument that test modules should set global policy unilaterally 
died out when I made Test::MockObject *not* enable UNIVERSAL::isa and 
UNIVERSAL::can by default.

It's the 21st century. Why can't Test::Harness find a nice middle ground and 
respect the lexical encapsulation of warnings introduced in 2000? (I think it 
just might catch on.)

-- c


Re: TAP - Test::More - fork

2011-11-10 Thread Michael G Schwern

On 2011.11.10 4:59 PM, Buddy Burden wrote:

chromatic/Merjin,


Not "use warnings" but the -w command line flag -- the non-lexical, warnings-
on-everywhere one.



no change whatsoever. I've now added -w to all #! lines in the t files


Does that do anything?  I didn't think prove respected the shebang
line.  Anyway, I thought the -w to prove would be effectively doing
that all along.


Perl respects the *options* on the #! line, prove only adds to them.

Adding -w to the #! line on your tests is a very good idea to avoid the gotcha 
of differences between a test being run with `prove` (does not set -w), `make 
test` (sets -w), and running it as a normal Perl program (does not set -w).


If you don't want global warnings, explicitly turn them off with BEGIN { $^W = 
0 }.


Re: TAP - Test::More - fork

2011-11-10 Thread Buddy Burden
chromatic/Merjin,

>> Not "use warnings" but the -w command line flag -- the non-lexical, warnings-
>> on-everywhere one.

> no change whatsoever. I've now added -w to all #! lines in the t files

Does that do anything?  I didn't think prove respected the shebang
line.  Anyway, I thought the -w to prove would be effectively doing
that all along.


            -- Buddy


Differences between "make test" and "prove" (was Re: TAP - Test::More - fork)

2011-11-10 Thread Michael G Schwern

On 2011.11.10 7:15 AM, H.Merijn Brand wrote:

Yes, there indeed is a core

(gdb) where
#0  0xc0258c70:0 in free+0x1d0 () from /usr/lib/hpux64/libc.so.1
#1  0x4017f7e0:0 in Perl_safesysfree () at util.c:262
#2  0x400d0ab0:0 in perl_destruct () at perl.c:871
#3  0x4009a740:0 in main () at perlmain.c:119

I however do not understand why prove seems to be safe, but make test
is not


First, try to replicate everything "make test" is doing with prove.

For starters, even though test processes are supposed to remain separate, 
other tests could be interfering and the segfault only happens when you run 
the whole test suite.  So run the whole test suite.


prove -wbr t

I see you're firing off child processes, if you're doing the same in the 
previous test it could be that they're not finished from the previous test 
starts.  It could be that your database is in a bad state.


The second major difference is "make test" sets the PERL_DL_NONLAZY flag which 
is helpful for XS testing, so add that into the mix.


PERL_DL_NONLAZY=1 prove -wbr t

If that doesn't work, go the other way.  Strip out everything you can, 
including prove, and start adding things in.  When you want verbose test 
output, don't use prove -v, just run the program.


perl -w -Mblib t/21-uni-regex.t

If that doesn't replicate, try adding in subtle things which are different 
between 'make test', 'prove' and running manually.


Try having STDOUT go to a pipe instead of a TTY.

perl -w -Mblib t/21-uni-regex.t | cat

Try the same for input.

echo | perl -w -Mblib t/21-uni-regex.t

Try both.

echo | perl -w -Mblib t/21-uni-regex.t | cat

Or it could be that prove is setting environment variables which Test::Harness 
is not, check them.  They could be affecting your shell command.



--
124. Two drink limit does not mean first and last.
-- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
   http://skippyslist.com/list/


Re: TAP - Test::More - fork

2011-11-10 Thread H.Merijn Brand
On Thu, 10 Nov 2011 08:23:07 -0800, chromatic  wrote:

> On Thursday, November 10, 2011 at 08:14 AM, H Brand wrote:
> 
> > no change whatsoever. I've now added -w to all #! lines in the t files
> 
> That's good, that Test::Harness "helpfully" adding magic global hidden 
> command 
> line options to all invocations isn't the problem here. It's bad that the 
> problem is still unknown. Do you have any HARNESS_OPTIONS or other relevant 
> environment variables set? (HARNESS_OPTIONS probably isn't the culprit, as 
> prove respects that too.)

No, no HARNESS_OPTIONS set

-- 
H.Merijn Brand  http://tux.nl  Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/   http://www.test-smoke.org/
http://qa.perl.org  http://www.goldmark.org/jeff/stupid-disclaimers/


Re: TAP - Test::More - fork

2011-11-10 Thread chromatic
On Thursday, November 10, 2011 at 08:14 AM, H Brand wrote:

> no change whatsoever. I've now added -w to all #! lines in the t files

That's good, that Test::Harness "helpfully" adding magic global hidden command 
line options to all invocations isn't the problem here. It's bad that the 
problem is still unknown. Do you have any HARNESS_OPTIONS or other relevant 
environment variables set? (HARNESS_OPTIONS probably isn't the culprit, as 
prove respects that too.)

-- c


Re: TAP - Test::More - fork

2011-11-10 Thread H.Merijn Brand
On Thu, 10 Nov 2011 08:11:14 -0800, chromatic  wrote:

> On Thursday, November 10, 2011 at 08:07 AM, H Brand wrote:
> 
> > All my test files (in this project) have "use warnings;" (and of
> > course "use strict;")
> 
> Not "use warnings" but the -w command line flag -- the non-lexical, warnings-
> on-everywhere one.
> 
> -- c

no change whatsoever. I've now added -w to all #! lines in the t files

$ prove -wvb t/21-uni-regex.t
t/21-uni-regex.t ..
ok 1 - connect with attributes
ok 2 - prepare equal
ok 3 - execute equal
ok 4 - fetch equal
ok 5 - finish equal
ok 6 - prepare like
ok 7 - execute like
ok 8 - fetch like
ok 9 - finish like
ok 10 - prepare reglike
ok 11 - execute reglike
ok 12 - fetch reglike
ok 13 - finish reglike
ok 14 - prepare shlike
ok 15 - execute shlike
ok 16 - fetch shlike
ok 17 - finish shlike
ok 18 - disconnect
1..18
ok
All tests successful.
Files=1, Tests=18,  0 wallclock secs ( 0.07 usr  0.01 sys +  0.14 cusr  0.06 
csys =  0.28 CPU)
Result: PASS

and I still get a core dump in make test

-- 
H.Merijn Brand  http://tux.nl  Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/   http://www.test-smoke.org/
http://qa.perl.org  http://www.goldmark.org/jeff/stupid-disclaimers/


Re: TAP - Test::More - fork

2011-11-10 Thread chromatic
On Thursday, November 10, 2011 at 08:07 AM, H Brand wrote:

> All my test files (in this project) have "use warnings;" (and of
> course "use strict;")

Not "use warnings" but the -w command line flag -- the non-lexical, warnings-
on-everywhere one.

-- c


Re: TAP - Test::More - fork

2011-11-10 Thread H.Merijn Brand
On Thu, 10 Nov 2011 15:10:10 +0100, Leon Timmermans 
wrote:

> On Thu, Nov 10, 2011 at 2:44 PM, H.Merijn Brand  wrote:
> > Test Summary Report
> > ---
> > t/20-uni-basic.t   (Wstat: 139 Tests: 366 Failed: 0)
> >  Non-zero wait status: 139
> > t/21-uni-regex.t   (Wstat: 139 Tests: 18 Failed: 0)
> >  Non-zero wait status: 139
> > Files=19, Tests=3658, 35 wallclock secs ( 1.04 usr  0.15 sys + 19.64 cusr  
> > 4.01 csys = 24.84 CPU)
> > Result: FAIL
> > Failed 2/19 test programs. 0/3658 subtests failed.
> >
> > Everything passes and still the final result is FAIL
> 
> «Non-zero wait status: 139» is the important bit here. 139 = 11 + 128
> = Segfault + coredump. Unlikely to be a Test::More issue (though
> Test::Harness could be clearer on what's going on).

Another issue :(

I get the core dumps on Itanium 2/64

HP-UX 11.23/64 U  rx1620/64 Itanium 2/1600(2) ia642037 Mb
This is perl, v5.10.1 (*) built for IA64.ARCHREV_0-LP64

The same set on PA-RISC2/32 does not get core dumps

HP-UX 11.00/64 U  A500-7X/64 PA8700/750(2)pa-2.0  2048 Mb
This is perl, v5.10.1 (*) built for PA-RISC2.0

both perls are up-to-date module-wise

-- 
H.Merijn Brand  http://tux.nl  Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/   http://www.test-smoke.org/
http://qa.perl.org  http://www.goldmark.org/jeff/stupid-disclaimers/


Re: TAP - Test::More - fork

2011-11-10 Thread H.Merijn Brand
On Thu, 10 Nov 2011 07:56:44 -0800, chromatic  wrote:

> On Thursday, November 10, 2011 at 07:15 AM, H Brand wrote:
> 
> > I however do not understand why prove seems to be safe, but make test
> > is not
> 
> Do your test files use -w? If not, what happens if you add it and run them 
> with 
> prove?

All my test files (in this project) have "use warnings;" (and of
course "use strict;")

> This *should* make no difference, but I have a suspicion.
> 
> -- c


-- 
H.Merijn Brand  http://tux.nl  Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/   http://www.test-smoke.org/
http://qa.perl.org  http://www.goldmark.org/jeff/stupid-disclaimers/


Re: TAP - Test::More - fork

2011-11-10 Thread chromatic
On Thursday, November 10, 2011 at 07:15 AM, H Brand wrote:

> I however do not understand why prove seems to be safe, but make test
> is not

Do your test files use -w? If not, what happens if you add it and run them with 
prove?

This *should* make no difference, but I have a suspicion.

-- c


Re: TAP - Test::More - fork

2011-11-10 Thread H.Merijn Brand
On Thu, 10 Nov 2011 15:10:10 +0100, Leon Timmermans 
wrote:

> On Thu, Nov 10, 2011 at 2:44 PM, H.Merijn Brand  wrote:
> > Test Summary Report
> > ---
> > t/20-uni-basic.t   (Wstat: 139 Tests: 366 Failed: 0)
> >  Non-zero wait status: 139
> > t/21-uni-regex.t   (Wstat: 139 Tests: 18 Failed: 0)
> >  Non-zero wait status: 139
> > Files=19, Tests=3658, 35 wallclock secs ( 1.04 usr  0.15 sys + 19.64 cusr  
> > 4.01 csys = 24.84 CPU)
> > Result: FAIL
> > Failed 2/19 test programs. 0/3658 subtests failed.
> >
> > Everything passes and still the final result is FAIL
> 
> «Non-zero wait status: 139» is the important bit here. 139 = 11 + 128
> = Segfault + coredump. Unlikely to be a Test::More issue (though
> Test::Harness could be clearer on what's going on).

Yes, there indeed is a core

(gdb) where
#0  0xc0258c70:0 in free+0x1d0 () from /usr/lib/hpux64/libc.so.1
#1  0x4017f7e0:0 in Perl_safesysfree () at util.c:262
#2  0x400d0ab0:0 in perl_destruct () at perl.c:871
#3  0x4009a740:0 in main () at perlmain.c:119

I however do not understand why prove seems to be safe, but make test
is not

-- 
H.Merijn Brand  http://tux.nl  Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/   http://www.test-smoke.org/
http://qa.perl.org  http://www.goldmark.org/jeff/stupid-disclaimers/


Re: TAP - Test::More - fork

2011-11-10 Thread H.Merijn Brand
On Thu, 10 Nov 2011 15:10:10 +0100, Leon Timmermans 
wrote:

> On Thu, Nov 10, 2011 at 2:44 PM, H.Merijn Brand  wrote:
> > Test Summary Report
> > ---
> > t/20-uni-basic.t   (Wstat: 139 Tests: 366 Failed: 0)
> >  Non-zero wait status: 139
> > t/21-uni-regex.t   (Wstat: 139 Tests: 18 Failed: 0)
> >  Non-zero wait status: 139
> > Files=19, Tests=3658, 35 wallclock secs ( 1.04 usr  0.15 sys + 19.64 cusr  
> > 4.01 csys = 24.84 CPU)
> > Result: FAIL
> > Failed 2/19 test programs. 0/3658 subtests failed.
> >
> > Everything passes and still the final result is FAIL
> 
> «Non-zero wait status: 139» is the important bit here. 139 = 11 + 128
> = Segfault + coredump. Unlikely to be a Test::More issue (though
> Test::Harness could be clearer on what's going on).

prove -wvb ...

on these files all end with "All tests successful." and no core dump

-- 
H.Merijn Brand  http://tux.nl  Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/   http://www.test-smoke.org/
http://qa.perl.org  http://www.goldmark.org/jeff/stupid-disclaimers/


Re: TAP - Test::More - fork

2011-11-10 Thread Leon Timmermans
On Thu, Nov 10, 2011 at 2:44 PM, H.Merijn Brand  wrote:
> Test Summary Report
> ---
> t/20-uni-basic.t   (Wstat: 139 Tests: 366 Failed: 0)
>  Non-zero wait status: 139
> t/21-uni-regex.t   (Wstat: 139 Tests: 18 Failed: 0)
>  Non-zero wait status: 139
> Files=19, Tests=3658, 35 wallclock secs ( 1.04 usr  0.15 sys + 19.64 cusr  
> 4.01 csys = 24.84 CPU)
> Result: FAIL
> Failed 2/19 test programs. 0/3658 subtests failed.
>
> Everything passes and still the final result is FAIL

«Non-zero wait status: 139» is the important bit here. 139 = 11 + 128
= Segfault + coredump. Unlikely to be a Test::More issue (though
Test::Harness could be clearer on what's going on).

Leon