[tools 2/2] testbot: Add support for running the tests with WINETEST_TIME.

Francois Gouget fgouget at codeweavers.com
Thu Mar 11 08:02:41 CST 2021


This allows getting timing information on the tests.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
Note that this patch requires updating the database by applying 
testbot/update44.sql. This also requires restarting the TestBot Engine 
and web server.
---
 testbot/bin/WineRunTask.pl       |  4 ++++
 testbot/bin/WineRunWineTest.pl   |  4 ++++
 testbot/ddl/update44.sql         | 10 ++++++++++
 testbot/ddl/winetestbot.sql      |  1 +
 testbot/lib/WineTestBot/Steps.pm |  2 ++
 testbot/web/Submit.pl            |  8 +++++++-
 6 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 testbot/ddl/update44.sql

diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 6056806f3..36b3e68f0 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -425,6 +425,10 @@ my $Keepalive;
 my $Timeout = $Task->Timeout;
 my $Script = "set WINETEST_DEBUG=" . $Step->DebugLevel .
              "\r\n";
+if ($Step->LogTime)
+{
+  $Script .= "set WINETEST_TIME=1\r\n";
+}
 if ($Step->ReportSuccessfulTests)
 {
   $Script .= "set WINETEST_REPORT_SUCCESS=1\r\n";
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index 7892bca74..94757bf62 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -422,6 +422,10 @@ if (defined $FileName)
 my $Script = "#!/bin/sh\n".
              "( set -x\n".
              "  export WINETEST_DEBUG=". $Step->DebugLevel ."\n";
+if ($Step->LogTime)
+{
+  $Script .= "  export WINETEST_TIME=1\n";
+}
 if ($Step->ReportSuccessfulTests)
 {
   $Script .= "  export WINETEST_REPORT_SUCCESS=1\n";
diff --git a/testbot/ddl/update44.sql b/testbot/ddl/update44.sql
new file mode 100644
index 000000000..1bcbdc422
--- /dev/null
+++ b/testbot/ddl/update44.sql
@@ -0,0 +1,10 @@
+USE winetestbot;
+
+ALTER TABLE Steps
+  ADD Foo ENUM('Y', 'N') NULL
+      AFTER DebugLevel;
+
+UPDATE Steps SET Foo = 'N';
+
+ALTER TABLE Steps
+  MODIFY Foo ENUM('Y', 'N') NOT NULL;
diff --git a/testbot/ddl/winetestbot.sql b/testbot/ddl/winetestbot.sql
index 533941dd6..1794b2508 100644
--- a/testbot/ddl/winetestbot.sql
+++ b/testbot/ddl/winetestbot.sql
@@ -138,6 +138,7 @@ CREATE TABLE Steps
   FileName              VARCHAR(100) NULL,
   FileType              ENUM('none', 'exe32', 'exe64', 'patch') NOT NULL,
   DebugLevel            INT(2) NOT NULL,
+  LogTime               ENUM('Y', 'N') NOT NULL,
   ReportSuccessfulTests ENUM('Y', 'N') NOT NULL,
   PRIMARY KEY (JobId, No),
   FOREIGN KEY (JobId) REFERENCES Jobs(Id),
diff --git a/testbot/lib/WineTestBot/Steps.pm b/testbot/lib/WineTestBot/Steps.pm
index 094337569..921077b48 100644
--- a/testbot/lib/WineTestBot/Steps.pm
+++ b/testbot/lib/WineTestBot/Steps.pm
@@ -91,6 +91,7 @@ sub InitializeNew($$)
   $self->Type("single");
   $self->FileType("none");
   $self->DebugLevel(1);
+  $self->LogTime(!1);
   $self->ReportSuccessfulTests(!1);
 
   $self->SUPER::InitializeNew($Collection);
@@ -240,6 +241,7 @@ my @PropertyDescriptors = (
   CreateBasicPropertyDescriptor("FileName", "File",  !1, !1, "A", 100),
   CreateEnumPropertyDescriptor("FileType", "File type",  !1,  1, ['none', 'exe32', 'exe64', 'patch']),
   CreateBasicPropertyDescriptor("DebugLevel", "Debug level (WINETEST_DEBUG)", !1, 1, "N", 2),
+  CreateBasicPropertyDescriptor("LogTime", "Timestamp traces (WINETEST_TIME)", !1, 1, "B", 1),
   CreateBasicPropertyDescriptor("ReportSuccessfulTests", "Report successful tests (WINETEST_REPORT_SUCCESS)", !1, 1, "B", 1),
   CreateDetailrefPropertyDescriptor("Tasks", "Tasks", !1, !1, \&CreateTasks),
 );
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index 5e9a61e7c..68978f089 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -519,7 +519,8 @@ sub _initialize($$$)
 
   # Load the Page 3 parameters
   $self->_GetParams("TestExecutable", "CmdLineArg", "NoCmdLineArgWarn",
-                    "Run32", "Run64", "DebugLevel", "ReportSuccessfulTests");
+                    "Run32", "Run64", "DebugLevel", "LogTime",
+                    "ReportSuccessfulTests");
   $self->{DebugLevel} = 1 if (!defined $self->{DebugLevel});
 
   # Load the Page 4 parameters
@@ -585,6 +586,7 @@ sub _GenerateStateFields($)
     $self->_GenerateStateField("Run32");
     $self->_GenerateStateField("Run64");
     $self->_GenerateStateField("DebugLevel");
+    $self->_GenerateStateField("LogTime");
     $self->_GenerateStateField("ReportSuccessfulTests");
   }
 }
@@ -698,6 +700,7 @@ sub GetPropertyDescriptors($)
       CreateBasicPropertyDescriptor("Run32", "Run the 32 bit tests on Windows", !1, 1, "B", 1),
       CreateBasicPropertyDescriptor("Run64", "Run the 64 bit tests on Windows", !1, 1, "B", 1),
       CreateBasicPropertyDescriptor("DebugLevel", "Debug level (WINETEST_DEBUG)", !1, 1, "N", 2),
+      CreateBasicPropertyDescriptor("LogTime", "Timestamp traces (WINETEST_TIME)", !1, 1, "B", 1),
       CreateBasicPropertyDescriptor("ReportSuccessfulTests", "Report successful tests (WINETEST_REPORT_SUCCESS)", !1, 1, "B", 1);
   }
 
@@ -1068,6 +1071,7 @@ sub OnPage3Prev($)
   # Set to 0 instead of undef to record the user preference
   $self->{Run32} ||= 0;
   $self->{Run64} ||= 0;
+  $self->{LogTime} ||= 0;
   $self->{ReportSuccessfulTests} ||= 0;
 
   $self->_SetPage(2);
@@ -1195,6 +1199,7 @@ sub _SubmitJob($$)
       $TestStep->FileType("exe$Bits");
       $TestStep->Type("single");
       $TestStep->DebugLevel($self->{DebugLevel});
+      $TestStep->LogTime(defined $self->{LogTime});
       $TestStep->ReportSuccessfulTests(defined $self->{ReportSuccessfulTests});
       my $Tasks = $TestStep->Tasks;
 
@@ -1218,6 +1223,7 @@ sub _SubmitJob($$)
     $WineStep->FileType($self->{FileType});
     $WineStep->Type("single");
     $WineStep->DebugLevel($self->{DebugLevel});
+    $WineStep->LogTime(defined $self->{LogTime});
     $WineStep->ReportSuccessfulTests(defined $self->{ReportSuccessfulTests});
     my $Tasks = $WineStep->Tasks;
 
-- 
2.20.1



More information about the wine-devel mailing list