Ignore or suppress warning and debug messages in tst_QLocalSocket
The one in tst_QLocalSocket::writeToClientAndDisconnect just needed proper ordering: that's what waitForDisconnect is for. At the same time, we need to make sure we get the same message from all three implementations of QLocalSocket::waitForDisconnect (and without the useless space at the end). Change-Id: I21364263cf908df022df814a6a39fcb5783e84e6 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This commit is contained in:
parent
674e79416f
commit
bfc5bb09c4
@ -424,7 +424,7 @@ bool QLocalSocket::waitForDisconnected(int msecs)
|
||||
{
|
||||
Q_D(QLocalSocket);
|
||||
if (state() == UnconnectedState) {
|
||||
qWarning() << "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState";
|
||||
qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
return false;
|
||||
}
|
||||
return (d->tcpSocket->waitForDisconnected(msecs));
|
||||
|
@ -560,7 +560,7 @@ bool QLocalSocket::waitForDisconnected(int msecs)
|
||||
{
|
||||
Q_D(QLocalSocket);
|
||||
if (state() == UnconnectedState) {
|
||||
qWarning() << "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState";
|
||||
qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
return false;
|
||||
}
|
||||
return (d->unixSocket.waitForDisconnected(msecs));
|
||||
|
@ -378,8 +378,10 @@ bool QLocalSocket::waitForConnected(int msecs)
|
||||
bool QLocalSocket::waitForDisconnected(int msecs)
|
||||
{
|
||||
Q_D(QLocalSocket);
|
||||
if (state() == UnconnectedState)
|
||||
if (state() == UnconnectedState) {
|
||||
qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
return false;
|
||||
}
|
||||
if (!openMode().testFlag(QIODevice::ReadOnly)) {
|
||||
qWarning("QLocalSocket::waitForDisconnected isn't supported for write only pipes.");
|
||||
return false;
|
||||
|
@ -270,6 +270,7 @@ void tst_QLocalSocket::socket_basic()
|
||||
//QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE(socket.state(), QLocalSocket::UnconnectedState);
|
||||
QCOMPARE(socket.waitForConnected(0), false);
|
||||
QTest::ignoreMessage(QtWarningMsg, "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
QCOMPARE(socket.waitForDisconnected(0), false);
|
||||
QCOMPARE(socket.waitForReadyRead(0), false);
|
||||
|
||||
@ -313,6 +314,7 @@ void tst_QLocalSocket::listen()
|
||||
QVERIFY(server.errorString().isEmpty());
|
||||
QCOMPARE(server.serverError(), QAbstractSocket::UnknownSocketError);
|
||||
// already isListening
|
||||
QTest::ignoreMessage(QtWarningMsg, "QLocalServer::listen() called when already listening");
|
||||
QVERIFY(!server.listen(name));
|
||||
} else {
|
||||
QVERIFY(!server.errorString().isEmpty());
|
||||
@ -1015,15 +1017,16 @@ void tst_QLocalSocket::writeToClientAndDisconnect()
|
||||
clientSocket->close();
|
||||
server.close();
|
||||
|
||||
QTRY_COMPARE(readChannelFinishedSpy.count(), 1);
|
||||
QCOMPARE(client.read(buffer, sizeof(buffer)), (qint64)sizeof(buffer));
|
||||
client.waitForDisconnected();
|
||||
QCOMPARE(readChannelFinishedSpy.count(), 1);
|
||||
QCOMPARE(client.read(buffer, sizeof(buffer)), (qint64)sizeof(buffer));
|
||||
QCOMPARE(client.state(), QLocalSocket::UnconnectedState);
|
||||
}
|
||||
|
||||
void tst_QLocalSocket::debug()
|
||||
{
|
||||
// Make sure this compiles
|
||||
QTest::ignoreMessage(QtDebugMsg, "QLocalSocket::ConnectionRefusedError QLocalSocket::UnconnectedState ");
|
||||
qDebug() << QLocalSocket::ConnectionRefusedError << QLocalSocket::UnconnectedState;
|
||||
}
|
||||
|
||||
@ -1155,7 +1158,7 @@ void tst_QLocalSocket::verifyListenWithDescriptor()
|
||||
QFETCH(bool, abstract);
|
||||
QFETCH(bool, bound);
|
||||
|
||||
qDebug() << "socket" << path << abstract;
|
||||
// qDebug() << "socket" << path << abstract;
|
||||
|
||||
int listenSocket;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user