[PATCH] testbot: Fix handling of test unit additions/removals in patch series.

Francois Gouget fgouget at codeweavers.com
Thu May 31 03:06:10 CDT 2018


The TestBot used to only analyse the last patch in the series to 
determine whether it impacts the tests or not. However patches to 
resource files and helper dlls require having an up-to-date list of the 
test units, and that list may be impacted by previous patches in the 
series.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/PatchUtils.pm | 19 +++++++++++++++++--
 testbot/lib/WineTestBot/Patches.pm    |  4 +++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index a466df359..611d883e4 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -127,9 +127,9 @@ configure, whether it impacts the tests, etc.
 =back
 =cut
 
-sub GetPatchImpact($;$)
+sub GetPatchImpact($;$$)
 {
-  my ($PatchFileName, $NoUnits) = @_;
+  my ($PatchFileName, $NoUnits, $PastImpacts) = @_;
 
   my $fh;
   return undef if (!open($fh, "<", $PatchFileName));
@@ -138,6 +138,21 @@ sub GetPatchImpact($;$)
     NoUnits => $NoUnits,
     Tests => {},
   };
+
+  if ($PastImpacts)
+  {
+    foreach my $PastInfo (values %{$PastImpacts->{Tests}})
+    {
+      if ($PastInfo->{Files})
+      {
+        foreach my $File (keys %{$PastInfo->{Files}})
+        {
+          _AddTest($Impacts, "$PastInfo->{Path}/$File",
+                   $PastInfo->{Files}->{$File} eq "rm" ? "rm" : 0);
+        }
+      }
+    }
+  }
   my ($Path, $Change);
   while (my $Line = <$fh>)
   {
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index d4a5e0b17..71d735b08 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -132,7 +132,9 @@ sub Submit($$$)
 {
   my ($self, $PatchFileName, $IsSet) = @_;
 
-  my $Impacts = GetPatchImpact("$DataDir/patches/" . $self->Id);
+  my $PastImpacts;
+  $PastImpacts = GetPatchImpact($PatchFileName) if ($IsSet);
+  my $Impacts = GetPatchImpact("$DataDir/patches/" . $self->Id, undef, $PastImpacts);
   if (!$Impacts->{UnitCount})
   {
     $self->Disposition(($IsSet ? "Set" : "Patch") .
-- 
2.17.0




More information about the wine-devel mailing list