From 45f7512bf502cc3fe22c4e7f86bec4a530f7a2f6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 27 Nov 2015 10:33:19 +0100 Subject: tst_QThreadPool::tryStartCount(): Wait until tasks have finished. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded interval by QTRY_COMPARE() ensuring that all tasks have finished, since otherwise QThreadPool::tryStart() fails in the next run. Remove blacklisting for MSVC2012 since it is not compiler-specific. Task-number: QTBUG-49654 Change-Id: If49b6eb9ef4da4ba2911839166c397d84c175e00 Reviewed-by: Simon Hausmann Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/thread/qthreadpool/BLACKLIST | 3 --- tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/thread/qthreadpool/BLACKLIST b/tests/auto/corelib/thread/qthreadpool/BLACKLIST index 684f650a72..1c392ce96c 100644 --- a/tests/auto/corelib/thread/qthreadpool/BLACKLIST +++ b/tests/auto/corelib/thread/qthreadpool/BLACKLIST @@ -1,5 +1,2 @@ [expiryTimeoutRace] osx -[tryStartCount] -windows msvc-2012 -linux diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index c9fdb4b718..c465a07487 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -821,7 +821,7 @@ void tst_QThreadPool::tryStartCount() ++count; QCOMPARE(count, QThread::idealThreadCount()); - QTest::qWait(100); + QTRY_COMPARE(threadPool.activeThreadCount(), 0); } } -- cgit v1.2.3 From 884e3bdd5de3aee841f7194972f1eeeae05649e8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Nov 2015 09:18:19 +0100 Subject: tst_QItemModel: Use a QTemporaryDir for test data of QDirModel. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5943c6656da93d36e1955ac038bf656831da0c5c Reviewed-by: Jędrzej Nowacki --- .../corelib/itemmodels/qitemmodel/modelstotest.cpp | 43 +++++++++------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index ba143a31f8..e0e688cc3a 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -78,6 +78,9 @@ public: QList tests; static void setupDatabase(); + +private: + QScopedPointer m_dirModelTempDir; }; @@ -306,18 +309,20 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) } if (QDirModel *dirModel = qobject_cast(model)) { - if (!QDir::current().mkdir("test")) - qFatal("%s: cannot create directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/test"))); + m_dirModelTempDir.reset(new QTemporaryDir); + if (!m_dirModelTempDir->isValid()) + qFatal("Cannot create temporary directory \"%s\": %s", + qPrintable(QDir::toNativeSeparators(m_dirModelTempDir->path())), + qPrintable(m_dirModelTempDir->errorString())); + + QDir tempDir(m_dirModelTempDir->path()); for (int i = 0; i < 26; ++i) { - QString subdir = QString("test/foo_%1").arg(i); - if (!QDir::current().mkdir(subdir)) - qFatal("%s: cannot create directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/"+subdir))); + const QString subdir = QString("foo_") + QString::number(i); + if (!tempDir.mkdir(subdir)) + qFatal("Cannot create directory %s", + qPrintable(QDir::toNativeSeparators(tempDir.path() + QLatin1Char('/') +subdir))); } - return dirModel->index(QDir::currentPath()+"/test"); + return dirModel->index(tempDir.path()); } if (QSqlQueryModel *queryModel = qobject_cast(model)) { @@ -382,22 +387,8 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) */ void ModelsToTest::cleanupTestArea(QAbstractItemModel *model) { - if (qobject_cast(model)) - { - if (QDir(QDir::currentPath()+"/test").exists()) - { - for (int i = 0; i < 26; ++i) { - QString subdir(QString("test/foo_%1").arg(i)); - if (!QDir::current().rmdir(subdir)) - qFatal("%s: cannot remove directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/"+subdir))); - } - if (!QDir::current().rmdir("test")) - qFatal("%s: cannot remove directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/test"))); - } + if (qobject_cast(model)) { + m_dirModelTempDir.reset(); } else if (qobject_cast(model)) { QSqlQuery q("DROP TABLE test"); } -- cgit v1.2.3 From d76be5530a9e8915228db8deeaab3753aebc6367 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Fri, 27 Nov 2015 10:55:34 -0500 Subject: Use correct test to add C++14 to the project configuration Only add C++14 to the project configuration when C++14 support is available on the platform. Adding it because the platform supports C++11 doesn't work when the platform _only_ supports C++11 (e.g., QNX 6.6.0). Task-number: QTBUG-49491 Change-Id: I15de38bb06d912a314b9dd18c80b513cc06a855e Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- tests/auto/corelib/global/qflags/qflags.pro | 3 ++- tests/auto/corelib/global/qlogging/test/test.pro | 3 ++- tests/auto/corelib/tools/qlatin1string/qlatin1string.pro | 3 ++- tests/auto/corelib/tools/qversionnumber/qversionnumber.pro | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro index 3f78bc045b..7602008e22 100644 --- a/tests/auto/corelib/global/qflags/qflags.pro +++ b/tests/auto/corelib/global/qflags/qflags.pro @@ -3,4 +3,5 @@ TARGET = tst_qflags QT = core testlib SOURCES = tst_qflags.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -contains(QT_CONFIG, c++11): CONFIG += c++11 c++14 +contains(QT_CONFIG, c++11): CONFIG += c++11 +contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index d4dce4a0c3..fdebf45281 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -1,6 +1,7 @@ CONFIG += testcase parallel_test CONFIG -= app_bundle debug_and_release_target -contains(QT_CONFIG, c++11): CONFIG += c++11 c++14 +contains(QT_CONFIG, c++11): CONFIG += c++11 +contains(QT_CONFIG, c++14): CONFIG += c++14 TARGET = ../tst_qlogging QT = core testlib SOURCES = ../tst_qlogging.cpp diff --git a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro index 219afa661b..a996dab23e 100644 --- a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro +++ b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro @@ -3,6 +3,7 @@ TARGET = tst_qlatin1string QT = core testlib SOURCES = tst_qlatin1string.cpp DEFINES += QT_NO_CAST_TO_ASCII -contains(QT_CONFIG,c++11): CONFIG += c++11 c++14 +contains(QT_CONFIG,c++11): CONFIG += c++11 +contains(QT_CONFIG,c++14): CONFIG += c++14 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro index ba4b2b40cb..e83a2b507c 100644 --- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro +++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro @@ -1,5 +1,6 @@ CONFIG += testcase parallel_test -contains(QT_CONFIG, c++11):CONFIG += c++11 c++14 +contains(QT_CONFIG, c++11):CONFIG += c++11 +contains(QT_CONFIG, c++14):CONFIG += c++14 TARGET = tst_qversionnumber QT = core testlib SOURCES = tst_qversionnumber.cpp -- cgit v1.2.3