[tools] testbot/TestWTBS: Fix the patch range when --jobs points to a non-patch job.

Francois Gouget fgouget at codeweavers.com
Fri Feb 5 09:03:35 CST 2021


This resulted in an empty set of patch ranges which meant to check every
patch.
TestWTBS now distinguishes an undef $PatchRanges, which means to check
all patches, from an empty @$PatchRanges, which means to ignore all
patches.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/tests/TestWTBS | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/testbot/tests/TestWTBS b/testbot/tests/TestWTBS
index d0c46db78..aac684700 100755
--- a/testbot/tests/TestWTBS
+++ b/testbot/tests/TestWTBS
@@ -131,11 +131,12 @@ while (@ARGV)
   }
 }
 
-my $JobRanges = [];
+my $JobRanges;
 if (!defined $Usage)
 {
   if (defined $OptJobs)
   {
+    $JobRanges = [];
     foreach my $Range (split /,+/, $OptJobs)
     {
       if ($Range =~ /^([0-9]+)$/)
@@ -993,7 +994,11 @@ sub IsInRange($$)
   my ($Ranges, $Id) = @_;
 
   return 0 if (!$Id);
-  return 1 if (!$Ranges or !@$Ranges);
+
+  # No range means to allow everything...
+  return 1 if (!$Ranges);
+
+  # ...while an empty range means to reject everything
   foreach my $Range (@$Ranges)
   {
     return 1 if (($Range->[0] == 0 or $Range->[0] <= $Id) and
@@ -1309,12 +1314,13 @@ sub CheckPatches()
   my $Jobs = CreateJobs();
   my $Patches = CreatePatches();
 
-  my $PatchRanges = [];
+  my $PatchRanges;
   if (@$JobRanges)
   {
     # Convert the job ranges into a list of patch ranges so that these patches:
     #   1. either have a job in the allowed job ranges,
     #   2. or have no job but are contiguous to a patch satisfying 1 or 2.
+    $PatchRanges = [];
     my ($First, $Last, $AddRange);
     foreach my $Patch (sort { $a->Id <=> $b->Id } @{$Patches->GetItems()})
     {
-- 
2.20.1



More information about the wine-devel mailing list