2010年9月13日星期一

RE: [PerlChina] 安装Log-Dispatch-2.26模块 make test出错

xu woosley成功的测试例子对比了一下,我之前找的时候是落了第15行的require_ok。
 
是不是出错在第65行的第10个测试用例呢?我在目录t底下打开了XSMore.xs,之后该怎么查呢?
 
case nu  line nu 
     1      15  require_ok( 'ExtUtils::ParseXS' );
     2      31  ok -e $source_file, "Create an output file";
     3      40    ok $obj_file;
     4      41    ok -e $obj_file, "Make sure $obj_file exists";
     5      49    ok $lib_file;
     6      50    ok -e $lib_file,  "Make sure $lib_file exists";
     7      60    is $@, '';
     8      61    is ExtUtils::ParseXS::errors(), 0, 'ExtUtils::ParseXS::errors()';
     9      63    is $XSMore::boot_ok, 100, 'the BOOT keyword';
    10      65    ok XSMore::include_ok(), 'the INCLUDE keyword';
    11      66    is prototype(\&XSMore::include_ok), "", 'the PROTOTYPES keyword';
    12      68    is prototype(\&XSMore::prototype_ssa),
'$$@', 'the PROTOTYPE keyword';
    13      70    is_deeply [attributes::get(\&XSMore::attr_method)], [qw(method)], 'the ATTRS keyword';
    14      71    is prototype(\&XSMore::attr_method), '$;@', 'ATTRS with prototype';
    15      73    is XSMore::return_1(), 1, 'the CASE keyword (1)';
    16      74    is XSMore::return_2(), 2, 'the CASE keyword (2)';
    17      75    is prototype(\&XSMore::return_1), "", 'ALIAS with prototype (1)';
    18      76    is prototype(\&XSMore::return_2), "", 'ALIAS with prototype (2)';
    19      78    is XSMore::arg_init(200), 200, 'argument init';
    20      80    ok overload::Overloaded(XSMore->new), 'the FALLBACK keyword';
    21      81    is abs(XSMore->new), 42, 'the OVERLOAD keyword';
    22      85    is_deeply \@a, [qw(INIT CODE POSTCALL CLEANUP)], 'the INIT & POSTCALL & CLEANUP keywords';
    23      87    is_deeply [XSMore::outlist()], [ord('a'), ord('b')], 'the OUTLIST keyword';
    24      89    is XSMore::len("foo"), 3, 'the length keyword';
    25      91    is XSMore::sum(5, 9), 14, 'the INCLUDE_COMMAND directive';
 
# cat -n XSMore.xs
     1  #include "EXTERN.h"
     2  #include "perl.h"
     3  #include "XSUB.h"
     4
     5  =for testing
     6
     7  This parts are ignored.
     8
     9  =cut
    10
    11  STATIC void
    12  outlist(int* a, int* b){
    13          *a = 'a';
    14          *b = 'b';
    15  }
    16
    17  STATIC int
    18  len(const char* const s, int const l){
    19          return l;
    20  }
    21
    22  MODULE = XSMore         PACKAGE = XSMore
    23
    24  =for testing
    25
    26  This parts are also ignored.
    27
    28  =cut
    29
    30  PROTOTYPES: ENABLE
    31
    32  VERSIONCHECK: DISABLE
    33
    34  REQUIRE: 2.20
    35
    36  SCOPE: DISABLE
    37
    38  FALLBACK: TRUE
    39
    40  BOOT:
    41          sv_setiv(get_sv("XSMore::boot_ok", TRUE), 100);
    42
    43
    44  void
    45  prototype_ssa()
    46  PROTOTYPE: $$@
    47  CODE:
    48          NOOP;
    49
    50  void
    51  attr_method(self, ...)
    52  ATTRS: method
    53  CODE:
    54          NOOP;
    55
    56  #define RET_1 1
    57  #define RET_2 2
    58
    59  int
    60  return_1()
    61  CASE: ix == 1
    62          ALIAS:
    63                  return_1 = RET_1
    64                  return_2 = RET_2
    65          CODE:
    66                  RETVAL = ix;
    67          OUTPUT:
    68                  RETVAL
    69  CASE: ix == 2
    70          CODE:
    71                  RETVAL = ix;
    72          OUTPUT:
    73                  RETVAL
    74
    75  int
    76  arg_init(x)
    77          int x = SvIV($arg);
    78  CODE:
    79          RETVAL = x;
    80  OUTPUT:
    81          RETVAL
    82
    83  int
    84  myabs(...)
    85  OVERLOAD: abs
    86  CODE:
    87          RETVAL = 42;
    88  OUTPUT:
    89          RETVAL
    90
    91  void
    92  hook(IN AV* av)
    93  INIT:
    94          av_push(av, newSVpv("INIT", 0));
    95  CODE:
    96          av_push(av, newSVpv("CODE", 0));
    97  POSTCALL:
    98          av_push(av, newSVpv("POSTCALL", 0));
    99  CLEANUP:
   100          av_push(av, newSVpv("CLEANUP", 0));
   101
   102
   103  void
   104  outlist(OUTLIST int a, OUTLIST int b)
   105
   106  int
   107  len(char* s, int length(s))
   108
   109  INCLUDE_COMMAND: $^X -Ilib -It/lib -MIncludeTester -e IncludeTester::print_xs
   110
   111  #if 1
   112
   113  INCLUDE: XSInclude.xsh
   114
   115  #else
   116
   117  # for testing #else directive
   118
   119 

没有评论: