Skip Menu |

This queue is for tickets about the Test CPAN distribution.

Report information
The Basics
Id: 75541
Status: rejected
Priority: 0/
Queue: Test

People
Owner: Nobody in particular
Requestors: davido [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
The following snippet of code will fail at compile-time on *some* but not all smoke testers: use strict; use Test; BEGIN{ plan( tests => 2 ); } ok(1); ok(1); An example of a failure: http://www.cpantesters.org/cpan/report/131f5540-668a-11e1-b042-ed17a1f8bb33 The failure message: Undefined subroutine &main::plan called at t/01mytest.t line 3. BEGIN failed--compilation aborted at t/01mytest.t line 3.
Subject: Re: [rt.cpan.org #75541] BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
Date: Mon, 05 Mar 2012 02:07:21 -0800
To: bug-Test [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
I doubt that's a bug in Test.pm, it doesn't do anything fancy with exporting functions. Are any of these failures for non-alpha versions of Perl?
On Mon Mar 05 05:07:34 2012, schwern@pobox.com wrote: Show quoted text
> I doubt that's a bug in Test.pm, it doesn't do anything fancy with
exporting Show quoted text
> functions. Are any of these failures for non-alpha versions of Perl?
The following URL links to a report from Andreas using Perl 5.12.4 and a 64 bit build of Linux. http://www.cpantesters.org/cpan/report/5c29f970-668a-11e1-ba37-a526a1f8bb33 The exact code that is failing on line five is this: use strict; use Test; BEGIN { plan( tests => 10 ); } use Inline 'C++' => <<END; And the error message is: Undefined subroutine &main::plan called at t/01basic.t line 5. BEGIN failed--compilation aborted at t/01basic.t line 5. Line five is the BEGIN{} line. The tests were passing before I included "use strict;". I think I may be able to work around it by fully qualifying the Test::plan() call, but since I can't reproduce it locally I would have to upload yet another version of the target module to verify that theory.
I should mention that since Test.pm is core I'm not including it in my BUILD_REQUIRES, and consequently the smoker reports aren't showing what version of the module is being used. If I do upload a new version of Inline::CPP to try to work around the issue I'll be sure to cause the $VERSION to be output in a separate prereqs test script.
Subject: Re: [rt.cpan.org #75541] BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
Date: Mon, 05 Mar 2012 15:32:51 -0800
To: bug-Test [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
On 2012.3.5 8:39 AM, David J. Oswald via RT wrote: Show quoted text
> I should mention that since Test.pm is core I'm not including it in my > BUILD_REQUIRES, and consequently the smoker reports aren't showing what > version of the module is being used. If I do upload a new version of > Inline::CPP to try to work around the issue I'll be sure to cause the > $VERSION to be output in a separate prereqs test script.
If you put it in as `Test => 0` then the version will be reported and there will be no ill effects. However, Test.pm hasn't been touched in years. You might want to see if Test::More is similarly affected, or some random module that exports a function. I'm pretty sure this is not really about Test.pm.
RT-Send-CC: schwern [...] pobox.com
Somebody named William Wolf uploaded an empty module named "Test" to CPAN: http://search.cpan.org/~wwolf/Test/ This is the kind of problem that requires lots of manual intervention to fix, if I remember correctly.
Subject: Re: [rt.cpan.org #75541] BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
Date: Mon, 5 Mar 2012 21:28:55 -0800
To: bug-Test [...] rt.cpan.org
From: David Oswald <daoswald [...] gmail.com>
On Mon, Mar 5, 2012 at 8:05 PM, Bo Lindbergh via RT <bug-Test@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=75541 > > > Somebody named William Wolf uploaded an empty module named "Test" > to CPAN: http://search.cpan.org/~wwolf/Test/ > > This is the kind of problem that requires lots of manual intervention > to fix, if I remember correctly.
If William Wolf deleted the distribution using PAUSE, would that resolve the issue? Perhaps I'll count to ten, take a deep breath, and fire off a gentle email to him.
Subject: Re: [rt.cpan.org #75541] BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
Date: Mon, 05 Mar 2012 22:05:38 -0800
To: bug-Test [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Thanks for the info. Thankfully that was not indexed, he doesn't have permissions to the Test namespace, so regular users will not be effected. A smoker might have picked it up thinking it was an alpha and installed it. I think the answer is to make sure modules@perl.org knows and to ask the author to delete their Test.pm.
Subject: Re: [rt.cpan.org #75541] BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
Date: Mon, 5 Mar 2012 22:21:53 -0800
To: bug-Test [...] rt.cpan.org
From: David Oswald <daoswald [...] gmail.com>
On Mon, Mar 5, 2012 at 10:05 PM, Michael G Schwern via RT <bug-Test@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=75541 > > > Thanks for the info.  Thankfully that was not indexed, he doesn't have > permissions to the Test namespace, so regular users will not be effected.  A > smoker might have picked it up thinking it was an alpha and installed it. > > I think the answer is to make sure modules@perl.org knows and to ask the > author to delete their Test.pm.
I've attempted to email the author using the email address he provided in the distribution, but not surprisingly it bounced as undeliverable. I sent a message to the cpan-testers-discuss@perl.org list as a word of caution to them. I know that even Andreas is using the bogus Test distribution in some of his smokers. Here's an example of one of his smoke tests. Since I've now included Test => '0' in BUILD_REQUIRES I can see the report that his smoker is using Test version 0.001, which is the empty distribution. I'll forward a message to modules@perl.org alerting them to the issue. Beyond that I'm not sure what else to do but wait for it to go away. -- David Oswald daoswald@gmail.com
Subject: Re: [rt.cpan.org #75541] BEGIN{ plan tests => 2 } will fail under strictures for *some* smoke testers.
Date: Tue, 06 Mar 2012 02:03:07 -0800
To: bug-Test [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
On 2012.3.5 10:22 PM, David Oswald via RT wrote: Show quoted text
> I'll forward a message to modules@perl.org alerting them to the issue. > Beyond that I'm not sure what else to do but wait for it to go away.
A simple way to make the problem go away for you would be to bump up the Test.pm prereq to 1.13, the version which came with 5.6.0. Then they can't use the bogus version and your distribution still doesn't require a non-core version. You could also just stop using Test.pm and use Test::More instead. There's not much point to using both. Test::More has better diagnostic information, better diagnostics, works with other Test modules and is actively developed. Here's side-by-side equivalent statements. use Test; use Test::More tests => 10; BEGIN { plan tests => 10 } ok(1); pass("Made it past compilation"); ok($obj1->get_serial, 11111); is( $obj1->get_serial, 11111 ); You can eliminate printing out the contents of each object, is() will tell you the expected and actual value if the test fails. -- 10. Not allowed to purchase anyone's soul on government time. -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/
I'm going to close this up. Thanks for reporting it, you did the right thing.