Module: tools Branch: master Commit: 1a7d958bfb7fb46696bb29abcfa43da674ecb9cd URL: https://source.winehq.org/git/tools.git/?a=commit;h=1a7d958bfb7fb46696bb29ab...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Feb 5 16:03:35 2021 +0100
testbot/TestWTBS: Fix the patch range when --jobs points to a non-patch job.
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@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/tests/TestWTBS | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/testbot/tests/TestWTBS b/testbot/tests/TestWTBS index 87b53fe..1cbec2e 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]+)$/) @@ -988,7 +989,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 @@ -1304,12 +1309,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()}) {