Greetings Avout, I'm attempting to use TAP::Harness to test CFEngine policy and I'm having trouble creating the final test commands. The following code is supposed to check the TAP output for these two commands:

/usr/bin/cf-agent -D efl_returnszero_csv -Kf ./promises.cf /usr/bin/cf-agent -D efl_returnszero_json -Kf ./promises.cf

The -f switch must have the ./promises.cf argument. When I run prove t/efl_returnszero.t I get this error:

t/efl_returnszero.t .. No subtests run Test Summary Report ------------------- t/efl_returnszero.t (Wstat: 0 Tests: 0 Failed: 0) Parse errors: No plan found in TAP output Files=1, Tests=0, 2 wallclock secs ( 0.03 usr 0.00 sys + 1.54 cusr + 0.04 csys = 1.61 CPU) Result: FAIL

My guess is that the final commands are coming out in a scrambled order resulting in no output, but how can I test that?

#!/usr/bin/perl use strict; use warnings; use Carp; use TAP::Harness; chdir 'test/masterfiles' or croak "Cannot cd to test/masterfiles $!"; my @tests = ( [ './promises.cf', 'using_csv' ], [ './promises.cf', 'using_json' ], ); # Final test command is exec + element from test + arg? my $harness = TAP::Harness->new({ exec => [ qw( /usr/bin/cf-agent -Kf ) ], test_args => { using_csv => [ '-D efl_returnszero_csv' ], using_json => [ '-D efl_returnszero_json' ], }, verbosity => 1, errors => 1, show_count => 1, }); $harness->runtests( @tests );

UPDATE: turns out the test args cannot have white space so

test_args => { using_csv => [ '-D efl_returnszero_csv' ], using_json => [ '-D efl_returnszero_json' ], }, # Must be: test_args => { using_csv => [ '-D', 'efl_returnszero_csv' ], using_json => [ '-D', 'efl_returnszero_json' ], },

Neil Watson
watson-wilson.ca


In reply to Testing non perl app using TAP::Harness by neilwatson

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.