author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 22 Apr 2010 16:15:11 +0300 | |
branch | RCL_3 |
changeset 14 | 8c4229025c0b |
parent 13 | c0432d11811c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
||
43 |
#include <QtCore/QtCore> |
|
44 |
#include <QtTest/QtTest> |
|
45 |
||
46 |
#ifdef QT_NO_PROCESS |
|
47 |
QTEST_NOOP_MAIN |
|
48 |
#else |
|
49 |
||
50 |
#include "qbic.h" |
|
51 |
||
52 |
#include <stdlib.h> |
|
53 |
||
54 |
class tst_Bic: public QObject |
|
55 |
{ |
|
56 |
Q_OBJECT |
|
57 |
||
58 |
public: |
|
59 |
tst_Bic(); |
|
60 |
QBic::Info getCurrentInfo(const QString &libName); |
|
61 |
||
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
62 |
QHash<QString, QBic::Info> cachedCurrentInfo; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
63 |
|
0 | 64 |
private slots: |
65 |
void initTestCase_data(); |
|
66 |
void initTestCase(); |
|
67 |
||
68 |
void sizesAndVTables_data(); |
|
69 |
void sizesAndVTables(); |
|
70 |
||
71 |
private: |
|
72 |
QBic bic; |
|
73 |
}; |
|
74 |
||
75 |
typedef QPair<QString, QString> QStringPair; |
|
76 |
||
77 |
tst_Bic::tst_Bic() |
|
78 |
{ |
|
79 |
bic.addBlacklistedClass(QLatin1String("std::*")); |
|
80 |
bic.addBlacklistedClass(QLatin1String("qIsNull*")); |
|
81 |
bic.addBlacklistedClass(QLatin1String("_*")); |
|
82 |
bic.addBlacklistedClass(QLatin1String("<anonymous*")); |
|
83 |
||
84 |
/* some system stuff we don't care for */ |
|
85 |
bic.addBlacklistedClass(QLatin1String("timespec")); |
|
86 |
bic.addBlacklistedClass(QLatin1String("itimerspec")); |
|
87 |
bic.addBlacklistedClass(QLatin1String("sched_param")); |
|
88 |
bic.addBlacklistedClass(QLatin1String("timeval")); |
|
89 |
bic.addBlacklistedClass(QLatin1String("drand")); |
|
90 |
bic.addBlacklistedClass(QLatin1String("lconv")); |
|
91 |
bic.addBlacklistedClass(QLatin1String("random")); |
|
92 |
bic.addBlacklistedClass(QLatin1String("wait")); |
|
93 |
bic.addBlacklistedClass(QLatin1String("tm")); |
|
94 |
bic.addBlacklistedClass(QLatin1String("sigcontext")); |
|
95 |
bic.addBlacklistedClass(QLatin1String("ucontext")); |
|
96 |
bic.addBlacklistedClass(QLatin1String("ucontext64")); |
|
97 |
bic.addBlacklistedClass(QLatin1String("sigaltstack")); |
|
98 |
||
99 |
/* QtOpenGL includes qt_windows.h, and some SDKs dont have these structs present */ |
|
100 |
bic.addBlacklistedClass(QLatin1String("tagTITLEBARINFO")); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
bic.addBlacklistedClass(QLatin1String("tagMENUITEMINFOA")); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
bic.addBlacklistedClass(QLatin1String("tagMENUITEMINFOW")); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
bic.addBlacklistedClass(QLatin1String("tagENHMETAHEADER")); |
0 | 104 |
|
105 |
/* some bug in gcc also reported template instanciations */ |
|
106 |
bic.addBlacklistedClass(QLatin1String("QTypeInfo<*>")); |
|
107 |
bic.addBlacklistedClass(QLatin1String("QMetaTypeId<*>")); |
|
108 |
bic.addBlacklistedClass(QLatin1String("QVector<QGradientStop>*")); |
|
109 |
||
110 |
/* this guy is never instantiated, just for compile-time checking */ |
|
111 |
bic.addBlacklistedClass(QLatin1String("QMap<*>::PayloadNode")); |
|
112 |
||
113 |
/* QFileEngine was removed in 4.1 */ |
|
114 |
bic.addBlacklistedClass(QLatin1String("QFileEngine")); |
|
115 |
bic.addBlacklistedClass(QLatin1String("QFileEngineHandler")); |
|
116 |
bic.addBlacklistedClass(QLatin1String("QFlags<QFileEngine::FileFlag>")); |
|
117 |
||
118 |
/* Private classes */ |
|
119 |
bic.addBlacklistedClass(QLatin1String("QBrushData")); |
|
120 |
bic.addBlacklistedClass(QLatin1String("QObjectData")); |
|
121 |
bic.addBlacklistedClass(QLatin1String("QAtomic")); |
|
122 |
bic.addBlacklistedClass(QLatin1String("QBasicAtomic")); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
bic.addBlacklistedClass(QLatin1String("QRegion::QRegionData")); |
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
124 |
bic.addBlacklistedClass(QLatin1String("QtConcurrent::ThreadEngineSemaphore")); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
125 |
bic.addBlacklistedClass(QLatin1String("QDrawPixmaps::Data")); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
126 |
bic.addBlacklistedClass(QLatin1String("QS60Style")); |
0 | 127 |
|
128 |
/* Jambi-related classes in Designer */ |
|
129 |
bic.addBlacklistedClass(QLatin1String("QDesignerLanguageExtension")); |
|
130 |
||
131 |
/* Harald says it's undocumented and private :) */ |
|
132 |
bic.addBlacklistedClass(QLatin1String("QAccessibleInterfaceEx")); |
|
133 |
bic.addBlacklistedClass(QLatin1String("QAccessibleObjectEx")); |
|
134 |
bic.addBlacklistedClass(QLatin1String("QAccessibleWidgetEx")); |
|
135 |
||
136 |
/* This structure is semi-private and should never shrink */ |
|
137 |
bic.addBlacklistedClass(QLatin1String("QVFbHeader")); |
|
138 |
} |
|
139 |
||
140 |
void tst_Bic::initTestCase_data() |
|
141 |
{ |
|
142 |
QTest::addColumn<QString>("libName"); |
|
143 |
||
144 |
QTest::newRow("QtCore") << "QtCore"; |
|
145 |
QTest::newRow("QtGui") << "QtGui"; |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
146 |
|
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
147 |
QTest::newRow("Qt3Support") << "Qt3Support"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
148 |
QTest::newRow("QtDBus") << "QtDBus"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
149 |
QTest::newRow("QtDesigner") << "QtDesigner"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
150 |
QTest::newRow("QtMultimedia") << "QtMultimedia"; |
0 | 151 |
QTest::newRow("QtNetwork") << "QtNetwork"; |
152 |
QTest::newRow("QtOpenGL") << "QtOpenGL"; |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
153 |
QTest::newRow("QtScript") << "QtScript"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
154 |
QTest::newRow("QtScriptTools") << "QtScriptTools"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
155 |
QTest::newRow("QtSql") << "QtSql"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
156 |
QTest::newRow("QtSvg") << "QtSvg"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
157 |
QTest::newRow("QtTest") << "QtTest"; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
158 |
QTest::newRow("QtWebKit") << "QtWebKit"; |
0 | 159 |
QTest::newRow("QtXml") << "QtXml"; |
160 |
QTest::newRow("QtXmlPatterns") << "QtXmlPatterns"; |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
161 |
QTest::newRow("phonon") << "phonon"; |
0 | 162 |
} |
163 |
||
164 |
void tst_Bic::initTestCase() |
|
165 |
{ |
|
166 |
QString qtDir = QString::fromLocal8Bit(qgetenv("QTDIR")); |
|
167 |
QVERIFY2(!qtDir.isEmpty(), "This test needs $QTDIR"); |
|
168 |
||
169 |
if (qgetenv("PATH").contains("teambuilder")) |
|
170 |
QTest::qWarn("This test might not work with teambuilder, consider switching it off."); |
|
171 |
} |
|
172 |
||
173 |
void tst_Bic::sizesAndVTables_data() |
|
174 |
{ |
|
175 |
#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) |
|
176 |
QSKIP("Test not implemented for this compiler/platform", SkipAll); |
|
177 |
#else |
|
178 |
||
179 |
#if defined Q_OS_LINUX && defined Q_WS_X11 |
|
180 |
# if defined(__powerpc__) && !defined(__powerpc64__) |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
181 |
# define FILESUFFIX "linux-gcc-ppc32" |
0 | 182 |
# elif defined(__amd64__) |
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
183 |
# define FILESUFFIX "linux-gcc-amd64" |
0 | 184 |
# elif defined(__i386__) |
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
185 |
# define FILESUFFIX "linux-gcc-ia32" |
0 | 186 |
# endif |
187 |
#elif defined Q_OS_MAC && defined(__powerpc__) |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
188 |
# define FILESUFFIX "macx-gcc-ppc32" |
0 | 189 |
#elif defined Q_OS_MAC && defined(__i386__) |
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
190 |
# define FILESUFFIX "macx-gcc-ia32" |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
191 |
#elif defined Q_OS_MAC && defined(__amd64__) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
192 |
# define FILESUFFIX "macx-gcc-amd64"; |
0 | 193 |
#elif defined Q_OS_WIN && defined Q_CC_GNU |
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
194 |
# define FILESUFFIX "win32-gcc-ia32" |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
195 |
#else |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
196 |
# define FILESUFFIX "nonsuch" |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
197 |
QSKIP("No reference files found for this platform", SkipAll); |
0 | 198 |
#endif |
199 |
||
200 |
QTest::addColumn<QString>("oldLib"); |
|
201 |
QTest::addColumn<bool>("isPatchRelease"); |
|
202 |
||
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
203 |
int minor = (QT_VERSION >> 8) & 0xFF; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
204 |
int patch = QT_VERSION & 0xFF; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
205 |
for (int i = 0; i <= minor; ++i) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
206 |
if (i != minor || patch) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
207 |
QTest::newRow("4." + QByteArray::number(i)) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
208 |
<< (QString(SRCDIR "data/%1.4.") |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
209 |
+ QString::number(i) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
210 |
+ QString(".0." FILESUFFIX ".txt")) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
211 |
<< (i == minor && patch); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
212 |
} |
0 | 213 |
#endif |
214 |
} |
|
215 |
||
216 |
QBic::Info tst_Bic::getCurrentInfo(const QString &libName) |
|
217 |
{ |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
218 |
QBic::Info &inf = cachedCurrentInfo[libName]; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
219 |
if (!inf.classSizes.isEmpty()) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
220 |
return inf; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
221 |
|
0 | 222 |
QTemporaryFile tmpQFile; |
223 |
tmpQFile.open(); |
|
224 |
QString tmpFileName = tmpQFile.fileName(); |
|
225 |
||
226 |
QByteArray tmpFileContents = "#include<" + libName.toLatin1() + "/" + libName.toLatin1() + ">\n"; |
|
227 |
tmpQFile.write(tmpFileContents); |
|
228 |
tmpQFile.flush(); |
|
229 |
||
230 |
QString qtDir = QString::fromLocal8Bit(qgetenv("QTDIR")); |
|
231 |
#ifdef Q_OS_WIN |
|
232 |
qtDir.replace('\\', '/'); |
|
233 |
#endif |
|
234 |
QString compilerName = "g++"; |
|
235 |
||
236 |
QStringList args; |
|
237 |
args << "-c" |
|
238 |
<< "-I" + qtDir + "/include" |
|
239 |
#ifndef Q_OS_WIN |
|
240 |
<< "-I/usr/X11R6/include/" |
|
241 |
#endif |
|
242 |
<< "-DQT_NO_STL" << "-DQT3_SUPPORT" |
|
243 |
<< "-xc++" |
|
244 |
#if !defined(Q_OS_AIX) && !defined(Q_OS_WIN) |
|
245 |
<< "-o" << "/dev/null" |
|
246 |
#endif |
|
247 |
<< "-fdump-class-hierarchy" |
|
248 |
<< tmpFileName; |
|
249 |
||
250 |
QProcess proc; |
|
251 |
proc.start(compilerName, args, QIODevice::ReadOnly); |
|
252 |
if (!proc.waitForFinished(6000000)) { |
|
253 |
qWarning() << "gcc didn't finish" << proc.errorString(); |
|
254 |
return QBic::Info(); |
|
255 |
} |
|
256 |
if (proc.exitCode() != 0) { |
|
257 |
qWarning() << "gcc returned with" << proc.exitCode(); |
|
258 |
qDebug() << proc.readAllStandardError(); |
|
259 |
return QBic::Info(); |
|
260 |
} |
|
261 |
||
262 |
QString errs = QString::fromLocal8Bit(proc.readAllStandardError().constData()); |
|
263 |
if (!errs.isEmpty()) { |
|
264 |
qDebug() << "Arguments:" << args << "Warnings:" << errs; |
|
265 |
return QBic::Info(); |
|
266 |
} |
|
267 |
||
268 |
// See if we find the gcc output file, which seems to change |
|
269 |
// from release to release |
|
270 |
QStringList files = QDir().entryList(QStringList() << "*.class"); |
|
271 |
if (files.isEmpty()) { |
|
272 |
qFatal("Could not locate the GCC output file, update this test"); |
|
273 |
return QBic::Info(); |
|
274 |
} else if (files.size() > 1) { |
|
275 |
qDebug() << files; |
|
276 |
qFatal("Located more than one output file, please clean up before running this test"); |
|
277 |
return QBic::Info(); |
|
278 |
} |
|
279 |
||
280 |
QString resultFileName = files.first(); |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
281 |
inf = bic.parseFile(resultFileName); |
0 | 282 |
|
283 |
QFile::remove(resultFileName); |
|
284 |
tmpQFile.close(); |
|
285 |
||
286 |
return inf; |
|
287 |
} |
|
288 |
||
289 |
void tst_Bic::sizesAndVTables() |
|
290 |
{ |
|
291 |
#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) |
|
292 |
QSKIP("Test not implemented for this compiler/platform", SkipAll); |
|
293 |
#else |
|
294 |
||
295 |
QFETCH_GLOBAL(QString, libName); |
|
296 |
QFETCH(QString, oldLib); |
|
297 |
QFETCH(bool, isPatchRelease); |
|
298 |
||
299 |
bool isFailed = false; |
|
300 |
||
301 |
//qDebug() << oldLib.arg(libName); |
|
302 |
if (oldLib.isEmpty() || !QFile::exists(oldLib.arg(libName))) |
|
303 |
QSKIP("No platform spec found for this platform/version.", SkipSingle); |
|
304 |
||
305 |
const QBic::Info oldLibInfo = bic.parseFile(oldLib.arg(libName)); |
|
306 |
QVERIFY(!oldLibInfo.classVTables.isEmpty()); |
|
307 |
||
308 |
const QBic::Info currentLibInfo = getCurrentInfo(libName); |
|
309 |
QVERIFY(!currentLibInfo.classVTables.isEmpty()); |
|
310 |
||
311 |
QBic::VTableDiff diff = bic.diffVTables(oldLibInfo, currentLibInfo); |
|
312 |
||
313 |
if (!diff.removedVTables.isEmpty()) { |
|
314 |
qWarning() << "VTables for the following classes were removed" << diff.removedVTables; |
|
315 |
isFailed = true; |
|
316 |
} |
|
317 |
||
318 |
if (!diff.modifiedVTables.isEmpty()) { |
|
13
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
319 |
if (diff.modifiedVTables.size() != 1 || |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
320 |
strcmp(QTest::currentDataTag(), "4.4") != 0 || |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
321 |
diff.modifiedVTables.at(0).first != "QGraphicsProxyWidget") { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
322 |
foreach(QStringPair entry, diff.modifiedVTables) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
323 |
qWarning() << "modified VTable:\n Old: " << entry.first |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
324 |
<< "\n New: " << entry.second; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
325 |
isFailed = true; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
326 |
} |
0 | 327 |
} |
328 |
||
329 |
if (isPatchRelease && !diff.addedVTables.isEmpty()) { |
|
330 |
qWarning() << "VTables for the following classes were added in a patch release:" |
|
331 |
<< diff.addedVTables; |
|
332 |
isFailed = true; |
|
333 |
} |
|
334 |
||
335 |
if (isPatchRelease && !diff.reimpMethods.isEmpty()) { |
|
336 |
foreach(QStringPair entry, diff.reimpMethods) |
|
337 |
qWarning() << "reimplemented virtual in patch release:\n Old: " << entry.first |
|
338 |
<< "\n New: " << entry.second; |
|
339 |
isFailed = true; |
|
340 |
} |
|
341 |
||
342 |
QBic::SizeDiff sizeDiff = bic.diffSizes(oldLibInfo, currentLibInfo); |
|
343 |
if (!sizeDiff.mismatch.isEmpty()) { |
|
344 |
foreach (QString className, sizeDiff.mismatch) |
|
345 |
qWarning() << "size mismatch for" << className |
|
346 |
<< "old" << oldLibInfo.classSizes.value(className) |
|
347 |
<< "new" << currentLibInfo.classSizes.value(className); |
|
348 |
isFailed = true; |
|
349 |
} |
|
350 |
||
351 |
#ifdef Q_CC_MINGW |
|
352 |
/** |
|
353 |
* These symbols are from Windows' imm.h header, and is available |
|
354 |
* conditionally depending on the value of the WINVER define. We pull |
|
355 |
* them out since they're not relevant to the testing done. |
|
356 |
*/ |
|
357 |
sizeDiff.removed.removeAll(QLatin1String("tagIMECHARPOSITION")); |
|
358 |
sizeDiff.removed.removeAll(QLatin1String("tagRECONVERTSTRING")); |
|
359 |
#endif |
|
360 |
||
361 |
if (!sizeDiff.removed.isEmpty()) { |
|
362 |
qWarning() << "the following classes were removed:" << sizeDiff.removed; |
|
363 |
isFailed = true; |
|
364 |
} |
|
365 |
||
366 |
if (isPatchRelease && !sizeDiff.added.isEmpty()) { |
|
367 |
qWarning() << "the following classes were added in a patch release:" << sizeDiff.added; |
|
368 |
isFailed = true; |
|
369 |
} |
|
370 |
||
371 |
if (isFailed) |
|
372 |
QFAIL("Test failed, read warnings above."); |
|
373 |
#endif |
|
374 |
} |
|
375 |
||
376 |
QTEST_APPLESS_MAIN(tst_Bic) |
|
377 |
||
378 |
#include "tst_bic.moc" |
|
379 |
#endif |