From c56674063f03be35a0202bbc935f310ef9ace0c3 Mon Sep 17 00:00:00 2001 From: Sergey Belyashov Date: Mon, 1 Dec 2014 11:38:28 +0300 Subject: 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 --- tests/auto/qserialport/tst_qserialport.cpp | 18 ++++++++++++++++-- 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; -- cgit v1.2.1