Francois Gouget : testbot: Rerun all of a module' s test units when a non-C file is modified.
Alexandre Julliard
julliard at winehq.org
Mon Apr 3 07:15:21 CDT 2017
Module: tools
Branch: master
Commit: 83dc05b3eb3244bd6de4ce41d46834ccd73f2edf
URL: http://source.winehq.org/git/tools.git/?a=commit;h=83dc05b3eb3244bd6de4ce41d46834ccd73f2edf
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Mon Apr 3 01:50:23 2017 +0200
testbot: Rerun all of a module's test units when a non-C file is modified.
This typically happens when a resource file is modified or a test unit
is deleted.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/bin/WineRunReconfig.pl | 12 ++++++
testbot/bin/build/Reconfig.pl | 5 +++
testbot/lib/WineTestBot/Patches.pm | 87 +++++++++++++++++++++++++++++++-------
3 files changed, 89 insertions(+), 15 deletions(-)
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 151c80f..737d26f 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -370,6 +370,18 @@ elsif (!defined $TAError)
{
$TAError = "An error occurred while retrieving the reconfig log: ". $TA->GetLastError();
}
+
+Debug(Elapsed($Start), " Retrieving the updated test list '$TaskDir/testlist.txt'\n");
+if ($TA->GetFile("testlist.txt", "$TaskDir/testlist.txt"))
+{
+ use File::Copy;
+ copy "$TaskDir/testlist.txt", "$DataDir/latest/testlist.txt";
+}
+elsif (!defined $TAError)
+{
+ $TAError = "An error occurred while retrieving the test list: ". $TA->GetLastError();
+}
+
$TA->Disconnect();
# Report the reconfig errors even though they may have been caused by
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl
index 81a487f..ec7f05f 100755
--- a/testbot/bin/build/Reconfig.pl
+++ b/testbot/bin/build/Reconfig.pl
@@ -67,6 +67,11 @@ sub GitPull()
return !1;
}
+ system("( cd $DataDir/wine && ".
+ " ls dlls/*/tests/*.c programs/*/tests/*.c | ".
+ " egrep -v '/testlist.c\$' >../testlist.txt ".
+ ") >>$LogDir/Reconfig.log 2>&1");
+
return 1;
}
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 48f2156..d7987d6 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -103,6 +103,37 @@ sub FromSubmission($$)
$self->Disposition("Processing");
}
+
+=pod
+=over 12
+
+=item C<GetTestList()>
+
+Returns a hashtable containing the list of the source files for a given module.
+This structure is built from the latest/testlist.txt file.
+
+=back
+=cut
+
+sub GetTestList()
+{
+ my $TestList = {};
+ if (open(my $File, "<", "$DataDir/latest/testlist.txt"))
+ {
+ while (my $TestFileName = <$File>)
+ {
+ chomp $TestFileName;
+ if ($TestFileName =~ m~^(?:dlls|programs)/([^/]+)/tests/[^/]+\.c$~)
+ {
+ my $Module = $1;
+ push @{$TestList->{$Module}}, $TestFileName;
+ }
+ }
+ close($File);
+ }
+ return $TestList;
+}
+
=pod
=over 12
@@ -126,28 +157,29 @@ sub Submit($$$)
my ($self, $PatchFileName, $IsSet) = @_;
# See also OnSubmit() in web/Submit.pl
- my %Modules;
+ my (%Modules, %Deleted);
if (open(BODY, "<$DataDir/patches/" . $self->Id))
{
- my $Line;
+ my ($Line, $Modified);
while (defined($Line = <BODY>))
{
- if ($Line =~ m~^\+\+\+ .*/(dlls|programs)/([^/]+)/tests/([^/\s]+)~)
+ if ($Line =~ m~^\-\-\- .*/((?:dlls|programs)/[^/]+/tests/[^/\s]+)~)
+ {
+ $Modified = $1;
+ }
+ elsif ($Line =~ m~^\+\+\+ .*/(dlls|programs)/([^/]+)/tests/([^/\s]+)~)
{
my ($FileType, $Module, $Unit) = ("patch$1", $2, $3);
$Unit = "" if ($Unit !~ s/\.c$//);
- if ($Unit)
- {
- if (defined($Modules{$Module}{""}))
- {
- delete($Modules{$Module}{""});
- }
- $Modules{$Module}{$Unit} = $FileType;
- }
- elsif (! defined($Modules{$Module}))
- {
- $Modules{$Module}{""} = $FileType;
- }
+ $Modules{$Module}{$Unit} = $FileType;
+ }
+ elsif ($Line =~ m~^\+\+\+ /dev/null~ and defined $Modified)
+ {
+ $Deleted{$Modified} = 1;
+ }
+ else
+ {
+ $Modified = undef;
}
}
close BODY;
@@ -175,6 +207,31 @@ sub Submit($$$)
$User = GetBatchUser();
}
+ my $TestList;
+ foreach my $Module (keys %Modules)
+ {
+ next if (!defined $Modules{$Module}{""});
+
+ # The patch modifies non-C files so rerun all that module's test units
+ $TestList = GetTestList() if (!$TestList);
+ next if (!defined $TestList->{$Module});
+
+ # If we don't find which tests to rerun then run the module test
+ # executable without argument. It probably won't work but will make the
+ # issue clearer to the developer.
+ my $FileType = $Modules{$Module}{""};
+ foreach my $TestFileName (@{$TestList->{$Module}})
+ {
+ if (!$Deleted{$TestFileName} and
+ $TestFileName =~ m~^(?:dlls|programs)/\Q$Module\E/tests/([^/]+)\.c$~)
+ {
+ my $Unit = $1;
+ $Modules{$Module}{$Unit} = $FileType;
+ delete $Modules{$Module}{""};
+ }
+ }
+ }
+
my $Disposition = "Submitted job ";
my $First = 1;
foreach my $Module (keys %Modules)
More information about the wine-cvs
mailing list