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

Monks: I manage a project that uses a Jenkins continuous integration server to build and run the code's tests. This is not a very Perlish project in layout although it does use Perl in several parts. The tests generate TAP, and when run manually the build invokes Test::Harness to execute then and summarize the results. When run under Jenkins though the build expects the Jenkins Tap plugin to parse the test results and report them via the Jenkins web interface, thus it executes the test programs separately and captures their output into separate .tap files for each program.

This all works reasonably well except the Jenkins Tap plugin is not fully compliant with the TAP standard and doesn't report problems in the .tap files very well. It reports individual test failures Ok, but when a test program dies silently mid-test, the Jenkins report gives no indication which program reported fewer results than its plan, it just marks the whole build as unstable. Some of these builds have many thousands of tests spread across tens of test programs, so examining the results manually is tiresome and inefficient.

I would like to fix the plugin, but until I get round to doing that it would be really useful if I could persuade prove or a simple Test::Harness script to read in and summarize all the .tap files which the Jenkins builds have already created. I don't want to rerun the tests by hand as they get executed on a collection of different operating systems and the .tap files automatically copied to the Jenkins master node where I have direct access to them.

It looks like it should be possible to create a plugin for TAP::Harness to do this, but I'm hoping someone has already done so — can anyone point me at such a thing?

  • Comment on Using prove or Test::Harness without running tests? (SOLVED)

Replies are listed 'Best First'.
Re: Using prove or Test::Harness without running tests?
by MidLifeXis (Monsignor) on Mar 16, 2015 at 12:24 UTC

    There are also TAP plugins that can emit JUnit format (and a couple of others, IIRC), which Jenkins may be able to parse more easily.

    --MidLifeXis

      Unfortunately the TAP is almost all generated by our own C code. I guess it might be possible to extend that to output JUnit as well, but it wouldn't be my first choice. Thanks for the suggestion.
Re: Using prove or Test::Harness without running tests?
by songmaster (Beadle) on Mar 17, 2015 at 04:08 UTC

    Found the solution with no coding necessary: prove takes an --exec option:

    $ prove -r --ext .tap -e /bin/cat
    ./O.linux-x86_64/blockingSockTest.tap ......... ok
    ./O.linux-x86_64/epicsAlgorithmTest.tap ....... ok
    ./O.linux-x86_64/epicsCalcTest.tap ............ ok
    
    ...
    
    ./O.linux-x86_64/ringBytesTest.tap ............ ok
    ./O.linux-x86_64/ringPointerTest.tap .......... ok
    ./O.linux-x86_64/taskwdTest.tap ............... ok
    All tests successful.
    Files=27, Tests=2083,  0 wallclock secs ( 0.41 usr  0.06 sys +  0.00 cusr  0.08 csys =  0.55 CPU)
    Result: PASS
Re: Using prove or Test::Harness without running tests?
by songmaster (Beadle) on Mar 17, 2015 at 02:01 UTC

    Ok, does anybody have any suggestions how to go about subclassing/replacing the code that normally runs the test programs with something that just reads the contents of a .tap file? I'm not sure how far down the stack I need to go, and am hoping some other monk might have an idea that could help...