这与我最近的问题非常相似,只是这一次,CGI::Github::Webhook的烟雾测试在Travis CI和本地都很好(两者都安装了Perl 5.22操作系统,并通过Perlbrew构建和安装Perl 5.24,见下文),但除了一个CPAN测试报告外,其他所有测试都失败了。
最常见的错误如下所示:
PERL_DL_NONLAZY=1 "/bbbike/perl-5.24.0/bin/perl5.24.0" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/auth-fail.t ............ ok
t/author-critic.t ........ skipped: these tests are for testing by the author
t/author-pod-coverage.t .. skipped: these tests are for testing by the author
t/author-pod-syntax.t .... skipped: these tests are for testing by the author
t/basic-functionality.t .. ok
Attempt to reload List/Util.pm aborted.
Compilation failed in require at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Sub/Exporter/Progressive.pm line 9.
BEGIN failed--compilation aborted at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Sub/Exporter/Progressive.pm line 9.
Compilation failed in require at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Devel/GlobalDestruction.pm line 11.
BEGIN failed--compilation aborted at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Devel/GlobalDestruction.pm line 11.
Compilation failed in require at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Moo/_Utils.pm line 26.
BEGIN failed--compilation aborted at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Moo/_Utils.pm line 26.
Compilation failed in require at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Moo.pm line 12.
BEGIN failed--compilation aborted at /bbbike/perl-5.24.0/lib/site_perl/5.24.0/Moo.pm line 12.
Compilation failed in require at /tmpfs/.cpan-build-cpansand/2016060903/CGI-Github-Webhook-0.04-pS8kOL/blib/lib/CGI/Github/Webhook.pm line 11.
BEGIN failed--compilation aborted at /tmpfs/.cpan-build-cpansand/2016060903/CGI-Github-Webhook-0.04-pS8kOL/blib/lib/CGI/Github/Webhook.pm line 11.
Compilation failed in require at ./cgitest.pl line 10.
BEGIN failed--compilation aborted at ./cgitest.pl line 10.
script /cgi-bin/cgitest.pl generated no valid headers at /opt/perl-5.24.0/lib/site_perl/5.24.0/CGI/Test.pm line 468.
Use of uninitialized value $in_fname in unlink at /opt/perl-5.24.0/lib/site_perl/5.24.0/CGI/Test.pm line 469.
Use of uninitialized value $in_fname in concatenation (.) or string at /opt/perl-5.24.0/lib/site_perl/5.24.0/CGI/Test.pm line 469.
can't unlink : No such file or directory at /opt/perl-5.24.0/lib/site_perl/5.24.0/CGI/Test.pm line 469.
在本地使用我的 perlbrew 构建的 Perl 5.24 它看起来像这样:
[…]-Github-Webhook-0.04 → perlbrew use 5.24.0
[…]-Github-Webhook-0.04 → which perl
/home/abe/perl5/perlbrew/perls/perl-5.24.0/bin/perl
[…]-Github-Webhook-0.04 → perl -v
This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2016, Larry Wall
Perl may be copied […]
[…]-Github-Webhook-0.04 → perl Makefile.PL
Generating a Unix-style Makefile
Writing Makefile for CGI::Github::Webhook
Writing MYMETA.yml and MYMETA.json
[…]-Github-Webhook-0.04 → prove -l
t/auth-fail.t ............ ok
t/author-critic.t ........ skipped: these tests are for testing by the author
t/author-pod-coverage.t .. skipped: these tests are for testing by the author
t/author-pod-syntax.t .... skipped: these tests are for testing by the author
t/basic-functionality.t .. ok
t/cgi-test-auth-fail.t ... ok
t/cgi-test.t ............. ok
t/methods-non-json.t ..... ok
t/methods.t .............. ok
t/release-kwalitee.t ..... skipped: these tests are for release candidate testing
All tests successful.
Files=10, Tests=52, 1 wallclock secs ( 0.04 usr 0.00 sys + 0.66 cusr 0.07 csys = 0.77 CPU)
Result: PASS
即使我以与CPAN测试人员报告中相同的方式调用它,它对我来说也不会失败:
[…]-Github-Webhook-0.04 → PERL_DL_NONLAZY=1 /home/abe/perl5/perlbrew/perls/perl-5.24.0/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/auth-fail.t ............ ok
t/author-critic.t ........ skipped: these tests are for testing by the author
t/author-pod-coverage.t .. skipped: these tests are for testing by the author
t/author-pod-syntax.t .... skipped: these tests are for testing by the author
t/basic-functionality.t .. ok
t/cgi-test-auth-fail.t ... ok
t/cgi-test.t ............. ok
t/methods-non-json.t ..... ok
t/methods.t .............. ok
t/release-kwalitee.t ..... skipped: these tests are for release candidate testing
All tests successful.
Files=10, Tests=52, 1 wallclock secs ( 0.02 usr 0.02 sys + 0.68 cusr 0.05 csys = 0.77 CPU)
Result: PASS
但我不明白为什么我无法重现这些错误,尽管几乎每个 CPAN 测试报告都失败了 0.04 版本。
你可能会得到一个不同的库组合与使用perlbrew与使用vanilla cpan安装。 从错误消息来看,似乎缺少一些依赖项。
我尝试在perl(5.20.1)上通过cpan安装,由于Path::Tiny 将警告插入到cgi输出中,测试似乎失败了
cpan CGI::Github::Webhook
... skipping dependencies ...
CGI::Test is up to date (1.111).
ABE/CGI-Github-Webhook-0.04.tar.gz
Has already been unwrapped into directory /home/felix/.cpan/build/CGI-Github-Webhook-0.04-10wq5g
ABE/CGI-Github-Webhook-0.04.tar.gz
Has already been prepared
Running make for A/AB/ABE/CGI-Github-Webhook-0.04.tar.gz
cp static-badges/errored.png blib/lib/auto/share/module/CGI-Github-Webhook/errored.png
cp static-badges/failed.svg blib/lib/auto/share/module/CGI-Github-Webhook/failed.svg
cp static-badges/failed.png blib/lib/auto/share/module/CGI-Github-Webhook/failed.png
cp static-badges/success.svg blib/lib/auto/share/module/CGI-Github-Webhook/success.svg
cp static-badges/errored.svg blib/lib/auto/share/module/CGI-Github-Webhook/errored.svg
cp static-badges/success.png blib/lib/auto/share/module/CGI-Github-Webhook/success.png
cp lib/CGI/Github/Webhook.pm blib/lib/CGI/Github/Webhook.pm
Manifying 1 pod document
ABE/CGI-Github-Webhook-0.04.tar.gz
/usr/bin/make -- OK
Running make test
Skip blib/lib/auto/share/module/CGI-Github-Webhook/success.png (unchanged)
Skip blib/lib/auto/share/module/CGI-Github-Webhook/errored.svg (unchanged)
Skip blib/lib/auto/share/module/CGI-Github-Webhook/failed.svg (unchanged)
Skip blib/lib/auto/share/module/CGI-Github-Webhook/errored.png (unchanged)
Skip blib/lib/auto/share/module/CGI-Github-Webhook/failed.png (unchanged)
Skip blib/lib/auto/share/module/CGI-Github-Webhook/success.svg (unchanged)
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/auth-fail.t ............ 1/3
# Failed test 'CGI output as expected'
# at t/auth-fail.t line 28.
# got: 'Unrecognized option(s) passed to make_path(): err at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117.
# Content-Type: text/plain; charset=utf-8
#
# Authentication failed
# '
# expected: 'Content-Type: text/plain; charset=utf-8
#
# Authentication failed
# '
# Looks like you failed 1 test of 3.
t/auth-fail.t ............ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
t/author-critic.t ........ skipped: these tests are for testing by the author
t/author-pod-coverage.t .. skipped: these tests are for testing by the author
t/author-pod-syntax.t .... skipped: these tests are for testing by the author
t/basic-functionality.t .. 1/12
# Failed test 'CGI output as expected'
# at t/basic-functionality.t line 33.
# got: 'Unrecognized option(s) passed to make_path(): err at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117.
# Content-Type: text/plain; charset=utf-8
#
# Successfully triggered
# '
# expected: 'Content-Type: text/plain; charset=utf-8
#
# Successfully triggered
# '
# Failed test 'CGI output as expected'
# at t/basic-functionality.t line 65.
# got: 'Unrecognized option(s) passed to make_path(): err at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117.
# Content-Type: text/plain; charset=utf-8
#
# Trigger failed
# '
# expected: 'Content-Type: text/plain; charset=utf-8
#
# Trigger failed
# '
# Looks like you failed 2 tests of 12.
t/basic-functionality.t .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/12 subtests
t/cgi-test-auth-fail.t ... ok
t/cgi-test.t ............. ok
t/methods-non-json.t ..... Unrecognized option(s) passed to make_path(): err at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117.
t/methods-non-json.t ..... ok
t/methods.t .............. Unrecognized option(s) passed to make_path(): err at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117.
t/methods.t .............. ok
t/release-kwalitee.t ..... skipped: these tests are for release candidate testing
Test Summary Report
-------------------
t/auth-fail.t (Wstat: 256 Tests: 3 Failed: 1)
Failed test: 2
Non-zero exit status: 1
t/basic-functionality.t (Wstat: 512 Tests: 12 Failed: 2)
Failed tests: 2, 8
Non-zero exit status: 2
Files=10, Tests=52, 3 wallclock secs ( 0.10 usr 0.02 sys + 2.41 cusr 0.25 csys = 2.78 CPU)
Result: FAIL
Failed 2/10 test programs. 3/52 subtests failed.
Makefile:878: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255
ABE/CGI-Github-Webhook-0.04.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports ABE/CGI-Github-Webhook-0.04.tar.gz
下面是该警告的堆栈跟踪:
cpan look CGI::Github::Webhook
/.cpan/build/CGI-Github-Webhook-0.04-wA0tww/t $ perl -d -I../lib cgi/basic.pl 'echo foo'
Loading DB routines from perl5db.pl version 1.44
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
Unrecognized option(s) passed to make_path(): err at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117.
at /usr/local/share/perl/5.20.1/File/Path.pm line 115.
File::Path::mkpath("/tmp/XtmjrOLDl8/auto/share/module") called at /usr/local/share/perl/5.20.1/Path/Tiny.pm line 1117
Path::Tiny::mkpath(Path::Tiny=ARRAY(0xa6e67cc)) called at /usr/local/share/perl/5.20.1/Test/File/ShareDir/TempDirObject.pm line 75
Test::File::ShareDir::TempDirObject::_module_tempdir(Test::File::ShareDir::TempDirObject=HASH(0xa5b316c)) called at /usr/local/share/perl/5.20.1/Test/File/ShareDir/TempDirObject.pm line 112
Test::File::ShareDir::TempDirObject::_module_share_target_dir(Test::File::ShareDir::TempDirObject=HASH(0xa5b316c), "CGI::Github::Webhook") called at /usr/local/share/perl/5.20.1/Test/File/ShareDir/TempDirObject.pm line 132
Test::File::ShareDir::TempDirObject::_install_module(Test::File::ShareDir::TempDirObject=HASH(0xa5b316c), "CGI::Github::Webhook") called at /usr/local/share/perl/5.20.1/Test/File/ShareDir.pm line 60
Test::File::ShareDir::import("Test::File::ShareDir", "-share", HASH(0xa416f90)) called at cgi/basic.pl line 9
main::BEGIN() called at cgi/basic.pl line 13
eval {...} called at cgi/basic.pl line 13
main::(cgi/basic.pl:16): my $cgi = CGI->new();