Module: tools Branch: master Commit: 9b0894ed386f24a5e415f96f8f6fe9437e550788 URL: https://source.winehq.org/git/tools.git/?a=commit;h=9b0894ed386f24a5e415f96f...
Author: Francois Gouget fgouget@codeweavers.com Date: Thu Jun 16 18:28:05 2022 +0200
testbot/Engine: Also handle notifications originating from the Engine.
In particular notifications of job status changes must be processed in order for the result emails to be sent and for the patch status to be updated.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/bin/Engine.pl | 2 +- testbot/lib/WineTestBot/Engine/Notify.pm | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index 29dce183..9d836529 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -751,7 +751,7 @@ sub main() $SIG{CHLD} = &REAPER; WineTestBot::Log::SetupRedirects();
- $WineTestBot::Engine::Notify::RunningInEngine = 1; + SetNotificationHandler(&HandleClientCmd); LogMsg "Starting the WineTestBot Engine\n";
# Validate and adjust the configuration options diff --git a/testbot/lib/WineTestBot/Engine/Notify.pm b/testbot/lib/WineTestBot/Engine/Notify.pm index 9c180298..78ece067 100644 --- a/testbot/lib/WineTestBot/Engine/Notify.pm +++ b/testbot/lib/WineTestBot/Engine/Notify.pm @@ -2,6 +2,7 @@ # Notification of WineTestBot engine # # Copyright 2009 Ge van Geldorp +# Copyright 2012-2022 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,8 +30,8 @@ WineTestBot::Engine::Notify - Engine notification
use Exporter 'import'; our $RunningInEngine; -our @EXPORT = qw(Shutdown PingEngine JobStatusChange JobControl - RescheduleJobs VMStatusChange +our @EXPORT = qw(SetNotificationHandler Shutdown PingEngine JobStatusChange + JobControl RescheduleJobs VMStatusChange WinePatchMLSubmission WinePatchWebSubmission UpdateFailure GetScreenshot); our @EXPORT_OK = qw($RunningInEngine); @@ -38,14 +39,21 @@ our @EXPORT_OK = qw($RunningInEngine); use Socket; use WineTestBot::Config;
+my $_CmdHandler; + +sub SetNotificationHandler($) +{ + my ($Handler) = @_; + $_CmdHandler = $Handler; +}
sub SendCmdReceiveReply($) { my ($Cmd) = @_;
- if (defined($RunningInEngine)) + if ($_CmdHandler) { - return "1"; + return &$_CmdHandler(split ' ', $Cmd); }
if (! socket(SOCK, PF_UNIX, SOCK_STREAM, 0))