summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-10-06 18:56:31 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-07 04:30:30 +0200
commit924d810dbdcd5b5b0fa860922b2487ea9062d002 (patch)
treeb14117ac5b9a2d8d02a502adbd00b94ba5eef424 /tests/auto/corelib
parent13251dcaea443d2f228fc797e54318191048e588 (diff)
Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: I95feba3edbfa092c0ef4d85bb8c6877bd6be698e Reviewed-on: http://codereview.qt-project.org/6128 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp10
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp7
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp10
-rw-r--r--tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp10
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp9
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp6
6 files changed, 26 insertions, 26 deletions
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 095103dd8a..96901f334e 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -55,8 +55,9 @@ class tst_QTextCodec : public QObject
Q_OBJECT
private slots:
-
+#ifndef QT_NO_CONCURRENT
void threadSafety();
+#endif
void toUnicode_data();
void toUnicode();
@@ -1976,24 +1977,21 @@ static int loadAndConvertMIB(int mib)
}
+#ifndef QT_NO_CONCURRENT
void tst_QTextCodec::threadSafety()
{
QList<QByteArray> codecList = QTextCodec::availableCodecs();
QList<int> mibList = QTextCodec::availableMibs();
-#ifndef QT_NO_CONCURRENT
QThreadPool::globalInstance()->setMaxThreadCount(12);
QFuture<QByteArray> res = QtConcurrent::mapped(codecList, loadAndConvert);
-
QFuture<int> res2 = QtConcurrent::mapped(mibList, loadAndConvertMIB);
QCOMPARE(res.results(), codecList);
QCOMPARE(res2.results(), mibList);
-#else
- QSKIP("This function is not yet supported with QT_NO_CONCURRENT defined.", SkipAll);
-#endif
}
+#endif
void tst_QTextCodec::invalidNames()
{
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 5d976896d8..d4f99c5d74 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -609,10 +609,10 @@ void tst_QFile::size()
fclose(stream);
}
+ // Currently low level file I/O is not well supported on Windows CE, so
+ // skip this part of the test.
+#ifndef Q_OS_WINCE
{
-#ifdef Q_OS_WINCE
- QSKIP("Currently low level file I/O not well supported on Windows CE", SkipSingle);
-#endif
QFile f;
int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
@@ -624,6 +624,7 @@ void tst_QFile::size()
f.close();
QT_CLOSE(fd);
}
+#endif
}
void tst_QFile::sizeNoExist()
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index c6a5f39319..d28efd8934 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -170,6 +170,8 @@ private slots:
void detachedWorkingDirectoryAndPid();
#ifndef Q_OS_WINCE
void switchReadChannels();
+#endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void setWorkingDirectory();
#endif
void startFinishStartFinish();
@@ -2188,8 +2190,9 @@ void tst_QProcess::switchReadChannels()
//-----------------------------------------------------------------------------
-// Windows CE does not support working directory logic.
-#ifndef Q_OS_WINCE
+// Windows CE does not support working directory logic, and
+// setWorkingDirectory will chdir before starting the process on unices.
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void tst_QProcess::setWorkingDirectory()
{
process = new QProcess;
@@ -2199,9 +2202,6 @@ void tst_QProcess::setWorkingDirectory()
#else
process->start("testSetWorkingDirectory/testSetWorkingDirectory");
#endif
-#ifndef Q_OS_WIN
- QSKIP("setWorkingDirectory will chdir before starting the process on unices", SkipAll);
-#endif
QVERIFY(process->waitForFinished());
QByteArray workingDir = process->readAllStandardOutput();
diff --git a/tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp
index 4aa2912ad6..fe1d552708 100644
--- a/tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp
@@ -325,7 +325,11 @@ void tst_QSharedMemory::attach_data()
QTest::newRow("null key") << QString() << false << QSharedMemory::KeyError;
QTest::newRow("doesn't exists") << QString("doesntexists") << false << QSharedMemory::NotFound;
+
+ // HPUX doesn't allow for multiple attaches per process.
+#ifndef Q_OS_HPUX
QTest::newRow("already exists") << QString(EXISTING_SHARE) << true << QSharedMemory::NoError;
+#endif
}
/*!
@@ -336,11 +340,7 @@ void tst_QSharedMemory::attach()
QFETCH(QString, key);
QFETCH(bool, exists);
QFETCH(QSharedMemory::SharedMemoryError, error);
-#ifdef Q_OS_HPUX
- if (QLatin1String(QTest::currentDataTag()) == QLatin1String("already exists")) {
- QSKIP("HPUX doesn't allow for multiple attaches per process", SkipSingle);
- }
-#endif
+
QSharedMemory sm(key);
QCOMPARE(sm.attach(), exists);
QCOMPARE(sm.isAttached(), exists);
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 9600afd220..b2d09f2baf 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -117,7 +117,9 @@ private slots:
void startFinishRace();
void startAndQuitCustomEventLoop();
+#ifndef Q_OS_WINCE
void stressTest();
+#endif
};
enum { one_minute = 60 * 1000, five_minutes = 5 * one_minute };
@@ -990,11 +992,11 @@ void tst_QThread::adoptMultipleThreadsOverlap()
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(int(recorder.activationCount), numThreads);
}
+
+// Disconnects on WinCE, so skip this test.
+#ifndef Q_OS_WINCE
void tst_QThread::stressTest()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Disconnects on WinCE, skipping...", SkipAll);
-#endif
QTime t;
t.start();
while (t.elapsed() < one_minute) {
@@ -1003,6 +1005,7 @@ void tst_QThread::stressTest()
t.wait(one_minute);
}
}
+#endif
class Syncronizer : public QObject
{ Q_OBJECT
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index fdfc5e1f2e..fc791ec74a 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -873,10 +873,8 @@ void tst_QString::STL()
QVERIFY( !stdstr3.length() );
#endif
-//skip test if glibc is not compiled with wide character support
-#if (defined Q_CC_GNU && !defined _GLIBCPP_USE_WCHAR_T) || defined QT_NO_STL_WCHAR
- QSKIP( "Not tested without wide character support", SkipAll);
-#else
+// Skip the rest of the test if glibc is not compiled with wide character support
+#if !(defined Q_CC_GNU && !defined _GLIBCPP_USE_WCHAR_T) && !defined QT_NO_STL_WCHAR
const wchar_t arr[] = {'h', 'e', 'l', 'l', 'o', 0};
QStdWString stlStr = arr;