Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/LibvirtTool.pl | 9 ++++----- testbot/lib/WineTestBot/Log.pm | 9 ++++++++- 2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index c0288e75a..fa07d2d20 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -265,15 +265,14 @@ sub Monitor() "$VMKey does not exist anymore"; NotifyAdministrator("The $VMKey VM is not relevant anymore", "The $VMKey VM was offline but ceased to be relevant after ". - Elapsed($Start). " seconds:\n\n$Reason\n"); + PrettyElapsed($Start). ":\n\n$Reason\n"); return 1; } if ($VM->Status ne "offline") { NotifyAdministrator("The $VMKey VM is working again (". $VM->Status .")", "The status of the $VMKey VM unexpectedly switched from offline\n". - "to ". $VM->Status ." after ". Elapsed($Start) - ." seconds."); + "to ". $VM->Status ." after ". PrettyElapsed($Start) ."."); return 0; }
@@ -320,7 +319,7 @@ sub Monitor() return 1 if (ChangeStatus("offline", "off", "done")); NotifyAdministrator("The $VMKey VM is working again", "The $VMKey VM started working again after ". - Elapsed($Start) ." seconds."); + PrettyElapsed($Start) ." seconds."); return 0; } } @@ -459,6 +458,6 @@ else Error("Unsupported action $Action!\n"); $Rc = 1; } -LogMsg "$Action on $VMKey completed in ", Elapsed($Start), " s\n"; +LogMsg "$Action on $VMKey completed in ", PrettyElapsed($Start), " s\n";
exit $Rc; diff --git a/testbot/lib/WineTestBot/Log.pm b/testbot/lib/WineTestBot/Log.pm index f1499dd9a..65782c514 100644 --- a/testbot/lib/WineTestBot/Log.pm +++ b/testbot/lib/WineTestBot/Log.pm @@ -26,12 +26,13 @@ WineTestBot::Log - Logging =cut
use WineTestBot::Config; +use WineTestBot::Utils;
use vars qw (@ISA @EXPORT);
require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(&LogMsg &OpenLog &Time &Elapsed); +@EXPORT = qw(&LogMsg &OpenLog &Time &Elapsed &PrettyElapsed);
my $logfile; my $logprefix; @@ -108,4 +109,10 @@ sub Elapsed($) return sprintf("%0.2f", Time()-$Start); }
+sub PrettyElapsed($) +{ + my ($Start) = @_; + return DurationToString(Time()-$Start); +} + 1;