Hello monks,

I have a module using Module::Build. There is one test file that is failing under 'Build test' but does not fail under 'perl -Mblib <test_file>'. My print debugging was showing identical things happening during test in both cases, so I decided to run under the debugger and have a look.

I found that while I could insert breakpoints when running via 'perl -d -Mblib <test_file>', the same breakpoints would not stop execution while running under 'perl -d Build test'.

Here's some simple code showing the issue I'm seeing:

#pm file package BPTest; use strict; use warnings; sub do_stuff { $DB::single = 1; my $x = 10; return $x; } 1; #test file use Test::More tests => 2; BEGIN { use_ok( 'BPTest' ); } is( BPTest->do_stuff, 10, 'do_stuff returns 10' )

Here is what happens under 'perl -Mblib <test_file>':

plxc16479> perl -d -Mblib t/001_load.t Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. 1..2 ok 1 - use BPTest; main::(t/001_load.t:9): is( main::(t/001_load.t:10): BPTest->do_stuff, main::(t/001_load.t:11): 10, main::(t/001_load.t:12): 'do_stuff returns 10' main::(t/001_load.t:13): ) DB<1> c + BPTest::do_stuff(/nfs/pdx/disks/nehalem.pde.077/tmp/BPTest/blib/lib/BP +Test.pm:7): 7: my $x = 10; DB<1>

I'm stopped at my breakpoint like I expect. Here's what happens under 'perl -d Build test':

plxc16479> perl -d Build test Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(Build:17): my $progname; DB<1> c + t/001_load.t .. ok All tests successful. Files=1, Tests=2, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.02 cusr + 0.00 csys = 0.05 CPU) Result: PASS Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1>

Here I did not stop at the breakpoint. This is making debug difficult since the test failure only occurs under 'Build test'. I have tried to set the breakpoint from the debugger via 'b <sub_name>' and 'b <line>', but both are ignored the same as $DB::single.

So the questions: What is happening under 'Build test' that prevents breakpoints from being honored? At a higher level, what does 'Build test' do differently regarding test files as compared to 'perl -Mblib <file>'?

I appreciate the help and any time spent looking over my question :)

UPDATE: I have resolved the underlying problem causing the test failure. Turns out the @INC array was in a different order when executing 'Build test' vs 'perl -Mblib <test_file>' and was picking up a non test version of one of my modules. However, I'm still interested in why the breakpoints do not seem to work from Build test :)


In reply to Module::Build's Build test does not stop at breakpoints by tj_thompson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.