diff --git a/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST b/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST deleted file mode 100644 index e23fe96ba30..00000000000 --- a/tests/auto/corelib/kernel/qsocketnotifier/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[unexpectedDisconnection] -macos ci # QTBUG-115154 diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index 2e7d1767fde..641b74bd9f0 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -132,11 +132,11 @@ public slots: ++sequence; if (sequence == 1) { // read from both ends - (void) readEnd1->read(data1, sizeof(data1)); - (void) readEnd2->read(data2, sizeof(data2)); + QCOMPARE(readEnd1->read(data1, sizeof(data1)), 1); + QCOMPARE(readEnd2->read(data2, sizeof(data2)), 1); emit finished(); } else if (sequence == 2) { - // we should never get here + // check that we can't read now because we've read our byte QCOMPARE(readEnd2->read(data2, sizeof(data2)), qint64(-2)); QVERIFY(readEnd2->isValid()); } @@ -152,7 +152,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() Given two sockets and two QSocketNotifiers registered on each their socket. If both sockets receive data, and the first slot invoked by one of the socket notifiers empties both sockets, the - other notifier will also emit activated(). This results in + other notifier will also emit activated(). This was causing an unexpected disconnection in QAbstractSocket. The use case is that somebody calls one of the @@ -188,8 +188,9 @@ void tst_QSocketNotifier::unexpectedDisconnection() writeEnd1->waitForBytesWritten(); writeEnd2->waitForBytesWritten(); - writeEnd1->flush(); - writeEnd2->flush(); + // ensure both read ends are ready for reading, before the event loop + QVERIFY(readEnd1.waitForRead(5000)); + QVERIFY(readEnd2.waitForRead(5000)); UnexpectedDisconnectTester tester(&readEnd1, &readEnd2);