CI: Add docker support for tst_qiodevice test
Currently test relies solely for external test server. This makes it not possible to run test successfully with environment where docker is used. Pick-to: 6.2 6.3 Change-Id: Idf7e99c19ab630065b651f2f6d957311f45f0db7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
f00e332d39
commit
fe93a5f42d
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qiodevice
|
|||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
Qt::Network
|
Qt::Network
|
||||||
TESTDATA ${test_data}
|
TESTDATA ${test_data}
|
||||||
|
QT_TEST_SERVER_LIST "apache2" "cyrus"
|
||||||
)
|
)
|
||||||
|
@ -104,15 +104,20 @@ void tst_QIODevice::getSetCheck()
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
void tst_QIODevice::constructing_QTcpSocket()
|
void tst_QIODevice::constructing_QTcpSocket()
|
||||||
{
|
{
|
||||||
|
#ifdef QT_TEST_SERVER
|
||||||
|
if (!QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143))
|
||||||
|
QSKIP("No network test server available");
|
||||||
|
#else
|
||||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||||
QSKIP("No network test server available");
|
QSKIP("No network test server available");
|
||||||
|
#endif
|
||||||
|
|
||||||
QTcpSocket socket;
|
QTcpSocket socket;
|
||||||
QIODevice *device = &socket;
|
QIODevice *device = &socket;
|
||||||
|
|
||||||
QVERIFY(!device->isOpen());
|
QVERIFY(!device->isOpen());
|
||||||
|
|
||||||
socket.connectToHost(QtNetworkSettings::serverName(), 143);
|
socket.connectToHost(QtNetworkSettings::imapServerName(), 143);
|
||||||
QVERIFY(socket.waitForConnected(30000));
|
QVERIFY(socket.waitForConnected(30000));
|
||||||
QVERIFY(device->isOpen());
|
QVERIFY(device->isOpen());
|
||||||
QCOMPARE(device->readChannelCount(), 1);
|
QCOMPARE(device->readChannelCount(), 1);
|
||||||
@ -130,7 +135,7 @@ void tst_QIODevice::constructing_QTcpSocket()
|
|||||||
socket.close();
|
socket.close();
|
||||||
QCOMPARE(socket.readChannelCount(), 0);
|
QCOMPARE(socket.readChannelCount(), 0);
|
||||||
QCOMPARE(socket.writeChannelCount(), 0);
|
QCOMPARE(socket.writeChannelCount(), 0);
|
||||||
socket.connectToHost(QtNetworkSettings::serverName(), 143);
|
socket.connectToHost(QtNetworkSettings::imapServerName(), 143);
|
||||||
QVERIFY(socket.waitForConnected(30000));
|
QVERIFY(socket.waitForConnected(30000));
|
||||||
QVERIFY(device->isOpen());
|
QVERIFY(device->isOpen());
|
||||||
|
|
||||||
@ -270,9 +275,14 @@ void tst_QIODevice::unget()
|
|||||||
result = QByteArray("ZXCV");
|
result = QByteArray("ZXCV");
|
||||||
lineResult = "ZXCV";
|
lineResult = "ZXCV";
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef QT_TEST_SERVER
|
||||||
|
if (!QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80))
|
||||||
|
QSKIP("No network test server available");
|
||||||
|
#else
|
||||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||||
QSKIP("No network test server available");
|
QSKIP("No network test server available");
|
||||||
socket.connectToHost(QtNetworkSettings::serverName(), 80);
|
#endif
|
||||||
|
socket.connectToHost(QtNetworkSettings::httpServerName(), 80);
|
||||||
socket.write("GET / HTTP/1.0\r\n\r\n");
|
socket.write("GET / HTTP/1.0\r\n\r\n");
|
||||||
QVERIFY(socket.waitForReadyRead());
|
QVERIFY(socket.waitForReadyRead());
|
||||||
dev = &socket;
|
dev = &socket;
|
||||||
|
Loading…
Reference in New Issue
Block a user