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

The automated smoke test reports on my EBook-Tools module are being completely obscured by lines that look like:

Use of uninitialized value in string eq at (eval 46) line 1. Use of uninitialized value in string eq at (eval 47) line 1. Use of uninitialized value in string eq at (eval 48) line 1. Use of uninitialized value $_[1] in hash element at /usr/share/perl5/X +ML/Twig.pm line 5297. Use of uninitialized value in string eq at (eval 42) line 1. Use of uninitialized value in string eq at (eval 39) line 1.

As far as I can tell, this is entirely an artifact of Test::Harness. It doesn't happen when executing my code, it doesn't happen when running the tests by hand, and it doesn't happen when running the tests via prove. Some of the warning messages aren't even in my code! I'd have been inclined to ignore them, except that I've got either a missing dependency somewhere or a genuine portability bug that I can't find, and the smoke tests that are reporting the failure are also truncating before returning any useful information on where the failure is, so they're useless to me other than to say that some automated systems aren't testing the same way I am.

Does anyone know what causes this, and either how to stop it or how to set up a useful kind of bug report to Test::Harness?

Replies are listed 'Best First'.
Re: Test::Harness and uninitialized value in eval
by ikegami (Patriarch) on Nov 22, 2008 at 09:11 UTC

    I get the warnings with Test::Harness

    perl -Iblib\lib -Iblib\arch -MTest::Harness -e"runtests('t/01-init_and +_accessors.t')"

    And without

    perl -w -Iblib\lib -Iblib\arch t/01-init_and_accessors.t

    So it's not a Test::Harness issue. The reason you didn't see the problem before using Test::Harness is that Test::Harness turns on the display of warnings. It's not the cause of them. Looks like XML::Twig is buggy or isn't being called properly.

      Oh, I see... warnings were turned off in XML::Twig or some other module that I'm calling and the global '-w' is turning them back on... Somehow I was expecting all major modules to have warnings turned on already, so I kept thinking of '-w' as redundant, and never tried it.

      Now that I can reproduce it by hand I've tracked down at least one of the spew causes to XML::Twig::first_elt, so I'll go file a bug on that. Thanks.

Re: Test::Harness and uninitialized value in eval
by Anonymous Monk on Nov 22, 2008 at 04:45 UTC
    upgrade?

      Well, first off, I can't force someone else's smoke testing rig to be upgraded. That said, however, I can currently reproduce this on both of my own test boxes, and both are running Perl 5.10, and one has Test::Harness 3.14 dropped in on top of it. If I need to upgrade something, it's not clear what.

      (And yes, all tests actually pass on both of my own test boxes.)

        That said, however, I can currently reproduce this on both of my own test boxes

        You mean you can reproduce all of those warnings, but not the failures ?
        If you can reproduce all of those warnings, then hopefully you can also find a way of shutting them up, by placement of no warnings 'uninitialized'; in the appropriate place - probably in the test files. (Or you could just remove the use warnings; altogether.) Once you've managed to eradicate those warnings in your own environment, just release a devel build to CPAN, and then the testers' output won't be truncated and you'll be able to see where the failures are occurring.

        Obviously, this hinges on your being able to work out how to eradicate those warnings. Good luck !!

        Cheers,
        Rob