summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@nokia.com>2012-07-20 10:10:38 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-07-30 05:05:14 (GMT)
commit4baa7d173d88bb1bc2bed51880ef9b0b1bb831a4 (patch)
tree56f69a459e4d409b8e4755e125e15a5555bb864f /tests
parenta634bbc67699f044d22b6d450f22234397a6715f (diff)
downloadQt-4baa7d173d88bb1bc2bed51880ef9b0b1bb831a4.zip
Qt-4baa7d173d88bb1bc2bed51880ef9b0b1bb831a4.tar.gz
Qt-4baa7d173d88bb1bc2bed51880ef9b0b1bb831a4.tar.bz2
Workaround tst_headers, especially the license header check
This is a temporary solution to enable the license header test. All license headers need to be converted following Qt5 Change-Id: Ic96c0fd783aedc4aa4fefaa4eb816e75cd07f742 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/headers/tst_headers.cpp48
1 files changed, 37 insertions, 11 deletions
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index ddca1c2..bb79906 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -78,7 +78,7 @@ private:
};
tst_Headers::tst_Headers() :
- copyrightPattern("\\*\\* Copyright \\(C\\) 20[0-9][0-9] Nokia Corporation and/or its subsidiary\\(-ies\\)."),
+ copyrightPattern("\\*\\* Copyright \\(C\\) 20[0-9][0-9] .*"),
licensePattern("\\*\\* \\$QT_BEGIN_LICENSE:(LGPL|BSD|3RDPARTY|LGPL-ONLY|FDL)\\$"),
moduleTest(QLatin1String("\\*\\* This file is part of the .+ of the Qt Toolkit."))
{
@@ -232,7 +232,28 @@ void tst_Headers::licenseCheck()
return;
}
+ // Files for QNX follow the Qt5 license header, so skipping them for now
+ if (sourceFile.contains("/src/plugins/platforms/blackberry/")) {
+ return;
+ }
+
+ if (sourceFile.endsWith("mkspecs/unsupported/blackberry-armv7le-qcc/qplatformdefs.h")
+ || sourceFile.endsWith("mkspecs/unsupported/blackberry-x86-qcc/qplatformdefs.h")
+ || sourceFile.endsWith("mkspecs/unsupported/qnx-armv7le-qcc/qplatformdefs.h")
+ || sourceFile.endsWith("mkspecs/unsupported/qnx-x86-qcc/qplatformdefs.h")
+ || sourceFile.endsWith("src/corelib/kernel/qeventdispatcher_blackberry.cpp")
+ || sourceFile.endsWith("src/corelib/kernel/qeventdispatcher_blackberry_p.h")
+ || sourceFile.endsWith("src/gui/kernel/qeventdispatcher_blackberry_qpa.cpp")
+ || sourceFile.endsWith("src/gui/kernel/qeventdispatcher_blackberry_qpa_p.h")
+ || sourceFile.endsWith("src/gui/util/qdesktopservices_blackberry.cpp")) {
+ return;
+ }
+
+ // Compare the licensePattern ($QT_BEGIN_LICENSE:(LGPL|BSD|3RDPARTY|LGPL-ONLY|FDL)) pattern
+ // with the file under test. This pattern can be found in either lines 5, 7 or 8 of the
+ // license header
QVERIFY(licensePattern.exactMatch(content.value(8)) ||
+ licensePattern.exactMatch(content.value(7)) ||
licensePattern.exactMatch(content.value(5)));
QString licenseType = licensePattern.cap(1);
@@ -241,21 +262,26 @@ void tst_Headers::licenseCheck()
QCOMPARE(content.at(i++), QString("/****************************************************************************"));
if (licenseType != "3RDPARTY") {
QCOMPARE(content.at(i++), QString("**"));
- if (sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.cpp")
- || sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.h")
- || sourceFile.endsWith("/src/gui/itemviews/qidentityproxymodel.h")
+ if (sourceFile.endsWith("/doc/src/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp")
|| sourceFile.endsWith("/src/gui/itemviews/qidentityproxymodel.cpp")
- || sourceFile.endsWith("/doc/src/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp")
- || sourceFile.endsWith("/tests/auto/qidentityproxymodel/tst_qidentityproxymodel.cpp")
- || sourceFile.endsWith("/src/network/kernel/qnetworkproxy_p.h"))
+ || sourceFile.endsWith("/src/gui/itemviews/qidentityproxymodel.h")
+ || sourceFile.endsWith("/src/network/kernel/qnetworkproxy_p.h")
+ || sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.cpp")
+ || sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.h")
+ || sourceFile.endsWith("/tests/auto/qidentityproxymodel/tst_qidentityproxymodel.cpp"))
{
// These files are not copyrighted by Nokia.
++i;
} else {
QVERIFY(copyrightPattern.exactMatch(content.at(i++)));
}
- i++;
- QCOMPARE(content.at(i++), QString("** Contact: Nokia Corporation (qt-info@nokia.com)"));
+ // The old-style Contact: line should be replaced with
+ // Contact: http://www.qt-project.org/
+ // but it's still allowed.
+ if (content.at(i++) != QString("** Contact: http://www.qt-project.org/")) {
+ // here this i++ assumes that 'All rights reserved' line still exists
+ QCOMPARE(content.at(i++), QString("** Contact: Nokia Corporation (qt-info@nokia.com)"));
+ }
}
QCOMPARE(content.at(i++), QString("**"));
QVERIFY(moduleTest.exactMatch(content.at(i++)));