Module: tools Branch: master Commit: a61608621ddafa517d2b16d2fc3ec34122dfac89 URL: https://gitlab.winehq.org/winehq/tools/-/commit/a61608621ddafa517d2b16d2fc3e...
Author: Francois Gouget fgouget@codeweavers.com Date: Tue Jul 12 15:22:28 2022 +0200
testbot/web: Directly report multiple special job errors using AddError().
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/web/admin/SpecialJobs.pl | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/testbot/web/admin/SpecialJobs.pl b/testbot/web/admin/SpecialJobs.pl index d8294c1a..066c41be 100644 --- a/testbot/web/admin/SpecialJobs.pl +++ b/testbot/web/admin/SpecialJobs.pl @@ -158,7 +158,6 @@ sub OnSubmit($) { my ($self) = @_; my $VMKey; - my @Errors = ();
# Update Build VMs $VMKey = $self->{JobTemplates}->{Build}->{VMKey}; @@ -166,9 +165,8 @@ sub OnSubmit($) { $VMKey = undef if ($VMKey eq "*All Build VMs"); my $VMs = GetReconfigVMs($VMKey, "build"); - push @Errors, "Found no build VM to update" if (!@$VMs); - my $ErrMessage = AddReconfigJob($VMs, $VMKey, "build"); - push @Errors, $ErrMessage if (defined $ErrMessage); + $self->AddError("Found no build VM to update") if (!@$VMs); + $self->AddError(AddReconfigJob($VMs, $VMKey, "build")); }
# Run 32 bit WineTest @@ -183,9 +181,8 @@ sub OnSubmit($) foreach my $BaseJob (@BaseJobs) { my $VMs = GetWindowsTestVMs($VMKey, "exe32", $BaseJob); - push @Errors, "Found no $BaseJob VM to run WineTest on" if (!@$VMs); - my $ErrMessage = AddWindowsTestJob($VMs, $VMKey, "exe32", $BaseJob, "winetest-latest.exe"); - push @Errors, $ErrMessage if (defined $ErrMessage); + $self->AddError("Found no $BaseJob VM to run WineTest on") if (!@$VMs); + $self->AddError(AddWindowsTestJob($VMs, $VMKey, "exe32", $BaseJob, "winetest-latest.exe")); } }
@@ -201,9 +198,8 @@ sub OnSubmit($) undef; $VMKey = undef if ($VMKey eq "*All Base and WineTest VMs"); my $VMs = GetWindowsTestVMs($VMKey, "exe64", $BaseJob); - push @Errors, "Found no 64 bit VM to run WineTest on" if (!@$VMs); - my $ErrMessage = AddWindowsTestJob($VMs, $VMKey, "exe64", $BaseJob, "winetest64-latest.exe"); - push @Errors, $ErrMessage if (defined $ErrMessage); + $self->AddError("Found no 64 bit VM to run WineTest on") if (!@$VMs); + $self->AddError(AddWindowsTestJob($VMs, $VMKey, "exe64", $BaseJob, "winetest64-latest.exe")); }
# Update Wine VMs @@ -212,9 +208,8 @@ sub OnSubmit($) { $VMKey = undef if ($VMKey eq "*All Wine VMs"); my $VMs = GetReconfigVMs($VMKey, "wine"); - push @Errors, "Found no Wine VM to update" if (!@$VMs); - my $ErrMessage = AddReconfigJob($VMs, $VMKey, "wine"); - push @Errors, $ErrMessage if (defined $ErrMessage); + $self->AddError("Found no Wine VM to update") if (!@$VMs); + $self->AddError(AddReconfigJob($VMs, $VMKey, "wine")); }
# Run WineTest on Wine @@ -223,21 +218,14 @@ sub OnSubmit($) { $VMKey = undef if ($VMKey eq "*All Wine VMs"); my $VMs = GetWineTestVMs($VMKey); - push @Errors, "Found no Wine VM to run WineTest on" if (!@$VMs); - my $ErrMessage = AddWineTestJob($VMs, $VMKey); - push @Errors, $ErrMessage if (defined $ErrMessage); + $self->AddError("Found no Wine VM to run WineTest on") if (!@$VMs); + $self->AddError(AddWineTestJob($VMs, $VMKey)); }
# Notify engine - my $ErrMessage = RescheduleJobs(); - push @Errors, $ErrMessage if (defined $ErrMessage); - - if (@Errors) - { - $self->AddError(join("\n", @Errors)); - return undef; - } + $self->AddError(RescheduleJobs());
+ return undef if ($self->GetErrMessage()); exit($self->Redirect("/")); }