[PATCH] testbot: Add helpers to build and sanitize the WineTest tag.
Francois Gouget
fgouget at codeweavers.com
Wed Aug 22 03:17:15 CDT 2018
Also fix the sanitation: WineTest allows dots and dashes in the tag.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/bin/WineRunTask.pl | 16 ++++++----------
testbot/bin/WineRunWineTest.pl | 6 ++----
testbot/bin/build/WineTest.pl | 3 ++-
testbot/lib/WineTestBot/Utils.pm | 24 +++++++++++++++++++++++-
4 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 27dd8e7b3..c602979b1 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -41,11 +41,12 @@ $Name0 =~ s+^.*/++;
use WineTestBot::Config;
+use WineTestBot::Engine::Notify;
use WineTestBot::Jobs;
-use WineTestBot::VMs;
use WineTestBot::Log;
use WineTestBot::LogUtils;
-use WineTestBot::Engine::Notify;
+use WineTestBot::Utils;
+use WineTestBot::VMs;
#
@@ -455,18 +456,13 @@ elsif ($Step->Type eq "suite")
{
$Keepalive = 60;
$Script .= "$FileName ";
- my $Tag = lc($VM->Name);
- $Tag =~ s/^$TagPrefix//;
- $Tag =~ s/[^a-zA-Z0-9]/-/g;
- if ($VM->Type eq "win64")
- {
- $Tag .= "-" . ($Step->FileType eq "exe64" ? "64" : "32");
- }
if (defined($WebHostName))
{
my $StepTask = 100 * $StepNo + $TaskNo;
$Script .= "-u \"http://$WebHostName/JobDetails.pl?Key=$JobId&s$StepTask=1#k$StepTask\" ";
}
+ my $Tag = $VM->Type ne "win64" ? "" : $Step->FileType eq "exe64" ? "64" : "32";
+ $Tag = BuildTag($VM->Name, $Tag);
my $Info = $VM->Description ? $VM->Description : "";
if ($VM->Details)
{
@@ -481,7 +477,7 @@ elsif ($Step->Type eq "suite")
$Info =~ s/"/\\"/g;
$Info =~ s/%/%%/g;
$Info =~ s/%/%%/g;
- $Script .= "-q -o $RptFileName -t $TagPrefix-$Tag -m \"$EMail\" -i \"$Info\"\r\n".
+ $Script .= "-q -o $RptFileName -t $Tag -m \"$EMail\" -i \"$Info\"\r\n".
"$FileName -q -s $RptFileName\r\n";
}
Debug(Elapsed($Start), " Sending the script: [$Script]\n");
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index ac5594654..216811116 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -425,10 +425,8 @@ my $Script = "#!/bin/sh\n".
" ../bin/build/WineTest.pl ";
if ($Step->Type eq "suite")
{
- my $Tag = lc($VM->Name);
- $Tag =~ s/^$TagPrefix//;
- $Tag =~ s/[^a-zA-Z0-9]/-/g;
- $Script .= "--winetest ". $Task->CmdLineArg ." $TagPrefix-$Tag ";
+ my $BaseTag = BuildTag($VM->Name);
+ $Script .= "--winetest ". $Task->CmdLineArg ." $BaseTag ";
if (defined $WebHostName)
{
my $StepTask = 100 * $StepNo + $TaskNo;
diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl
index 3310b4c53..b29440e21 100755
--- a/testbot/bin/build/WineTest.pl
+++ b/testbot/bin/build/WineTest.pl
@@ -181,8 +181,9 @@ sub DailyWineTest($$$$$)
# Run WineTest. Ignore the exit code since it returns non-zero whenever
# there are test failures.
+ my $Tag = SanitizeTag("$BaseTag-$Build");
RunWine($Build, "./programs/winetest/winetest.exe.so",
- "-c -o '../$Build.report' -t $BaseTag-$Build ". ShArgv2Cmd(@$Args));
+ "-c -o '../$Build.report' -t $Tag ". ShArgv2Cmd(@$Args));
if (!-f "$Build.report")
{
LogMsg "WineTest did not produce a report file\n";
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index f64310b6b..6fa0ccce7 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -1,5 +1,6 @@
# -*- Mode: Perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
# Copyright 2009 Ge van Geldorp
+# Copyright 2012-2018 Francois Gouget
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -29,7 +30,7 @@ use Exporter 'import';
our @EXPORT = qw(MakeSecureURL SecureConnection GenerateRandomString
OpenNewFile CreateNewFile CreateNewLink CreateNewDir
DurationToString BuildEMailRecipient IsValidFileName
- ShQuote ShArgv2Cmd);
+ BuildTag SanitizeTag ShQuote ShArgv2Cmd);
use Fcntl;
@@ -175,6 +176,27 @@ sub CreateNewDir($$)
}
+#
+# WineTest helpers
+#
+
+sub SanitizeTag($)
+{
+ my ($Tag) = @_;
+ $Tag =~ s/[^a-zA-Z0-9.-]/-/g;
+ return substr($Tag, 0, 30);
+}
+
+sub BuildTag($;$)
+{
+ my ($VMName, $Tag) = @_;
+
+ $Tag = $Tag ? "$VMName-$Tag" : $VMName;
+ $Tag =~ s/^$TagPrefix//;
+ return SanitizeTag("$TagPrefix-$Tag");
+}
+
+
#
# Shell helpers
#
--
2.18.0
More information about the wine-devel
mailing list