How to enable error messages from `prove`?

198 Views Asked by At

This is the simple perl test which has syntax errors:

$ echo 'foo+' > t1.t
$ perl t1.t
syntax error at t1.t line 1, at EOF
Execution of t1.t aborted due to compilation errors.

Is there a way to provide some option to prove utility to see that error message? Currently if I run that test with prove I can not understand what is wrong with it:

$ prove -v t1.t
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 

Test Summary Report
-------------------
t1.t (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  0 wallclock secs ( 0.01 usr +  0.00 sys =  0.01 CPU)
Result: FAIL

In my case t1.t test is much complex (I can not pastebin its code) and I can run it directly with perl without any problem, but I can not run it by prove. Because of errors like above. So I am trying to find a way to see actual reason of failing test.

UPD
Detailed debug information: https://pastebin.com/gqMbdTb8

1

There are 1 best solutions below

0
On

While debugging I found this environment variable PERL_TEST_HARNESS_DUMP_TAP. We can set it to some directory name and see a result of testing.

$ echo 'foo+' > t1.t

$ PERL_TEST_HARNESS_DUMP_TAP=output perl t1.t
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 

Test Summary Report
-------------------
t1.t (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  0 wallclock secs ( 0.01 usr +  0.00 sys =  0.01 CPU)
Result: FAIL

$ cat output/t1.t 
syntax error at t1.t line 1, at EOF
Execution of t1.t aborted due to compilation errors.

Now we can understand what is going wrong with our t1.t test.

Still I did not find an option/a solution to see that output from prove like at @ikegami example: enter image description here