summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-01-04 16:32:57 +0000
committerDenis Shienkov <denis.shienkov@gmail.com>2015-01-15 13:32:36 +0100
commitff03e5aa0ccdd2060aa2a8f1a5b55234c09bb3d0 (patch)
tree1bdd01995e4d3a3cb615c339af5310a3f3c0f921
parent96d79d314c004afa2d84d4a32fd019d2d4770799 (diff)
downloadqtserialport-ff03e5aa0ccdd2060aa2a8f1a5b55234c09bb3d0.tar.gz
Share the clearReceiver() function and for the *nix tests
The waitForReadyReadWithTimeout() test is failed when using the socat utility. The reason is that the receiver's side receive data from the previous waitForBytesWritten() test, even the receiver was closed and re-opened again in the new test. We need suppress this behavior using the clearReceiver() function when starting of waitForReadyReadWithTimeout() test. Change-Id: I6735aa9c9744ec1732f9bd4f701068a540ae2316 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
-rw-r--r--tests/auto/qserialport/tst_qserialport.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp
index b05d7d0..f34b939 100644
--- a/tests/auto/qserialport/tst_qserialport.cpp
+++ b/tests/auto/qserialport/tst_qserialport.cpp
@@ -117,9 +117,7 @@ protected slots:
void handleBytesWrittenAndExitLoopSlot2(qint64 bytesWritten);
private:
-#ifdef Q_OS_WIN
void clearReceiver(const QString &customReceiverName = QString());
-#endif
QString m_senderPortName;
QString m_receiverPortName;
@@ -139,9 +137,8 @@ tst_QSerialPort::tst_QSerialPort()
{
}
-#ifdef Q_OS_WIN
// This method is a workaround for the "com0com" virtual serial port
-// driver, which is installed on CI. The problem is that the close/clear
+// driver or for the SOCAT utility. The problem is that the close/clear
// methods have no effect on sender serial port. If any data didn't manage
// to be transferred before closing, then this data will continue to be
// transferred at next opening of sender port.
@@ -157,7 +154,6 @@ void tst_QSerialPort::clearReceiver(const QString &customReceiverName)
if (receiver.open(QIODevice::ReadOnly))
enterLoopMsecs(100);
}
-#endif
void tst_QSerialPort::initTestCase()
{
@@ -399,8 +395,8 @@ void tst_QSerialPort::waitForBytesWritten()
void tst_QSerialPort::waitForReadyReadWithTimeout()
{
-#ifdef Q_OS_WIN
clearReceiver();
+#ifdef Q_OS_WIN
// the dummy device on other side also has to be open
QSerialPort dummySerialPort(m_senderPortName);
QVERIFY(dummySerialPort.open(QIODevice::WriteOnly));