Commit c5667406 authored by Sergey Belyashov's avatar Sergey Belyashov
Browse files

Autotest misconfiguration error message is more verbose


Error message about missing environment variables generates list of
required variables.

Change-Id: Icbb680abbd9fc5d0549907b7399757d943c6d535
Reviewed-by: default avatarDenis Shienkov <denis.shienkov@gmail.com>
Showing with 31 additions and 4 deletions
......@@ -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;
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment