diff options
author | Stefan Metzmacher <metze@sernet.de> | 2008-03-17 15:17:19 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-03-17 15:50:49 +0100 |
commit | 0de47f6b577fdb1e93395b56960951b32cca48c0 (patch) | |
tree | 112d7a2b0f49185c32f248aeb6bd12daab4555fc | |
parent | 3e8124bc66503f1531ace71b64262aa2c26c3800 (diff) | |
download | samba-0de47f6b577fdb1e93395b56960951b32cca48c0.tar.gz samba-0de47f6b577fdb1e93395b56960951b32cca48c0.tar.bz2 samba-0de47f6b577fdb1e93395b56960951b32cca48c0.zip |
selftest: handle progress output in verbose mode
metze
(This used to be commit 9196213c49532ac60349ff55e66430b7c80b09c2)
-rw-r--r-- | source4/selftest/Subunit.pm | 29 | ||||
-rw-r--r-- | source4/selftest/output/plain.pm | 4 | ||||
-rwxr-xr-x | source4/selftest/selftest.pl | 2 |
3 files changed, 31 insertions, 4 deletions
diff --git a/source4/selftest/Subunit.pm b/source4/selftest/Subunit.pm index e5c61ca9ba..f8a7794aac 100644 --- a/source4/selftest/Subunit.pm +++ b/source4/selftest/Subunit.pm @@ -15,7 +15,34 @@ sub parse_results($$$$$) my $unexpected_err = 0; my $orig_open_len = $#$open_tests; - while(<$fh>) { + while(1) { + my $line = ""; + my $char = ""; + my $eof = 0; + my $error = 0; + + while ($char ne "\n") { + my $ret = sysread($fh, $char, 1); + if (not defined($ret)) { + $error = $!; + last; + } + if ($ret == 0) { + $eof = 1; + last; + } + + $line .= $char; + if ($char eq "\r") { + $msg_ops->output_msg($line); + $line = ""; + } + } + + last if ($eof or $error); + + $_ = $line; + if (/^test: (.+)\n/) { $msg_ops->control_msg($_); $msg_ops->start_test($open_tests, $1); diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index e491a999ab..25ff74792e 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -7,8 +7,6 @@ use Exporter; use FindBin qw($RealBin); use lib "$RealBin/.."; -use Subunit qw(parse_results); - use strict; sub new($$$$$$$) { @@ -62,7 +60,9 @@ sub output_msg($$) my ($self, $output) = @_; if ($self->{verbose}) { + require FileHandle; print $output; + STDOUT->flush(); } else { $self->{test_output}->{$self->{NAME}} .= $output; } diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 73d03f3d4c..39a1b5a450 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -584,7 +584,7 @@ push (@torture_options, "--configfile=$conffile"); push (@torture_options, "--maximum-runtime=$torture_maxtime"); push (@torture_options, "--target=$opt_target"); push (@torture_options, "--basedir=$prefix_abs"); -push (@torture_options, "--option=torture:progress=no") if ($opt_format eq "buildfarm"); +push (@torture_options, "--option=torture:progress=no") unless ($opt_verbose); push (@torture_options, "--format=subunit"); push (@torture_options, "--option=torture:quick=yes") if ($opt_quick); |