linux - TAP::Harness perl tests tee output -


i running tests using tap::harness , when run tests command line on linux system test results on stdout run when try capture output file stdout using perl harness.pl | tee out.tap results buffered , displayed @ end, tried passing in file handle new results still buffered before being written file , there way not buffer output, have long running suite , @ results while tests running capture output.

tap::harness version 3.22 , perl version 5.8.8

here sample code harness.pl

#!/usr/bin/perl use strict; use warnings; use tap::harness; $|++;  @tests = ('del.t',);   $harness = tap::harness->new( {     verbosity => 1,  } ); $harness->runtests(@tests); 

and test del.t

use test::more qw /no_plan/; $|++;  $count =1; (1 ..20 ) {    ok ( $count ++ == $_, "pass  $_");    sleep 1 if ( $count % 5 == 0 ) ; } 

using script instead of tee want:

script -c 'perl harness.pl' file 

found simple change make tee work well: specify formatter_class:

my $harness = tap::harness->new( {     verbosity => 1,     formatter_class => 'tap::formatter::console',  } ); 

this because tap::harness uses different default 1 if output not tty, causing buffering you're seeing.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -