From: Francois Gouget Subject: [PATCH] testbot: Fix patchset handling in GetPatchImpacts(). Message-Id: Date: Mon, 24 Sep 2018 12:42:22 +0200 (CEST) Only the last part must be taken into account to determine if a rebuild or testing is needed. But they are needed, the previous parts must be taken into account for the rebuild, including the Autoconf and MakeMakefile fields. This also means the scope of the rebuild may be different from that of the tests (we may need a full rebuild to run a single test). So introduce RebuildRoot and RebuildModules which are similar to PatchedRoot and PatchedModules but also take into account patches from previous parts. Signed-off-by: Francois Gouget --- testbot/lib/WineTestBot/PatchUtils.pm | 44 +++++++++++++++------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm index 2bac7be46..b7307e527 100644 --- a/testbot/lib/WineTestBot/PatchUtils.pm +++ b/testbot/lib/WineTestBot/PatchUtils.pm @@ -283,24 +283,12 @@ sub GetPatchImpacts($;$) if ($PastImpacts) { - if ($PastImpacts->{PatchedRoot} or $PastImpacts->{PatchedModules} or - $PastImpacts->{PatchedTests}) - { - # Update the list of Wine files so we correctly recognize patchset parts - # that modify new Wine files. - my $WineFiles = $PastImpacts->{WineFiles} || $_WineFiles; - map { $Impacts->{WineFiles}->{$_} = 1 } keys %{$WineFiles}; - map { $Impacts->{WineFiles}->{$_} = 1 } keys %{$PastImpacts->{NewFiles}}; - map { delete $Impacts->{WineFiles}->{$_} } keys %{$PastImpacts->{DeletedFiles}}; - # Modules impacted by previous parts of a patchset still need to be - # rebuilt. - $Impacts->{BuildModules} = { %{$PastImpacts->{BuildModules}} }; - } - else - { - $Impacts->{NewFiles} = $PastImpacts->{NewFiles}; - $Impacts->{DeletedFiles} = $PastImpacts->{DeletedFiles}; - } + # Update the list of Wine files so we correctly recognize patchset parts + # that modify new Wine files. + my $WineFiles = $PastImpacts->{WineFiles} || $_WineFiles; + map { $Impacts->{WineFiles}->{$_} = 1 } keys %{$WineFiles}; + map { $Impacts->{WineFiles}->{$_} = 1 } keys %{$PastImpacts->{NewFiles}}; + map { delete $Impacts->{WineFiles}->{$_} } keys %{$PastImpacts->{DeletedFiles}}; foreach my $PastInfo (values %{$PastImpacts->{Tests}}) { @@ -403,6 +391,24 @@ sub GetPatchImpacts($;$) $Impacts->{TestUnitCount} += $TestInfo->{UnitCount}; } + if ($Impacts->{PatchedRoot} or $Impacts->{PatchedModules} or + $Impacts->{PatchedTests}) + { + # Any patched area will need to be rebuilt... + $Impacts->{RebuildRoot} = $Impacts->{PatchedRoot}; + $Impacts->{RebuildModules} = $Impacts->{PatchedModules}; + + # ... even if the patch was in previous parts + if ($PastImpacts) + { + $Impacts->{Autoconf} ||= $PastImpacts->{Autoconf}; + $Impacts->{MakeMakefiles} ||= $PastImpacts->{MakeMakefiles}; + $Impacts->{RebuildRoot} ||= $PastImpacts->{PatchedRoot}; + $Impacts->{RebuildModules} ||= $PastImpacts->{PatchedModules}; + map { $Impacts->{BuildModules}->{$_} = 1 } keys %{$PastImpacts->{BuildModules}}; + } + } + return $Impacts; } @@ -419,7 +425,7 @@ sub GetBuildTimeout($$) map {$_ =~ /^exe/ ? $ExeCount++ : $WineCount++ } keys %$Builds; # Set $ModuleCount to 0 if a full rebuild is needed - my $ModuleCount = (!$Impacts or $Impacts->{PatchedRoot}) ? 0 : + my $ModuleCount = (!$Impacts or $Impacts->{RebuildRoot}) ? 0 : scalar(keys %{$Impacts->{BuildModules}}); my ($ExeTimeout, $WineTimeout) = (0, 0); -- 2.18.0