diff --git a/test/integration/tests/scripting.cpp b/test/integration/tests/scripting.cpp index b58c6ba4..211c631d 100644 --- a/test/integration/tests/scripting.cpp +++ b/test/integration/tests/scripting.cpp @@ -180,18 +180,26 @@ TEST_F(ZNCTest, ModpythonUnixSocket) { class socktest(znc.Module): def OnLoad(self, args, ret): listen = self.CreateSocket(lis) - return listen.Listen(addrtype='unix', path=self.GetSavePath() + "/sock") + return listen.Listen(addrtype='unix', path=self.TestSockPath()) def OnModCommand(self, cmd): sock = self.CreateSocket() - sock.ConnectUnix(self.GetSavePath() + "/sock") + sock.ConnectUnix(self.TestSockPath()) sock.WriteBytes(b'blah') + + def TestSockPath(self): + path = self.GetSavePath() + "/sock" + # https://unix.stackexchange.com/questions/367008/why-is-socket-path-length-limited-to-a-hundred-chars + if len(path) < 100: + return path + return "./testsock.modpython" )"); auto ircd = ConnectIRCd(); auto client = LoginClient(); client.Write("znc loadmod modpython"); client.Write("znc loadmod socktest"); + client.ReadUntil("Loaded module socktest"); client.Write("PRIVMSG *socktest :foo"); client.ReadUntil("received 4 bytes"); } @@ -227,14 +235,23 @@ TEST_F(ZNCTest, ModperlUnixSocket) { sub OnLoad { my $self = shift; my $listen = $self->CreateSocket('socktest::lis'); - $listen->Listen(addrtype=>'unix', path=>$self->GetSavePath . "/sock"); + $listen->Listen(addrtype=>'unix', path=>$self->TestSockPath); } sub OnModCommand { my ($self, $cmd) = @_; my $sock = $self->CreateSocket('socktest::conn'); - $sock->ConnectUnix($self->GetSavePath . "/sock"); + $sock->ConnectUnix($self->TestSockPath); $sock->Write('blah'); } + sub TestSockPath { + my $self = shift; + my $path = $self->GetSavePath . "/sock"; + # https://unix.stackexchange.com/questions/367008/why-is-socket-path-length-limited-to-a-hundred-chars + if (length($path) < 100) { + return $path; + } + return "./testsock.modperl"; + } 1; )"); @@ -243,7 +260,7 @@ TEST_F(ZNCTest, ModperlUnixSocket) { auto client = LoginClient(); client.Write("znc loadmod modperl"); client.Write("znc loadmod socktest"); - sleep(1); + client.ReadUntil("Loaded module socktest"); client.Write("PRIVMSG *socktest :foo"); client.ReadUntil("received 4 bytes"); } diff --git a/third_party/Csocket b/third_party/Csocket index 13473b0f..c9fb2e11 160000 --- a/third_party/Csocket +++ b/third_party/Csocket @@ -1 +1 @@ -Subproject commit 13473b0f97c9a23909634eb2364cd40c54a8d5ce +Subproject commit c9fb2e110bff29450a4c2a710c69b5a66701466e