From 71b5aa1a2ad7447d9d0a1c252b4ac7b12b851d3e Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 25 Feb 2014 10:22:19 +0200 Subject: Removed unnecessary TESTDATA statement from qmessageauthenticationcode. QMessageAuthenticationCode autotest does not have data folder for TESTDATA. It seems that pro file is copy/pasted from another one which actually have data. Removed the unnecessary statement since it caused problems for https://codereview.qt-project.org/77981. Change-Id: Ide753e5692bd2f469217760173a9b60f2f646770 Reviewed-by: Andrew Knight Reviewed-by: Liang Qi --- .../tools/qmessageauthenticationcode/qmessageauthenticationcode.pro | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro b/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro index 1ea23915b7..afd0c1176d 100644 --- a/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro +++ b/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro @@ -3,5 +3,4 @@ TARGET = tst_qmessageauthenticationcode QT = core testlib SOURCES = tst_qmessageauthenticationcode.cpp -TESTDATA += data/* DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From f79202805e75bba4136f224a11f260874b0a5590 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 28 Feb 2014 15:01:29 +0200 Subject: Disable UNC tests on WinRT. Based on file system implementation for WinRT, the UNC paths are not supported on WinRT, so lets disable corresponding tests as well. Change-Id: Ib45ae618f39d5da39a822160096599b30204cf71 Reviewed-by: Andrew Knight --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 12 ++++++------ tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 77ac4bcd86..60d1517ed3 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -181,7 +181,7 @@ private slots: void writeTextFile_data(); void writeTextFile(); /* void largeFileSupport(); */ -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void largeUncFileSupport(); #endif void flush(); @@ -480,7 +480,7 @@ void tst_QFile::exists() file.remove(); QVERIFY(!file.exists()); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QFile unc("//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt"); QVERIFY(unc.exists()); #endif @@ -605,7 +605,7 @@ void tst_QFile::size_data() QTest::addColumn("size"); QTest::newRow( "exist01" ) << m_testFile << (qint64)245; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) // Only test UNC on Windows./ QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34; #endif @@ -1539,7 +1539,7 @@ void tst_QFile::writeTextFile() QCOMPARE(file.readAll(), out); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void tst_QFile::largeUncFileSupport() { qint64 size = Q_INT64_C(8589934592); @@ -2245,7 +2245,7 @@ void tst_QFile::writeLargeDataBlock_data() QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd; QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK) // Some semi-randomness to avoid collisions. QTest::newRow("unc file") << QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt") @@ -2605,7 +2605,7 @@ void tst_QFile::appendAndRead() void tst_QFile::miscWithUncPathAsCurrentDir() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QString current = QDir::currentPath(); QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testshare")); QFile file("test.pri"); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index b31b6631f4..6c147d68c8 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -378,7 +378,7 @@ void tst_QFileInfo::isRoot_data() QTest::newRow("drive 3") << "p:/" << false; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true; QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true; QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << false; @@ -418,7 +418,7 @@ void tst_QFileInfo::exists_data() QTest::newRow("simple dir") << m_resourcesDir << true; QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true; QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true; QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true; -- cgit v1.2.3 From 4b8aee7ca089ecf7509bbbb2369cc15a6432ab03 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 25 Feb 2014 10:20:39 +0200 Subject: Fix qchar testdata installation. NormalizationTest.txt does not exist in the project root, but under 'data' directory. TESTDATA is converted to INSTALLS rules in testcase.prf. INSTALLS rules generated in testcase.prf does not set 'no_check_exist' CONFIG variable. Thus qmake will not install NormalizationTest.txt since it cannot find it from defined location. Even TESTDATA has been incorrectly defined, NormalizationTest.txt has been found in majority of the platforms thanks to QFINDTESTDATA flexibility. However it causes problems on sand-boxed platforms such as WinRT. Fixed by defining the relative path to NormalizationTest.txt in TESTDATA so that qmake can find the file when processing INSTALLS variable. Change-Id: Id9a28db2a00b17d2c0136e6ff32f421b21137898 Reviewed-by: Andrew Knight Reviewed-by: Liang Qi --- tests/auto/corelib/tools/qchar/qchar.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index 7b36b2e45e..0738abad3a 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -3,5 +3,5 @@ TARGET = tst_qchar QT = core-private testlib SOURCES = tst_qchar.cpp -TESTDATA += NormalizationTest.txt +TESTDATA += data/NormalizationTest.txt DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From c4650779c41780f675a33025d09707c15055dda9 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 13 Mar 2014 21:14:35 +0100 Subject: Fix tst_qthreadpool under high load. The tasks might not have run yet at the time of the QCOMPARE, so we need to acquire on the semaphore in order to ensure that this is the case, just like in the previous testcase. Change-Id: I1da72bb07c2f53760b3bf912fc26aaf10ed18d48 Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 859cd1b36a..0c91c419cc 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -381,6 +381,7 @@ void tst_QThreadPool::expiryTimeoutRace() // QTBUG-3786 threadPool.start(&task); QThread::msleep(50); // exactly the same as the expiry timeout } + QVERIFY(task.semaphore.tryAcquire(numTasks, 10000)); QCOMPARE(task.runCount.load(), numTasks); QVERIFY(threadPool.waitForDone(2000)); } -- cgit v1.2.3 From 391c2c12abb66c6edcdac511be4ca126aeaf3377 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 25 Feb 2014 10:25:23 +0200 Subject: Introduce GENERATED_TESTDATA variable and fix qresourceengine test. testcase.prf cannot be loaded from pro file for various reasons, see qtbase commit history for details. Moved runtime testdata logic from pro file to testdata.prf, and thus made is reusable in other test cases as well. Change-Id: I500d08dc4951e4eda862071e4ddd3e0f6de8c3d2 Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/io/qresourceengine/qresourceengine.pro | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index b9e17f7418..b7606eb3fc 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -14,12 +14,5 @@ PRE_TARGETDEPS += $${runtime_resource.target} TESTDATA += \ parentdir.txt \ testqrc/* - -# Special case needed for runtime_resource.rcc installation, -# since it does not exist at qmake runtime. -load(testcase) # to get value of target.path -runtime_resource_install.CONFIG = no_check_exist -runtime_resource_install.files = $$OUT_PWD/$${runtime_resource.target} -runtime_resource_install.path = $${target.path} -INSTALLS += runtime_resource_install +GENERATED_TESTDATA = $${runtime_resource.target} DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From ac178eae4eb9f2647d07de2dfffa3c7ed18e2de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 17 Mar 2014 09:38:39 +0100 Subject: Fix Q_DECLARE_METATYPE macro The macro should stringify value of the given token not the token itself. Task-number: QTBUG-37547 Change-Id: I90f4fa613bd13d5a581828ab13f620b40dfd3593 Reviewed-by: Olivier Goffart --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 0e3ea86165..959c79ed60 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -278,15 +278,21 @@ void tst_QMetaType::threadSafety() namespace TestSpace { struct Foo { double d; }; - + struct QungTfu {}; } Q_DECLARE_METATYPE(TestSpace::Foo) +#define ADD_TESTSPACE(F) TestSpace::F +Q_DECLARE_METATYPE(ADD_TESTSPACE(QungTfu)) + void tst_QMetaType::namespaces() { TestSpace::Foo nf = { 11.12 }; QVariant v = QVariant::fromValue(nf); QCOMPARE(qvariant_cast(v).d, 11.12); + + int qungTfuId = qRegisterMetaType(); + QCOMPARE(QMetaType::typeName(qungTfuId), "TestSpace::QungTfu"); } void tst_QMetaType::qMetaTypeId() -- cgit v1.2.3 From 503d761c0867760b96d6f7f6d44854926c6b7e0c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 28 Feb 2014 17:18:09 +0100 Subject: Print when logging rule is invalid. Print a warning when an invalid logging rule is parsed. Change-Id: I3bf9a6df4053d36b3803652b2faa86168d5222bc Reviewed-by: Friedemann Kleint --- .../auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index 4318396bd4..32ce91dc6a 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -302,6 +302,16 @@ private slots: QVERIFY(!cat.isWarningEnabled()); } + + void QLoggingRegistry_checkErrors() + { + QLoggingSettingsParser parser; + QString warnMsg = QString("Ignoring malformed logging rule: '***=false'"); + QTest::ignoreMessage(QtWarningMsg, warnMsg.toLocal8Bit().constData()); + parser.setContent("[Rules]\n" + "***=false\n"); + QVERIFY(parser.rules().isEmpty()); + } }; QTEST_MAIN(tst_QLoggingRegistry) -- cgit v1.2.3 From ba4d1547372b7f3c1d7d4ea1cbf6785cfca90755 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 7 Mar 2014 15:31:21 +0100 Subject: Logging: Remove PatternFlag::Invalid from QLoggingRule The flag is not orthogonal to the rest, and e.g. checking with flags & Invalid will fail. Rather make it explicit by comparing with 0. Change-Id: I428d5e71f5ecd05f61d543aaa78532548ef93d5a Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index 32ce91dc6a..3064fd1320 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -172,7 +172,7 @@ private slots: QLoggingRule rule(QStringRef(&pattern), true); LoggingRuleState state = Invalid; - if (rule.flags != QLoggingRule::Invalid) { + if (rule.flags != 0) { switch (rule.pass(category, msgType)) { case -1: QFAIL("Shoudn't happen, we set pattern to true"); break; case 0: state = NoMatch; break; -- cgit v1.2.3