diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2015-01-04 16:11:27 +0000 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2015-01-16 09:33:12 +0100 |
commit | 81a07b069a126244944962932928236c0c585658 (patch) | |
tree | fefd350b21494d6fa42d45c1a314fd26daac7d53 | |
parent | ff03e5aa0ccdd2060aa2a8f1a5b55234c09bb3d0 (diff) | |
download | qtserialport-81a07b069a126244944962932928236c0c585658.tar.gz |
Skip the constructByInfo() test if no serial ports are found on *nix
In unix-like systems it is possible to use socat to creation of the
virtual serial ports. But these devices are symlinks on the /dev/pts
devices, that is not a serial ports. Thus QSPI can not find it and will
construct a null object. In this case this is not an error and we need
just to skip test.
Change-Id: I59bbb3c4653555be39ea6fff903c386065c10d0a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
-rw-r--r-- | tests/auto/qserialport/tst_qserialport.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp index f34b939..e064333 100644 --- a/tests/auto/qserialport/tst_qserialport.cpp +++ b/tests/auto/qserialport/tst_qserialport.cpp @@ -234,9 +234,23 @@ void tst_QSerialPort::constructByName() void tst_QSerialPort::constructByInfo() { QSerialPortInfo senderPortInfo(m_senderPortName); + QSerialPortInfo receiverPortInfo(m_receiverPortName); + +#if defined(Q_OS_UNIX) + if (senderPortInfo.isNull() || receiverPortInfo.isNull()) { + static const char message[] = + "Test doesn't work because the specified serial ports aren't" + " found in system and can't be constructed by QSerialPortInfo.\n"; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + QSKIP(message); +#else + QSKIP(message, SkipAll); +#endif + } +#endif + QSerialPort serialPort(senderPortInfo); QCOMPARE(serialPort.portName(), m_senderPortName); - QSerialPortInfo receiverPortInfo(m_receiverPortName); serialPort.setPort(receiverPortInfo); QCOMPARE(serialPort.portName(), m_receiverPortName); } |