From: Francois Gouget Subject: [07/25] testbot/LogUtils: Rename the $Summary variables to $LogInfo. Message-Id: Date: Tue, 14 Jan 2020 16:41:35 +0100 (CET) In-Reply-To: References: ParseTaskLog() will eventually return the same information as GetLogErrors() so name the resulting structures to match. --- testbot/bin/WineRunBuild.pl | 10 +++++----- testbot/bin/WineRunReconfig.pl | 16 ++++++++-------- testbot/bin/WineRunWineTest.pl | 12 ++++++------ testbot/lib/WineTestBot/LogUtils.pm | 16 ++++++++-------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl index ce8f40f05..cf6428ae4 100755 --- a/testbot/bin/WineRunBuild.pl +++ b/testbot/bin/WineRunBuild.pl @@ -419,23 +419,23 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60)) Debug(Elapsed($Start), " Retrieving 'Build.log'\n"); if ($TA->GetFile("Build.log", "$TaskDir/log")) { - my $Summary = ParseTaskLog("$TaskDir/log"); - if ($Summary->{Task} eq "ok") + my $LogInfo = ParseTaskLog("$TaskDir/log"); + if ($LogInfo->{Task} eq "ok") { # We must have gotten the full log and the build did succeed. # So forget any prior error. $NewStatus = "completed"; $TAError = $ErrMessage = undef; } - elsif ($Summary->{Task} eq "badpatch") + elsif ($LogInfo->{Task} eq "badpatch") { # This too is conclusive enough to ignore other errors. $NewStatus = "badpatch"; $TAError = $ErrMessage = undef; } - elsif ($Summary->{NoLog}) + elsif ($LogInfo->{NoLog}) { - FatalError("$Summary->{NoLog}\n", "retry"); + FatalError("$LogInfo->{NoLog}\n", "retry"); } else { diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl index 9b0b479ee..c16c40a5a 100755 --- a/testbot/bin/WineRunReconfig.pl +++ b/testbot/bin/WineRunReconfig.pl @@ -416,21 +416,21 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60)) } } -my $Summary; +my $LogInfo; Debug(Elapsed($Start), " Retrieving 'Reconfig.log'\n"); if ($TA->GetFile("Reconfig.log", "$TaskDir/log")) { - $Summary = ParseTaskLog("$TaskDir/log"); - if ($Summary->{Task} eq "ok") + $LogInfo = ParseTaskLog("$TaskDir/log"); + if ($LogInfo->{Task} eq "ok") { # We must have gotten the full log and the build did succeed. # So forget any prior error. $NewStatus = "completed"; $TAError = $ErrMessage = undef; } - elsif ($Summary->{NoLog}) + elsif ($LogInfo->{NoLog}) { - FatalError("$Summary->{NoLog}\n", "retry"); + FatalError("$LogInfo->{NoLog}\n", "retry"); } else { @@ -438,7 +438,7 @@ if ($TA->GetFile("Reconfig.log", "$TaskDir/log")) # probably already have an error message that explains why. NotifyAdministrator("The ". $VM->Name ." build failed", "The ". $VM->Name ." build failed:\n\n". - "$Summary->{Task}\n\n". + "$LogInfo->{Task}\n\n". "See the link below for more details:\n". MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n"); $NewStatus = "badbuild"; @@ -469,7 +469,7 @@ if ($NewStatus eq "completed") "latest/wine-parentsrc.txt") { my $BaseName = basename($FileName); - if ($FileName !~ m~^latest/~ and !$Summary->{$BaseName} and + if ($FileName !~ m~^latest/~ and !$LogInfo->{$BaseName} and -f "$DataDir/latest/$BaseName") { # This file was not updated so there is no point in redownloading it. @@ -486,7 +486,7 @@ if ($NewStatus eq "completed") } } - if ($Summary->{"testagentd"}) + if ($LogInfo->{"testagentd"}) { # Restart the TestAgent server from the new binary # Note that the privileged TestAgent server is usually run with diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl index 245128a73..fecbab009 100755 --- a/testbot/bin/WineRunWineTest.pl +++ b/testbot/bin/WineRunWineTest.pl @@ -527,8 +527,8 @@ if (!defined $TA->Wait($Pid, $Task->Timeout, 60)) Debug(Elapsed($Start), " Retrieving 'Task.log'\n"); if ($TA->GetFile("Task.log", "$TaskDir/log")) { - my $Summary = ParseTaskLog("$TaskDir/log"); - if ($Summary->{Task} eq "ok") + my $LogInfo = ParseTaskLog("$TaskDir/log"); + if ($LogInfo->{Task} eq "ok") { # We must have gotten the full log and the task completed successfully # (with or without test failures). So clear any previous errors, including @@ -536,17 +536,17 @@ if ($TA->GetFile("Task.log", "$TaskDir/log")) $NewStatus = "completed"; $TaskFailures = $TAError = $ErrMessage = $PossibleCrash = undef; } - elsif ($Summary->{Task} eq "badpatch") + elsif ($LogInfo->{Task} eq "badpatch") { # This too is conclusive enough to ignore other errors. $NewStatus = "badpatch"; $TaskFailures = $TAError = $ErrMessage = $PossibleCrash = undef; } - elsif ($Summary->{NoLog}) + elsif ($LogInfo->{NoLog}) { - FatalError("$Summary->{NoLog}\n", "retry"); + FatalError("$LogInfo->{NoLog}\n", "retry"); } - elsif ($Summary->{Type} eq "build") + elsif ($LogInfo->{Type} eq "build") { # The error happened before the tests started so blame the build. $NewStatus = "badbuild"; diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm index 787d450b5..dd8228e69 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -94,35 +94,35 @@ sub ParseTaskLog($) if (open(my $LogFile, "<", $FileName)) { - my $Summary = {Type => "build"}; + my $LogInfo = {Type => "build"}; foreach my $Line (<$LogFile>) { chomp $Line; if ($Line eq "Task: tests") { - $Summary->{Type} = "tests"; + $LogInfo->{Type} = "tests"; } elsif ($Line eq "Task: ok") { - $Summary->{Task} ||= "ok"; + $LogInfo->{Task} ||= "ok"; } elsif ($Line eq "Task: Patch failed to apply") { - $Summary->{Task} = "badpatch"; + $LogInfo->{Task} = "badpatch"; last; # Should be the last and most specific message } elsif ($Line =~ /^Task: Updated ([a-zA-Z0-9.]+)$/) { - $Summary->{$1} = "updated"; + $LogInfo->{$1} = "updated"; } elsif ($Line =~ /^Task: / or _IsPerlError($Line)) { - $Summary->{Task} = "failed"; + $LogInfo->{Task} = "failed"; } } close($LogFile); - $Summary->{Task} ||= "missing"; - return $Summary; + $LogInfo->{Task} ||= "missing"; + return $LogInfo; } return {NoLog => "Unable to open the task log for reading: $!"}; } -- 2.20.1