diff options
Diffstat (limited to 'tests/auto/network/socket/platformsocketengine')
3 files changed, 23 insertions, 49 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 cfd8a118ca..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() @@ -11,19 +18,16 @@ endif() qt_internal_add_test(tst_platformsocketengine SOURCES tst_platformsocketengine.cpp - 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_internal_extend_target(tst_platformsocketengine CONDITION WIN32 - PUBLIC_LIBRARIES + LIBRARIES ws2_32 ) diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 23566a3d70..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)); @@ -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()); |