不好意思,这封信似乎有点长,我以前从来没有debug过make test。
如何查看出错的用例是哪一个呢?刚才我执行了一下more.t,屏幕的输出和原来的一致。
# /usr/perl5/5.8.4/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/more.t
t/more.t .. 1/25 # Looks like you planned 25 tests but ran 10.
t/more.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 15/25 subtests
(less 8 skipped subtests: 2 okay)
t/more.t .. 1/25 # Looks like you planned 25 tests but ran 10.
t/more.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 15/25 subtests
(less 8 skipped subtests: 2 okay)
Test Summary Report
-------------------
t/more.t (Wstat: 65280 Tests: 10 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 25 tests but ran 10.
Files=1, Tests=10, 1 wallclock secs ( 0.09 usr 0.01 sys + 0.40 cusr 0.04 csys = 0.54 CPU)
Result: FAIL
Failed 1/1 test programs. 0/10 subtests failed.
-------------------
t/more.t (Wstat: 65280 Tests: 10 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 25 tests but ran 10.
Files=1, Tests=10, 1 wallclock secs ( 0.09 usr 0.01 sys + 0.40 cusr 0.04 csys = 0.54 CPU)
Result: FAIL
Failed 1/1 test programs. 0/10 subtests failed.
# cat -n more.t
1 #!/usr/bin/perl
2
3 use strict;
4 use Test::More;
5 use Config;
6 use DynaLoader;
7 use ExtUtils::CBuilder;
8 use attributes;
9 use overload;
10
11 plan tests => 25;
12
13 my ($source_file, $obj_file, $lib_file);
14
15 require_ok( 'ExtUtils::ParseXS' );
16 ExtUtils::ParseXS->import('process_file');
17
18 chdir 't' or die "Can't chdir to t/, $!";
19
20 use Carp; $SIG{__WARN__} = \&Carp::cluck;
21
22 #########################
23
24 $source_file = 'XSMore.c';
25
26 # Try sending to file
27 ExtUtils::ParseXS->process_file(
28 filename => 'XSMore.xs',
29 output => $source_file,
30 );
31 ok -e $source_file, "Create an output file";
32
33 my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
34 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
35
36 SKIP: {
37 skip "no compiler available", 2
38 if ! $b->have_compiler;
39 $obj_file = $b->compile( source => $source_file );
40 ok $obj_file;
41 ok -e $obj_file, "Make sure $obj_file exists";
42 }
43
44 SKIP: {
45 skip "no dynamic loading", 6
46 if !$b->have_compiler || !$Config{usedl};
47 my $module = 'XSMore';
48 $lib_file = $b->link( objects => $obj_file, module_name => $module );
49 ok $lib_file;
50 ok -e $lib_file, "Make sure $lib_file exists";
51
52 eval{
53 package XSMore;
54 our $VERSION = 42;
55 our $boot_ok;
56 DynaLoader::bootstrap_inherit(__PACKAGE__, $VERSION); # VERSIONCHECK disabled
57
58 sub new{ bless {}, shift }
59 };
60 is $@, '';
61 is ExtUtils::ParseXS::errors(), 0, 'ExtUtils::ParseXS::errors()';
62
63 is $XSMore::boot_ok, 100, 'the BOOT keyword';
64
65 ok XSMore::include_ok(), 'the INCLUDE keyword';
66 is prototype(\&XSMore::include_ok), "", 'the PROTOTYPES keyword';
67
68 is prototype(\&XSMore::prototype_ssa), '$$@', 'the PROTOTYPE keyword';
69
70 is_deeply [attributes::get(\&XSMore::attr_method)], [qw(method)], 'the ATTRS keyword';
71 is prototype(\&XSMore::attr_method), '$;@', 'ATTRS with prototype';
72
73 is XSMore::return_1(), 1, 'the CASE keyword (1)';
74 is XSMore::return_2(), 2, 'the CASE keyword (2)';
75 is prototype(\&XSMore::return_1), "", 'ALIAS with prototype (1)';
76 is prototype(\&XSMore::return_2), "", 'ALIAS with prototype (2)';
77
78 is XSMore::arg_init(200), 200, 'argument init';
79
80 ok overload::Overloaded(XSMore->new), 'the FALLBACK keyword';
81 is abs(XSMore->new), 42, 'the OVERLOAD keyword';
82
83 my @a;
84 XSMore::hook(\@a);
85 is_deeply \@a, [qw(INIT CODE POSTCALL CLEANUP)], 'the INIT & POSTCALL & CLEANUP keywords';
86
87 is_deeply [XSMore::outlist()], [ord('a'), ord('b')], 'the OUTLIST keyword';
88
89 is XSMore::len("foo"), 3, 'the length keyword';
90
91 is XSMore::sum(5, 9), 14, 'the INCLUDE_COMMAND directive';
92
93 # Win32 needs to close the DLL before it can unlink it, but unfortunately
94 # dl_unload_file was missing on Win32 prior to perl change #24679!
95 if ($^O eq 'MSWin32' and defined &DynaLoader::dl_unload_file) {
96 for (my $i = 0; $i < @DynaLoader::dl_modules; $i++) {
97 if ($DynaLoader::dl_modules[$i] eq $module) {
98 DynaLoader::dl_unload_file($DynaLoader::dl_librefs[$i]);
99 last;
100 }
101 }
102 }
103 }
104
105 unless ($ENV{PERL_NO_CLEANUP}) {
106 for ( $obj_file, $lib_file, $source_file) {
107 next unless defined $_;
108 1 while unlink $_;
109 }
110 }
1 #!/usr/bin/perl
2
3 use strict;
4 use Test::More;
5 use Config;
6 use DynaLoader;
7 use ExtUtils::CBuilder;
8 use attributes;
9 use overload;
10
11 plan tests => 25;
12
13 my ($source_file, $obj_file, $lib_file);
14
15 require_ok( 'ExtUtils::ParseXS' );
16 ExtUtils::ParseXS->import('process_file');
17
18 chdir 't' or die "Can't chdir to t/, $!";
19
20 use Carp; $SIG{__WARN__} = \&Carp::cluck;
21
22 #########################
23
24 $source_file = 'XSMore.c';
25
26 # Try sending to file
27 ExtUtils::ParseXS->process_file(
28 filename => 'XSMore.xs',
29 output => $source_file,
30 );
31 ok -e $source_file, "Create an output file";
32
33 my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
34 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
35
36 SKIP: {
37 skip "no compiler available", 2
38 if ! $b->have_compiler;
39 $obj_file = $b->compile( source => $source_file );
40 ok $obj_file;
41 ok -e $obj_file, "Make sure $obj_file exists";
42 }
43
44 SKIP: {
45 skip "no dynamic loading", 6
46 if !$b->have_compiler || !$Config{usedl};
47 my $module = 'XSMore';
48 $lib_file = $b->link( objects => $obj_file, module_name => $module );
49 ok $lib_file;
50 ok -e $lib_file, "Make sure $lib_file exists";
51
52 eval{
53 package XSMore;
54 our $VERSION = 42;
55 our $boot_ok;
56 DynaLoader::bootstrap_inherit(__PACKAGE__, $VERSION); # VERSIONCHECK disabled
57
58 sub new{ bless {}, shift }
59 };
60 is $@, '';
61 is ExtUtils::ParseXS::errors(), 0, 'ExtUtils::ParseXS::errors()';
62
63 is $XSMore::boot_ok, 100, 'the BOOT keyword';
64
65 ok XSMore::include_ok(), 'the INCLUDE keyword';
66 is prototype(\&XSMore::include_ok), "", 'the PROTOTYPES keyword';
67
68 is prototype(\&XSMore::prototype_ssa), '$$@', 'the PROTOTYPE keyword';
69
70 is_deeply [attributes::get(\&XSMore::attr_method)], [qw(method)], 'the ATTRS keyword';
71 is prototype(\&XSMore::attr_method), '$;@', 'ATTRS with prototype';
72
73 is XSMore::return_1(), 1, 'the CASE keyword (1)';
74 is XSMore::return_2(), 2, 'the CASE keyword (2)';
75 is prototype(\&XSMore::return_1), "", 'ALIAS with prototype (1)';
76 is prototype(\&XSMore::return_2), "", 'ALIAS with prototype (2)';
77
78 is XSMore::arg_init(200), 200, 'argument init';
79
80 ok overload::Overloaded(XSMore->new), 'the FALLBACK keyword';
81 is abs(XSMore->new), 42, 'the OVERLOAD keyword';
82
83 my @a;
84 XSMore::hook(\@a);
85 is_deeply \@a, [qw(INIT CODE POSTCALL CLEANUP)], 'the INIT & POSTCALL & CLEANUP keywords';
86
87 is_deeply [XSMore::outlist()], [ord('a'), ord('b')], 'the OUTLIST keyword';
88
89 is XSMore::len("foo"), 3, 'the length keyword';
90
91 is XSMore::sum(5, 9), 14, 'the INCLUDE_COMMAND directive';
92
93 # Win32 needs to close the DLL before it can unlink it, but unfortunately
94 # dl_unload_file was missing on Win32 prior to perl change #24679!
95 if ($^O eq 'MSWin32' and defined &DynaLoader::dl_unload_file) {
96 for (my $i = 0; $i < @DynaLoader::dl_modules; $i++) {
97 if ($DynaLoader::dl_modules[$i] eq $module) {
98 DynaLoader::dl_unload_file($DynaLoader::dl_librefs[$i]);
99 last;
100 }
101 }
102 }
103 }
104
105 unless ($ENV{PERL_NO_CLEANUP}) {
106 for ( $obj_file, $lib_file, $source_file) {
107 next unless defined $_;
108 1 while unlink $_;
109 }
110 }
perl t/more.t 找出出错原因并fix,
From: perlchina@googlegroups.com [mailto:perlchina@googlegroups.com] On Behalf Of woosley. xu.
Sent: 2010年9月14日 9:26
To: perlchina@googlegroups.com
Subject: Re: [PerlChina] 安装Log-Dispatch-2.26模块 make test出错
或者直接跳过make test
在 2010年9月13日 下午8:49,ZHANG Jiaqiang A <Jiaqiang.a.Zhang@alcatel-sbell.com.cn>写道:
--大家好,求高手给出出主意我想安装Log-Dispatch-2.26,然后被告知缺少Params::Validate,安装Params-Validate-0.95,缺少Module::Build,安装Module-Build-0.3607,被告知缺少ExtUtils::ParseXS,安装ExtUtils-ParseXS-2.2206,make test的时候出错。这是台机房里的Solaris server,无法上网。只能把各个软件从CPAN上下载了,1)perlgcc Makefile.PL 2)make 3)make test 4) make install。# make test
PERL_DL_NONLAZY=1 /usr/perl5/5.8.4/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/basic.t .. ok
t/more.t ... 1/25 # Looks like you planned 25 tests but ran 10.
t/more.t ... Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 15/25 subtests
(less 8 skipped subtests: 2 okay)
t/usage.t .. okTest Summary Report
-------------------
t/more.t (Wstat: 65280 Tests: 10 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 25 tests but ran 10.
Files=3, Tests=44, 2 wallclock secs ( 0.12 usr 0.03 sys + 1.20 cusr 0.12 csys = 1.47 CPU)
Result: FAIL
Failed 1/3 test programs. 0/44 subtests failed.
*** Error code 29
make: Fatal error: Command failed for target `test_dynamic'
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
--
Woosley.Xu
--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
没有评论:
发表评论