From: Ian Jackson Date: Tue, 18 Apr 2017 14:42:22 +0000 (+0000) Subject: mg-allocate: Support --progress-fd X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4d126e6d0285a46d70326ffddc1a1f7c8246ea39;p=people%2Froyger%2Fosstest.git mg-allocate: Support --progress-fd Signed-off-by: Ian Jackson --- diff --git a/mg-allocate b/mg-allocate index 87a4e71..2dfbdb1 100755 --- a/mg-allocate +++ b/mg-allocate @@ -57,6 +57,8 @@ # # --info-base= Replaces `manual' at start of info put into plan. # +# --progress-fd= Print some brief progress messages to . +# # must exist (and be in a format valid for OSSTEST_TASK). # This is part of "osstest", an automated testing framework for Xen. @@ -83,6 +85,7 @@ unshift @INC, qw(.); use Osstest; use Osstest::TestSupport; use Osstest::Executive; +use IO::Handle; csreadconfig(); @@ -450,6 +453,12 @@ sub plan () { logm("best at $planned->{Start} is ".showposs(\@reqlist)); die unless $planned; + printf MGA_PROGRESS "%s %s @%d %s\n", + (show_abs_time time), + ($mayalloc && !$planned->{Start} ? "allocating" : "planned"), + $planned->{Start}, + showposs(\@reqlist); + my $worstok=0; if ($mayalloc && !$planned->{Start}) { $worstok=1; @@ -501,6 +510,8 @@ sub plan () { loggot(@got); } +open MGA_PROGRESS, ">/dev/null" or die $!; + while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) { $_= shift @ARGV; last if m/^\-\-?$/; @@ -528,6 +539,9 @@ while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) { $allocinfo_base = $1; } elsif (s/^--stdout-output$/-/) { $stdout_output = 1; + } elsif (s/^--progress-fd=(\d+)$/-/) { + open MGA_PROGRESS, ">&$1" or die $!; + MGA_PROGRESS->autoflush(1); } else { die "bad option \`$_'"; }