Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Issues with MakeMaker tests

1 view
Skip to first unread message

Randle, William C

unread,
May 17, 2016, 5:00:02 AM5/17/16
to make...@perl.org
Hello,

I'm not sure if this is a bug or a user error, so I thought I would send this email first. If this is a bug, I can file a bug report for it in Bugzilla.

I am building Perl and associated libraries for a cross-compiled environment (qemu x86_64 target) from an x86_64 build machine for the Open Source Yocto project. This is with Perl 5.22.1 (MakeMaker 7.04_01). As part of the verification process, I am running the test cases on the targetr and get several failures on the MakeMaker tests. t/basic.t is one such example; the other failing tests fail in the same manner.

The error is:

cpan/ExtUtils-MakeMaker/t/basic ..............
1..0 # SKIP cross-compiling and make not available
No root path(s) specified
 at t/basic.t line 83.
ok 1
ok 2 - teardown
# Tests were run but no plan was declared and done_testing() was not seen.
FAILED--expected 0 tests, saw 2

basic.t contains (in part):

use ExtUtils::MakeMaker;
   :
   :
use Config; 
use Test::More;
use ExtUtils::MM;

plan !MM->can_run(make()) && $ENV{PERL_CORE} && $Config{'usecrosscompile'}
    ? (skip_all => "cross-compiling and make not available")
    : (tests => 171);
use File::Find;
   :
   :

I am finding that the call MM->can_run(make()) returns undef. make() is defined in ExtUtils::MM_Any.pm, but it appears to never be called. In addition, make() relies on the value of $self->MAKE, which is set in init_MAKE(), also defined in ExtUtils::MM_Any.pm and never called.

Now, I can get this code to work by changing it to look like this:

my $mm = ExtUtils::MM->new();
plan !$mm->can_run($mm->make()) && ...

(init_MAKE() gets called from new(), to set the internal value for MAKE which is used when make() is called.)

As an aside, the cryptic "No root path(s) specified..." error message is caused by this line:
END { rmtree $DUMMYINST; }
which always gets executed, even if no tests are run and $DUMMYINST is not initialized. I changed this line to:
END { rmtree $DUMMYINST if defined $DUMMYINST; }

So, my questions are:

1. How is this intended to work and why did it presumably work when originally written and committed? IOW, my perl knowledge is obviously lacking here. [One potential answer here is that it was never tested in a cross-compile environment, since when $Config{'usecrosscompile'} is not defined, the value for MM->can_run() doesn't matter, as the plan expression will end up always being true.]

2. I notice some other tests use MM->can_run($Config{make}). That would work here, too, and solve the problem, but $Config{make} could be different than the value returned by make(); does that really matter here?

    -Bill Randle
    Sr. Software Engineer
    Intel Corp.

Graham Knop

unread,
May 19, 2016, 3:00:02 PM5/19/16
to make...@perl.org
The make sub being called is from ExtUtils::Test::Utils, which is in t/lib.

>
> Now, I can get this code to work by changing it to look like this:
>
> my $mm = ExtUtils::MM->new();
> plan !$mm->can_run($mm->make()) && ...
>
> (init_MAKE() gets called from new(), to set the internal value for MAKE
> which is used when make() is called.)
The current return value of make() is correct, and using
ExtUtils::MM->make is wrong. The plan just isn't being set early enough.

>
> As an aside, the cryptic "No root path(s) specified..." error message is
> caused by this line:
> END { rmtree $DUMMYINST; }
> which always gets executed, even if no tests are run and $DUMMYINST is
> not initialized. I changed this line to:
> END { rmtree $DUMMYINST if defined $DUMMYINST; }
>
> So, my questions are:
>
> 1. How is this intended to work and why did it presumably work when
> originally written and committed? IOW, my perl knowledge is obviously
> lacking here. [One potential answer here is that it was never tested in
> a cross-compile environment, since when $Config{'usecrosscompile'} is
> not defined, the value for MM->can_run() doesn't matter, as the plan
> expression will end up always being true.]

The plan is meant to skip all further processing of the file, but it
isn't being run early enough. You can fix it by wrapping the plan call
in a BEGIN { ... } block (without any of the other changes you tried).
This means it will be processed before parsing any more of the file,
preventing the END blocks later in the file from running.

This has already been fixed for current EUMM releases
(https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/4a07a3bd18363986112cf2b39dec3c2985353ffb)
but the change hasn't made it into perl core yet.
0 new messages