kyoob has asked for the wisdom of the Perl Monks concerning the following question:

This sort of picks up on the question asked in Test::Harness and the Debugger. I'm trying to run 4 or so tests in parallel on Win 7 but the processes only get so far as they can before the execution of the first test assertion run in the whole pool. E.g. if four of these test scripts each needed to open up a browser window before running its first test, I'd see maybe two browser windows come up before the first script in the pool actually makes an assertion and the rest of the processes stop dead, only to resume execution serially when the first test script is executed completely.

I'm not sure where the scripts are getting stopped up. Maybe in Test::More, maybe in the scripts themselves. What I thought I'd do was run them this way through a profiler, but I'm not sure how to do it with prove. I see how a debugger can be used when I'm running a .t script like any other script, but is there a way to debug using prove -j4?

Replies are listed 'Best First'.
Re: Profiling via prove?
by tobyink (Canon) on Jan 24, 2014 at 10:00 UTC

    prove is just a Perl script - you can debug it like any other Perl script. You should be able to do something like:

    perl -d `which prove` -j4
    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

      Windows doesn't like it. I've tried a few flavors of that: 'perl -d:SmallProf prove -r -j4' got me 'Can't open perl script "prove": No such file or directory'

      I tried the full path to the app, 'perl -d:SmallProf C:\Perl64\lib\App\prove.pm -r -j4' and get a blank newline then a return to my command line. (Well, the first time it told me to fix a deprecated 'defined(@array)' call in Devel::SmallProf, but whatevs).

      Note that prove runs fine on this machine otherwise, aside from this parallel processing weirdness.

      Is there a way to pass perl arguments to prove via the app's '::' argument passer gadget?

      This is Perl 5.16.1 built for MSWin32-x64-multi-thread, running on Windows 7 Pro, 64-bit OS.

        Eureka, thanks to ilmari_ in #perl-help.

        In the end I needed to set PERL5OPTS to '-d:SmallProf` and run prove normally. Got the same run with the same issues I'd been saying, along with a big whopping profiler output.