diff options
author | Sergey Belyashov <Sergey.Belyashov@gmail.com> | 2014-12-01 11:38:28 +0300 |
---|---|---|
committer | Sergey Belyashov <Sergey.Belyashov@gmail.com> | 2014-12-01 10:35:36 +0100 |
commit | c56674063f03be35a0202bbc935f310ef9ace0c3 (patch) | |
tree | 0b11f5cf4a4f1933c5ee7208c06fd48cf780ef78 | |
parent | 3ebd455163edbcb152eef475e4718362833a3581 (diff) | |
download | qtserialport-c56674063f03be35a0202bbc935f310ef9ace0c3.tar.gz |
Autotest misconfiguration error message is more verbose
Error message about missing environment variables generates list of
required variables.
Change-Id: Icbb680abbd9fc5d0549907b7399757d943c6d535
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r-- | tests/auto/qserialport/tst_qserialport.cpp | 18 | ||||
-rw-r--r-- | tests/auto/qserialportinfo/tst_qserialportinfo.cpp | 17 |
2 files changed, 31 insertions, 4 deletions
diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp index 357cef8..b05d7d0 100644 --- a/tests/auto/qserialport/tst_qserialport.cpp +++ b/tests/auto/qserialport/tst_qserialport.cpp @@ -164,10 +164,24 @@ void tst_QSerialPort::initTestCase() m_senderPortName = QString::fromLocal8Bit(qgetenv("QTEST_SERIALPORT_SENDER")); m_receiverPortName = QString::fromLocal8Bit(qgetenv("QTEST_SERIALPORT_RECEIVER")); if (m_senderPortName.isEmpty() || m_receiverPortName.isEmpty()) { + static const char message[] = + "Test doesn't work because the names of serial ports aren't found in env.\n" + "Please set environment variables:\n" + " QTEST_SERIALPORT_SENDER to name of output serial port\n" + " QTEST_SERIALPORT_RECEIVER to name of input serial port\n" + "Specify short names of port" +#if defined(Q_OS_UNIX) + ", like: ttyS0\n"; +#elif defined(Q_OS_WIN32) + ", like: COM1\n"; +#else + "\n"; +#endif + #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - QSKIP("Test doesn't work because the names of serial ports aren't found in env."); + QSKIP(message); #else - QSKIP("Test doesn't work because the names of serial ports aren't set found env.", SkipAll); + QSKIP(message, SkipAll); #endif } else { m_availablePortNames << m_senderPortName << m_receiverPortName; diff --git a/tests/auto/qserialportinfo/tst_qserialportinfo.cpp b/tests/auto/qserialportinfo/tst_qserialportinfo.cpp index afbcf0b..e421aa4 100644 --- a/tests/auto/qserialportinfo/tst_qserialportinfo.cpp +++ b/tests/auto/qserialportinfo/tst_qserialportinfo.cpp @@ -70,10 +70,23 @@ void tst_QSerialPortInfo::initTestCase() m_senderPortName = QString::fromLocal8Bit(qgetenv("QTEST_SERIALPORT_SENDER")); m_receiverPortName = QString::fromLocal8Bit(qgetenv("QTEST_SERIALPORT_RECEIVER")); if (m_senderPortName.isEmpty() || m_receiverPortName.isEmpty()) { + static const char message[] = + "Test doesn't work because the names of serial ports aren't found in env.\n" + "Please set environment variables:\n" + " QTEST_SERIALPORT_SENDER to name of output serial port\n" + " QTEST_SERIALPORT_RECEIVER to name of input serial port\n" + "Specify short names of port" +#if defined(Q_OS_UNIX) + ", like 'ttyS0'\n"; +#elif defined(Q_OS_WIN32) + ", like 'COM1'\n"; +#else + "\n"; +#endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - QSKIP("Test doesn't work because the names of serial ports aren't found in env."); + QSKIP(message); #else - QSKIP("Test doesn't work because the names of serial ports aren't set found env.", SkipAll); + QSKIP(message, SkipAll); #endif } else { m_availablePortNames << m_senderPortName << m_receiverPortName; |