This allows getting timing information on the tests.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- Use this patch instead of the previous one!
Before submitting the patch I realized that adding the LogTime column as NOT NULL may fail given that no default is specified. But I did not want to delete the LogTime column in my database to test this so I modified the script to insert a different column. But then I forgot to rename the column back to LogTime.
For the record, initially I just had "ADD LogTime ENUM('Y', 'N') NOT NULL". That does not fail but uses 'Y' as the column's default value which is incorrect (even if it does not matter much).
I bet changing the ENUM to ENUM('N', 'Y') would get me the correct default value but that feels like an implementation detail one should not rely on.
In the past this issue was dealt with by adding the column as NULL, setting a default value, and then switching to NOT NULL.
Another option is to add "DEFAULT 'N'" but that sets a default value permanently which may have unwanted interactions with the TestBot DBI code.
So in the end I settled on setting a DEFAULT and then dropping it. This should be as efficient as the NOT NULL / NULL bait and switch (the columns are set only once), but it's just two commands instead of three (and probably does not require mysql to recheck all columns to verify they conform to the new constraint).
The important part is this patch adds a LogTime column, not the Foo one! --- testbot/bin/WineRunTask.pl | 4 ++++ testbot/bin/WineRunWineTest.pl | 4 ++++ testbot/ddl/update44.sql | 8 ++++++++ testbot/ddl/winetestbot.sql | 1 + testbot/lib/WineTestBot/Steps.pm | 2 ++ testbot/web/Submit.pl | 8 +++++++- 6 files changed, 26 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..670d3bc30 --- /dev/null +++ b/testbot/ddl/update44.sql @@ -0,0 +1,8 @@ +USE winetestbot; + +ALTER TABLE Steps + ADD LogTime ENUM('Y', 'N') NULL DEFAULT 'N' + AFTER DebugLevel; + +ALTER TABLE Steps + ALTER LogTime DROP DEFAULT; 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;