[PATCH] testbot: Allow running a second, higher privilege TestAgentd.
Francois Gouget
fgouget at codeweavers.com
Tue Mar 27 18:44:05 CDT 2018
By convention it shall run on $AgentPort+1.
This makes it possible to run the tests in an unprivileged account,
while still having a TestAgentd server with high enough privileges to
adjust the VM clock.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/bin/WineRunTask.pl | 10 ++++++++--
testbot/lib/WineTestBot/VMs.pm | 8 +++++---
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 88c3b5884..4f69a1e4e 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -372,8 +372,14 @@ my $TA = $VM->GetAgent();
Debug(Elapsed($Start), " Setting the time\n");
if (!$TA->SetTime())
{
- # Not a fatal error
- LogTaskError("Unable to set the VM system time: ". $TA->GetLastError() .". Maybe the TestAgentd process is missing the required privileges.\n");
+ # Not a fatal error. Try the next port in case the VM runs a privileged
+ # TestAgentd daemon there.
+ my $PrivilegedTA = $VM->GetAgent(1);
+ if (!$PrivilegedTA->SetTime())
+ {
+ LogTaskError("Unable to set the VM system time: ". $PrivilegedTA->GetLastError() .". Maybe the TestAgentd process is missing the required privileges.\n");
+ $PrivilegedTA->Disconnect();
+ }
}
my $FileType = $Step->FileType;
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index e93208201..e74640bf2 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -208,9 +208,9 @@ sub GetDomain($)
return LibvirtDomain->new($self);
}
-sub GetAgent($)
+sub GetAgent($;$)
{
- my ($self) = @_;
+ my ($self, $Privileged) = @_;
# Use either the tunnel specified in the configuration file
# or autodetect the settings based on the VM's VirtURI setting.
@@ -226,7 +226,9 @@ sub GetAgent($)
$TunnelInfo->{sshport} = $ParsedURI->port;
$TunnelInfo->{username} = $ParsedURI->userinfo;
}
- return TestAgent->new($self->Hostname, $AgentPort, $TunnelInfo);
+ my $Port = $AgentPort;
+ $Port++ if ($Privileged);
+ return TestAgent->new($self->Hostname, $Port, $TunnelInfo);
}
sub Status($;$)
--
2.16.2
More information about the wine-devel
mailing list