tokuhirom / Minilla

Authorizing tool for CPAN modules
https://metacpan.org/release/Minilla
Other
97 stars 65 forks source link

Test failures (because of local %ENV?) #194

Closed eserte closed 8 years ago

eserte commented 8 years ago

t/project/contributors.t and t/work_dir/release_test.t fail on some of my freebsd smokers:

Can't exec "git": No such file or directory at /usr/home/eserte/.cpan/build/2016060406/Minilla-v3.0.2-9xke_u/blib/lib/Minilla/Util.pm line 159, <DATA> line 258.
Giving up.
    # No tests run!

#   Failed test 'No tests run for subtest "Contributors are included in stopwords"'
#   at t/work_dir/release_test.t line 57.
Minilla::Error::CommandExit at /usr/home/eserte/.cpan/build/2016060406/Minilla-v3.0.2-9xke_u/blib/lib/Minilla/Logger.pm line 56, <DATA> line 258.
        Minilla::Logger::errorf("Giving up.\x{a}") called at /usr/home/eserte/.cpan/build/2016060406/Minilla-v3.0.2-9xke_u/blib/lib/Minilla/Util.pm line 159
        Minilla::Util::cmd("git", "init") called at /usr/home/eserte/.cpan/build/2016060406/Minilla-v3.0.2-9xke_u/blib/lib/Minilla/Git.pm line 13
        Minilla::Git::git_init() called at t/work_dir/release_test.t line 32
        main::__ANON__() called at /home/eserte/.cpan/build/2016060406/Test-Simple-1.302022-Q9Ws7u/blib/lib/Test/Builder.pm line 301
        eval {...} called at /home/eserte/.cpan/build/2016060406/Test-Simple-1.302022-Q9Ws7u/blib/lib/Test/Builder.pm line 301
        Test::Builder::subtest(Test::Builder=HASH(0x420ec870), "Contributors are included in stopwords", CODE(0x42092450)) called at /home/eserte/.cpan/build/2016060406/Test-Simple-1.302022-Q9Ws7u/blib/lib/Test/More.pm line 792
        Test::More::subtest("Contributors are included in stopwords", CODE(0x42092450)) called at t/work_dir/release_test.t line 57
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 1.
t/work_dir/release_test.t .................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/1 subtests 

git is installed here. However, being a port and not part of the base freebsd system, git is installed in /usr/local/bin, not /usr/bin. More debugging showed that git is only searched in /usr/bin and /bin, but not in /usr/local/bin, despite being in my $PATH environment variable.

The problem is this line:

local %ENV;

This is effectively removing the whole environment, including $ENV{PATH}. Probably you should write

local %ENV = %ENV;

instead. Or find another method to preserve $ENV{PATH}. Or explicitly set $ENV{PATH} to some sane value.

syohex commented 8 years ago

Fixed at #195.