[tools] testbot/web: Directly report multiple special job errors using AddError().

Francois Gouget fgouget at codeweavers.com
Tue Jul 12 08:22:28 CDT 2022


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 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 d8294c1aaf..066c41be33 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("/"));
 }
 
-- 
2.30.2




More information about the wine-devel mailing list