File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
tests/auto/network/access/qnetworkreply_local Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11// Copyright (C) 2024 The Qt Company Ltd.
22// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
33
4+ #define QTEST_THROW_ON_FAIL
5+
46#include < QtNetwork/qtnetworkglobal.h>
57
68#include < QtTest/qtest.h>
@@ -49,14 +51,19 @@ static std::unique_ptr<MiniHttpServerV2> getServerForCurrentScheme()
4951 if (scheme.startsWith (" unix" _L1) || scheme.startsWith (" local" _L1)) {
5052#if QT_CONFIG(localserver)
5153 QLocalServer *localServer = new QLocalServer (server.get ());
52- localServer->listen (u" qt_networkreply_test_" _s
53- % QLatin1StringView (QTest::currentTestFunction ())
54- % QString::number (QCoreApplication::applicationPid ()));
54+ bool listening = localServer->listen (u" qt_networkreply_test_" _s
55+ % QLatin1StringView (QTest::currentTestFunction ())
56+ % QString::number (QCoreApplication::applicationPid ()));
57+ if (!listening) {
58+ QFAIL (qPrintable (
59+ u" Failed to listen on local server: %1" _s.arg (localServer->errorString ())));
60+ }
5561 server->bind (localServer);
5662#endif
5763 } else if (scheme == " http" ) {
5864 QTcpServer *tcpServer = new QTcpServer (server.get ());
59- tcpServer->listen (QHostAddress::LocalHost, 0 );
65+ if (!tcpServer->listen (QHostAddress::LocalHost, 0 ))
66+ QFAIL (qPrintable (u" Failed to listen on TCP port: %1" _s.arg (tcpServer->errorString ())));
6067 server->bind (tcpServer);
6168 }
6269 return server;
You can’t perform that action at this time.
0 commit comments