我正在尝试使用 Perlbrew 安装 Perl v5.20.1,但由于脚本中的测试失败而失败perl5db.t
。我正在使用具有 64 位架构 (x86_64) 的 Ubuntu 14.04。
跑步:
$ perlbrew install perl-5.20.1
开始安装正常并运行了几分钟,但由于测试失败而中止。输出:
Test Summary Report
-------------------
../lib/perl5db.t (Wstat: 0 Tests: 119 Failed: 86)
Failed tests: 19-56, 58-60, 63-64, 66, 68-72, 74, 76-80
82-83, 85-101, 104-108, 110, 112, 114, 116-119
Files=2409, Tests=699745, 550 wallclock secs (34.45 usr 3.70 sys + 264.29 cusr 27.76 csys = 330.20 CPU)
Result: FAIL
从~/perl5/perlbrew/build.perl-5.20.1.log
我可以看出,第一个失败的测试是:
# Failed test 19 - Can set breakpoint in a line in the middle of the file. at ../lib/perl5db.t line 555
# got 'In MyModule.
# In Main File.
# '
# expected /(?^msx:
# ^Var=Bar$
# .*
# ^In\ MyModule\.$
# .*
# ^In\ Main\ File\.$
# .*
# )/
更新
我想我找到了有关导致问题的原因的更多详细信息。/home/hakon/perl5/perlbrew/build/perl-5.20.1/lib/perl5db.t
我通过调试构建目录中的测试脚本来跟踪问题 。
该脚本perl5db.t
是用于测试 Perl 调试器是否正常工作的脚本。第一个失败的测试发生在它测试是否可以在文件中间的一行上设置断点。该文件/home/hakon/perl5/perlbrew/build/perl-5.20.1/lib/perl5db/t/filename-line-breakpoint
如下所示:
use strict;
use warnings;
use MyModule;
my $x = "Foo";
MyModule::function();
print "In Main File.\n";
包含的模块MyModule.pm
是:
package MyModule;
use strict;
use warnings;
use vars qw($var);
$var = "Bar";
sub function
{
print "In MyModule.\n";
}
1;
然后测试脚本使用-d
开关和以下命令在脚本上运行 Perl 到调试器:
b ../lib/perl5db/t/MyModule.pm:12
c
do { use IO::Handle; STDOUT->autoflush(1); print "Var=$var\n"; }
c
q
它期望调试器的输出类似于(即:匹配):
qr/
^Var=Bar$
.*
^In\ MyModule\.$
.*
^In\ Main\ File\.$
.*
/msx
但它得到:
In MyModule.
In Main File.
这不匹配。所以问题很可能是
do { use IO::Handle; STDOUT->autoflush(1); print "Var=$var\n"; }
命令,它根本不产生任何输出..