dk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I couldn't find answer to my question elsewhere, so I'd like to ask you all if you have anything to say. My problem is such: I wrote a module (Image::Match, locates image inside another), that uses another module (Prima, graphic toolkit) as a backend. Now, Image::Match receives lots of FAILs on certain tester configutaions, because apparently Prima is not getting installed. In turn, Prima is not getting installed because, well, that CPAN environment doesn't do "make install" during the build process, it only hacks $ENV{PERL5LIB} assuming that should be enough (but that isn't, because of config files).

This raises several questions. First, how useful would be that indication whether a module gets PASS or FAIL ? Not really useful from my point of view, and what I personally don't like, is that there's not one or two FAILs, there are more than half of them.

Also, how representative is that error, if the module dependency is not met? I mean, if testing suite cannot manage dependencies, why should it report as a failure to the module it cannot satisfy?

I thought that this special testing environment is CPANPLUS::Dist::YACSmoke, but I'm unsure if I'm right about it. Also, I've been talking to the tester, but I can't say that it helped the process. Well anyway, I wish I could add something constructive, but I can't think of anything. If you suffered from similar behavior, let's do something about it; if you know what to do, please tell. Thanks!

Replies are listed 'Best First'.
Re: Need advice about CPAN tests
by jettero (Monsignor) on Sep 25, 2008 at 12:02 UTC

    Devel::CheckLib.

    The idea is: don't write the Makefile (or Build file) if they don't have the right libs installed.

    Devel::CheckLib can help with this (although it's still experimental) because it gives you a standard lib to install in your dist that checks for the existence of the lib. If it's not there, you error out, don't write the Makefile (or Build file) and the smokers will skip you.

    On second thought, I think I may have misread. Do you just need to instruct your Makefile.PL to PREREQ_PM (or your Build.PL to requires) the Prima module?

    On third thought, it's actually kindof a combination of the two. Test the Prima install in your Makefile.PL/Build.PL and if it doesn't work as expected, print an error and don't write the Makefile/Build. (UPDATE: This is actually harder than it sounds, since you have to write the Makefile to require the module, but don't want to write the Makefile if it's not installed properly. Supposedly M::B has a solution for this, but EU::MM does not.)

    -Paul

Re: Need advice about CPAN tests
by Corion (Patriarch) on Sep 25, 2008 at 12:10 UTC

    Personally, I would prefer if Prima were smarter about its configuration files and could possibly find out whether it is installed or whether it is running uninstalled via PERL5LIB. But as I don't know anything about Prima, that just might not be possible because the C libraries look in fixed special locations. Another thing that might trip you up is that the tests seem to be run without a display and Prima possibly wasn't installed with support to run headless.

    I understand that you don't like getting FAIL reports for things that you think are beyond your control and if adapting Prima is out of the question, I would try the following approach to the Image::Match test suite, by having a file 000_prima.t which mainly checks that Prima is available:

    #!/usr/bin/perl -w use strict; use Test::More; if (! eval 'use Prima; 1') { BAIL_OUT("Prima not installed properly."); }; ok($Prima::VERSION, "Found Prima version $Prima::VERSION");

    That file will be run as one of the first files and it will stop all testing unless Prima is found to be working well enough for a use Prima;.

Re: Need advice about CPAN tests
by chromatic (Archbishop) on Sep 25, 2008 at 16:07 UTC
    Also, how representative is that error, if the module dependency is not met? I mean, if testing suite cannot manage dependencies, why should it report as a failure to the module it cannot satisfy?

    Provided that you've specified dependencies correctly in your Build.PL or Makefile.PL, any tester which does not follow dependencies is broken and sends harmful reports. Ask the owner of the tester to fix or disable testing on that machine.

    Recent changes to CPAN Testers may minimize this; hopefully fewer broken testers will persist.

      Update: replied to the wrong node initially, d'oh...

      Sadly it seems that's there's no easy, cross-platform way to check non-perl dependencies, which is what this thread is all about (if I understood correctly).

      That's exactly what I do. Prima is found on CPAN, builds fine, runs tests without X11 also fine, just noone does "make install". And I also feel that "broken and sends harmful reports" describes situation as I see it. Moreover, I did ask the owner. I don't know _what_ else if left to do.

      btw, thanks all for advices, but they aren't applicable - Devel::CheckLib does C libs, while Prima is a perl module. The only solution I see is indeed to check explicitly for Prima, but that's counter-productive, why should I protect against broken testing envirionment?

Re: Need advice about CPAN tests
by leocharre (Priest) on Sep 25, 2008 at 14:44 UTC

    If the prereq is something that can be found on cpan, then it needs to be listed in the Makefile.PL as one of the "PREREQ_PM => {" items.

    However, if it is not a cpan module, you need to ask for this before the Makefile.PL moves on.

    Don't test for non perl reqs in your (.t)est files. That will send you fail reports.

    You want to ask immediately.

    For example, I want to test if 'k3b' cd burning app is installed before I go on..

    Makefile.PL

    system('which k3b') ==0 or die("Missing k3b. Is it installed in this system?"); use ExtUtils::MakeMaker; WriteMakefile( ......

    Obvioulsy, in the CAVEATS or REQUIREMENTS section of your documentation, let them know what's up.

    This will stop that kind of fail report.

    (Oops.. Corion's suggestion looks real good compared to my lousy hack!)

Re: Need advice about CPAN tests
by syphilis (Archbishop) on Sep 25, 2008 at 15:14 UTC
    First, how useful would be that indication whether a module gets PASS or FAIL ?

    All a FAIL means is that the module failed to build on the particular tester's machine. That could mean there's something wrong with the module ... or it could also mean that there's something wrong with the tester's build environment.

    I have some modules that rely on external C libraries - and I'm always getting FAIL reports from testers because they don't have the requisite C library installed, or because their version of the requisite C library is too old.

    jettero mentioned Devel::CheckLib - and it can, under some circumstances, help out with that. But it entails adding extra cruft to the Makefile.PL, and I would prefer to *not* do that. On too many occasions I've had to work through a Makefile.PL, trying to fix code that has been introduced solely for the purpose of avoiding FAIL reports from testers. Often I've found that once that code has been removed, the module builds flawlessly for me. That's very frustrating - the author has put obstacles in my path out of the (misplaced) vanity of wanting to avoid "FAIL" reports from testers. That's a crime that I would like to avoid. (Not everyone shares my view on this :-)

    Cheers,
    Rob
Re: Need advice about CPAN tests
by DrHyde (Prior) on Sep 26, 2008 at 09:49 UTC
    The best place to ask about CPAN-testers results is the cpan-testers-discuss mailing list.
      Excellent, thank you! That's what I needed.