diff options
Diffstat (limited to 'tests/auto/network/socket/platformsocketengine')
5 files changed, 28 insertions, 75 deletions
diff --git a/tests/auto/network/socket/platformsocketengine/BLACKLIST b/tests/auto/network/socket/platformsocketengine/BLACKLIST index f1f88d26d1..796f81a02a 100644 --- a/tests/auto/network/socket/platformsocketengine/BLACKLIST +++ b/tests/auto/network/socket/platformsocketengine/BLACKLIST @@ -1,11 +1,2 @@ [tcpLoopbackPerformance] -windows-10 msvc-2015 -windows-7sp1 -[receiveUrgentData] -windows-10 msvc-2015 -windows-7sp1 -[serverTest] -windows-10 msvc-2015 -windows-7sp1 -[tcpLoopbackPerformance] windows diff --git a/tests/auto/network/socket/platformsocketengine/CMakeLists.txt b/tests/auto/network/socket/platformsocketengine/CMakeLists.txt index 780826f211..891041df04 100644 --- a/tests/auto/network/socket/platformsocketengine/CMakeLists.txt +++ b/tests/auto/network/socket/platformsocketengine/CMakeLists.txt @@ -1,4 +1,11 @@ -# Generated from platformsocketengine.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_platformsocketengine LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() if(NOT QT_FEATURE_private_tests) return() @@ -8,24 +15,19 @@ endif() ## tst_platformsocketengine Test: ##################################################################### -qt_add_test(tst_platformsocketengine +qt_internal_add_test(tst_platformsocketengine SOURCES tst_platformsocketengine.cpp - INCLUDE_DIRECTORIES - ${QT_SOURCE_TREE}/src/network - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::NetworkPrivate + QT_TEST_SERVER_LIST "cyrus" ) -#### Keys ignored in scope 1:.:.:platformsocketengine.pro:<TRUE>: -# MOC_DIR = "tmp" -# _REQUIREMENTS = "qtConfig(private_tests)" - ## Scopes: ##################################################################### -qt_extend_target(tst_platformsocketengine CONDITION WIN32 - PUBLIC_LIBRARIES +qt_internal_extend_target(tst_platformsocketengine CONDITION WIN32 + LIBRARIES ws2_32 ) diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri deleted file mode 100644 index 1b304bfc69..0000000000 --- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri +++ /dev/null @@ -1,8 +0,0 @@ -QT += network - -QNETWORK_SRC = $$QT_SOURCE_TREE/src/network - -INCLUDEPATH += $$QNETWORK_SRC - -win32: QMAKE_USE += ws2_32 - diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro deleted file mode 100644 index ab96bb444e..0000000000 --- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG += testcase -TARGET = tst_platformsocketengine -SOURCES += tst_platformsocketengine.cpp - -include(../platformsocketengine/platformsocketengine.pri) - -requires(qtConfig(private_tests)) - -MOC_DIR=tmp - -QT = core-private network-private testlib diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 88a39eea93..1f6ecf9200 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -1,31 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QTest> @@ -48,7 +23,7 @@ #define PLATFORMSOCKETENGINE QNativeSocketEngine #define PLATFORMSOCKETENGINESTRING "QNativeSocketEngine" -#include <private/qnativesocketengine_p.h> +#include <private/qnativesocketengine_p_p.h> #include <qstringlist.h> @@ -81,8 +56,12 @@ private slots: void tst_PlatformSocketEngine::initTestCase() { +#ifdef QT_TEST_SERVER + QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); +#else if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); +#endif } //--------------------------------------------------------------------------- @@ -122,14 +101,14 @@ void tst_PlatformSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState); - const bool isConnected = socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); + const bool isConnected = socketDevice.connectToHost(QtNetworkSettings::imapServerIp(), 143); if (!isConnected) { QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); } QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectedState); - QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::serverIP()); + QCOMPARE(socketDevice.peerAddress(), QtNetworkSettings::imapServerIp()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -276,7 +255,7 @@ void tst_PlatformSocketEngine::broadcastTest() PLATFORMSOCKETENGINE broadcastSocket; // Initialize a regular Udp socket - QVERIFY(broadcastSocket.initialize(QAbstractSocket::UdpSocket, QAbstractSocket::AnyIPProtocol)); + QVERIFY(broadcastSocket.initialize(QAbstractSocket::UdpSocket, QAbstractSocket::IPv4Protocol)); // Bind to any port on all interfaces QVERIFY(broadcastSocket.bind(QHostAddress::Any, 0)); @@ -324,7 +303,7 @@ void tst_PlatformSocketEngine::serverTest() quint16 port = server.localPort(); // Listen for incoming connections - QVERIFY(server.listen()); + QVERIFY(server.listen(50)); QCOMPARE(server.state(), QAbstractSocket::ListeningState); // Initialize a Tcp socket @@ -429,7 +408,7 @@ void tst_PlatformSocketEngine::tcpLoopbackPerformance() quint16 port = server.localPort(); // Listen for incoming connections - QVERIFY(server.listen()); + QVERIFY(server.listen(50)); QCOMPARE(server.state(), QAbstractSocket::ListeningState); // Initialize a Tcp socket @@ -567,7 +546,7 @@ void tst_PlatformSocketEngine::networkError() QVERIFY(client.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); - const bool isConnected = client.connectToHost(QtNetworkSettings::serverIP(), 143); + const bool isConnected = client.connectToHost(QtNetworkSettings::imapServerIp(), 143); if (!isConnected) { QCOMPARE(client.state(), QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); @@ -620,7 +599,7 @@ void tst_PlatformSocketEngine::receiveUrgentData() QCOMPARE(server.state(), QAbstractSocket::BoundState); quint16 port = server.localPort(); - QVERIFY(server.listen()); + QVERIFY(server.listen(50)); QCOMPARE(server.state(), QAbstractSocket::ListeningState); PLATFORMSOCKETENGINE client; |