DCIT / perl-CryptX

https://metacpan.org/pod/CryptX
Other
35 stars 23 forks source link

Fails tests without '.' in @INC #31

Closed kentfredric closed 7 years ago

kentfredric commented 7 years ago

On perls with -Ddefault_inc_excludes_dot ( explicitly on 5.25.10, default on 5.25.11+ )

Can't locate t/mbi_ltm/bigintpm.inc in @INC (@INC contains: /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/mbi_ltm_bigintpm.t line 52.
# Looks like your test exited with 2 just after 6.
t/mbi_ltm_bigintpm.t ................ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 3722/3728 subtests 
Can't locate t/mbi_ltm/bigfltpm.inc in @INC (@INC contains: /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/mbi_ltm_bigfltpm.t line 41.
# Looks like your test exited with 2 just after 5.
t/mbi_ltm_bigfltpm.t ................ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2409/2414 subtests 
    (less 1 skipped subtest: 4 okay)
# use64=1 ivsize=8 ivtype=long use64bitint=define
t/mbi_ltm_mbi-from-big-scalar.t ..... ok
Can't locate t/mbi_ltm/bigintpm.inc in @INC (@INC contains: /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/lib /home/kent/.cpanm/work/1490272047.10617/CryptX-0.044/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/mbi_ltm_bugs.t line 52.
# Looks like your test exited with 2 just after 6.
t/mbi_ltm_bugs.t .................... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 3722/3728 subtests 
karel-m commented 7 years ago

@pjacklam those tests for Math::Bigint::LTM are mostly copy&paste from Math::Bigint::GMP, do you have any hint how to handle this?

kentfredric commented 7 years ago

Its worth mentioning, Math::BigInt has the same problem even in its latest release.

https://rt.cpan.org/Ticket/Display.html?id=120717

karel-m commented 7 years ago

@kentfredric what's the usual way of fixing this, adding use lib "."; in Makefile.PL? or somewhere else?

kentfredric commented 7 years ago

When its in tests, the recommended approach is to put a use lib statement in the invoking test.

You could be lazy and do use lib q[.], but it might be better to restructure the files/call names so that you can use something less prone to risk, like use lib './t/lib' or similar.

However, if the code in question is using "require $file" or "do $file" instead of "use", you can avoid @INC tweaking and just do :


   require "./path/to/file.pm"
   do "./path/to/file.pm"

The key magic being that a prefix of "./" side-steps @INC lookup mechanics.

karel-m commented 7 years ago

On perls with -Ddefault_inc_excludes_dot ( explicitly on 5.25.10, default on 5.25.11+ )

@kentfredric I was not able to reproduce the behaviour you have described on 5.25.11 (built via perlbrew with all options left in default) therefore I blindly applied your suggestion in 1891ff7 . Could you please test the new CryptX-0.045?

Thanks in advance.

kentfredric commented 7 years ago

You have to explicitly set PERL_USE_UNSAFE_INC=0 on 5.25.11 due to TAP::Harness injecting PERL_USE_UNSAFE_INC=1 when not exists $ENV{PERL_USE_UNSAFE_INC} ( Which subsequently hides real errors as well, and is a temporary workaround provided by TAP::Harness which is scheduled to be removed around perl 5.30 ).

I will however test your release

kentfredric commented 7 years ago

:+1:

0.045 now passes where 0.044 would not.

sending: (http://cpan.metacpan.org/authors/id/M/MI/MIK/CryptX-0.044.tar.gz, MIK, CryptX-0.044, FAIL)
sending: (http://cpan.metacpan.org/authors/id/M/MI/MIK/CryptX-0.045.tar.gz, MIK, CryptX-0.045, PASS)