tst_qnetworkreply_local: shorten the local socket names

It seems to be failing with some test cases on some Linux systems.
It doesn't actually fail to listen on the server-side, but it seems the
client-side socket instead fails to connect.

Instead of using the full test case names and process id, hash it
together and use the HEX of that instead for the local socket
identifier.

Change in 6.10 cherry-pick:
 - Resolved conflict due to 0b3d7b9e60
   not being cherry-picked.

Pick-to: 6.8
Change-Id: Ibcd0f6af29652d68470596efe84fba954cda57ce
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ea5471e3b8)
(cherry picked from commit eb9abd562b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2025-08-01 16:38:56 +02:00 committed by Qt Cherry-pick Bot
parent 5bed983af1
commit 6400e30481
1 changed files with 3 additions and 2 deletions

View File

@ -49,9 +49,10 @@ static std::unique_ptr<MiniHttpServerV2> getServerForCurrentScheme()
if (scheme.startsWith("unix"_L1) || scheme.startsWith("local"_L1)) {
#if QT_CONFIG(localserver)
QLocalServer *localServer = new QLocalServer(server.get());
const size_t hash = qHashMulti(0, QByteArrayView(QTest::currentTestFunction()),
QCoreApplication::applicationPid());
localServer->listen(u"qt_networkreply_test_"_s
% QLatin1StringView(QTest::currentTestFunction())
% QString::number(QCoreApplication::applicationPid()));
% QString::number(hash, 16));
server->bind(localServer);
#endif
} else if (scheme == "http") {