How to run perl test in debugger mode?
Asked Answered
B

1

6

I try to run test under debugger as:

perl -d $(which prove) t/file.t

But this has no effect because each test is run as separate job.

I have found --exec option, but when I provide it I lost any option from .proverc file and command line

prove -Ithis/is/lost --exec 'perl -d' t/file.t

How to run tests by prove with additional options and do not lose those options which were provided at .proverc file and command line?

I do not want repeat myself and write:

prove --exec 'perl -d -Ilib -Ilocal/lib/perl5' t/file.t

While -Ilib and -Ilocal/lib/perl5 are both at .proverc file

Becca answered 15/3, 2017 at 16:32 Comment(0)
S
1

You can repeat yourself once if you set the PERL5OPT environment variable.

export DBG_MODE='-d -Ilib -Ilocal/lib/perl5'
prove t/file1.t                       # regular use
PERL5OPT=$DBG_MODE prove t/file2.t    # with debugger

or with an alias or bash function

alias proved='PERL5OPT="-d -Ilib -Ilocal/lib/perl5" prove'
Symer answered 15/3, 2017 at 17:17 Comment(1)
I have tried it too. It did not work, because it will run two debuggers. One for prove and second for test. I setup port to debug remotely, but because of two debuggers are run I got conflict about that port is in use and scenario dies (Becca

© 2022 - 2024 — McMap. All rights reserved.