0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the tools applications 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 |
#include <QtCore>
|
|
42 |
#include <QtTest/QTest>
|
|
43 |
#include <shared.h>
|
|
44 |
|
|
45 |
class tst_deployment_mac : public QObject
|
|
46 |
{
|
|
47 |
Q_OBJECT
|
|
48 |
private slots:
|
|
49 |
void testParseOtoolLibraryLine();
|
|
50 |
void testgetQtFrameworks();
|
|
51 |
void testFindAppBinarty();
|
|
52 |
};
|
|
53 |
|
|
54 |
void tst_deployment_mac::testParseOtoolLibraryLine()
|
|
55 |
{
|
|
56 |
{
|
|
57 |
QString line = " /Users/foo/build/qt-4.4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.4.0, current version 4.4.0)";
|
|
58 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
59 |
// qDebug() << info;
|
|
60 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/Users/foo/build/qt-4.4/lib/"));
|
|
61 |
QCOMPARE(info.frameworkName, QLatin1String("QtGui.framework"));
|
|
62 |
QCOMPARE(info.frameworkPath, QLatin1String("/Users/foo/build/qt-4.4/lib/QtGui.framework"));
|
|
63 |
QCOMPARE(info.binaryDirectory, QLatin1String("Versions/4"));
|
|
64 |
QCOMPARE(info.binaryName, QLatin1String("QtGui"));
|
|
65 |
QCOMPARE(info.binaryPath, QLatin1String("/Versions/4/QtGui"));
|
|
66 |
QCOMPARE(info.version, QLatin1String("4"));
|
|
67 |
QCOMPARE(info.installName, QLatin1String("/Users/foo/build/qt-4.4/lib/QtGui.framework/Versions/4/QtGui"));
|
|
68 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui"));
|
|
69 |
QCOMPARE(info.sourceFilePath, QLatin1String("/Users/foo/build/qt-4.4/lib/QtGui.framework/Versions/4/QtGui"));
|
|
70 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/QtGui.framework/Versions/4"));
|
|
71 |
}
|
|
72 |
{
|
|
73 |
QString line = " /Users/foo/build/qt-4.4/lib/phonon.framework/Versions/4/phonon (compatibility version 4.1.0, current version 4.1.0)";
|
|
74 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
75 |
// qDebug() << info;
|
|
76 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/Users/foo/build/qt-4.4/lib/"));
|
|
77 |
QCOMPARE(info.frameworkName, QLatin1String("phonon.framework"));
|
|
78 |
QCOMPARE(info.frameworkPath, QLatin1String("/Users/foo/build/qt-4.4/lib/phonon.framework"));
|
|
79 |
QCOMPARE(info.binaryDirectory, QLatin1String("Versions/4"));
|
|
80 |
QCOMPARE(info.binaryName, QLatin1String("phonon"));
|
|
81 |
QCOMPARE(info.binaryPath, QLatin1String("/Versions/4/phonon"));
|
|
82 |
QCOMPARE(info.version, QLatin1String("4"));
|
|
83 |
QCOMPARE(info.installName, QLatin1String("/Users/foo/build/qt-4.4/lib/phonon.framework/Versions/4/phonon"));
|
|
84 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/phonon.framework/Versions/4/phonon"));
|
|
85 |
QCOMPARE(info.sourceFilePath, QLatin1String("/Users/foo/build/qt-4.4/lib/phonon.framework/Versions/4/phonon"));
|
|
86 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/phonon.framework/Versions/4"));
|
|
87 |
}
|
|
88 |
|
|
89 |
{
|
|
90 |
QString line = " /usr/local/Trolltech/Qt-4.4.0/lib/phonon.framework/Versions/4/phonon (compatibility version 4.1.0, current version 4.1.0)";
|
|
91 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
92 |
// qDebug() << info;
|
|
93 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/usr/local/Trolltech/Qt-4.4.0/lib/"));
|
|
94 |
QCOMPARE(info.frameworkName, QLatin1String("phonon.framework"));
|
|
95 |
QCOMPARE(info.frameworkPath, QLatin1String("/usr/local/Trolltech/Qt-4.4.0/lib/phonon.framework"));
|
|
96 |
QCOMPARE(info.binaryDirectory, QLatin1String("Versions/4"));
|
|
97 |
QCOMPARE(info.binaryName, QLatin1String("phonon"));
|
|
98 |
QCOMPARE(info.binaryPath, QLatin1String("/Versions/4/phonon"));
|
|
99 |
QCOMPARE(info.version, QLatin1String("4"));
|
|
100 |
QCOMPARE(info.installName, QLatin1String("/usr/local/Trolltech/Qt-4.4.0/lib/phonon.framework/Versions/4/phonon"));
|
|
101 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/phonon.framework/Versions/4/phonon"));
|
|
102 |
QCOMPARE(info.sourceFilePath, QLatin1String("/usr/local/Trolltech/Qt-4.4.0/lib/phonon.framework/Versions/4/phonon"));
|
|
103 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/phonon.framework/Versions/4"));
|
|
104 |
}
|
|
105 |
|
|
106 |
{
|
|
107 |
QString line = " QtGui.framework/Versions/4/QtGui (compatibility version 4.1.0, current version 4.1.0)";
|
|
108 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
109 |
// qDebug() << info;
|
|
110 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/Library/Frameworks/"));
|
|
111 |
QCOMPARE(info.frameworkName, QLatin1String("QtGui.framework"));
|
|
112 |
QCOMPARE(info.frameworkPath, QLatin1String("/Library/Frameworks/QtGui.framework"));
|
|
113 |
QCOMPARE(info.binaryDirectory, QLatin1String("Versions/4"));
|
|
114 |
QCOMPARE(info.binaryName, QLatin1String("QtGui"));
|
|
115 |
QCOMPARE(info.binaryPath, QLatin1String("/Versions/4/QtGui"));
|
|
116 |
QCOMPARE(info.version, QLatin1String("4"));
|
|
117 |
QCOMPARE(info.installName, QLatin1String("QtGui.framework/Versions/4/QtGui"));
|
|
118 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui"));
|
|
119 |
QCOMPARE(info.sourceFilePath, QLatin1String("/Library/Frameworks/QtGui.framework/Versions/4/QtGui"));
|
|
120 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/QtGui.framework/Versions/4"));
|
|
121 |
}
|
|
122 |
|
|
123 |
{
|
|
124 |
QString line = " phonon.framework/Versions/4/QtGui (compatibility version 4.1.0, current version 4.1.0)";
|
|
125 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
126 |
// qDebug() << info;
|
|
127 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/Library/Frameworks/"));
|
|
128 |
QCOMPARE(info.frameworkName, QLatin1String("phonon.framework"));
|
|
129 |
QCOMPARE(info.frameworkPath, QLatin1String("/Library/Frameworks/phonon.framework"));
|
|
130 |
QCOMPARE(info.binaryDirectory, QLatin1String("Versions/4"));
|
|
131 |
QCOMPARE(info.binaryName, QLatin1String("phonon"));
|
|
132 |
QCOMPARE(info.binaryPath, QLatin1String("/Versions/4/phonon"));
|
|
133 |
QCOMPARE(info.version, QLatin1String("4"));
|
|
134 |
QCOMPARE(info.installName, QLatin1String("phonon.framework/Versions/4/phonon"));
|
|
135 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/phonon.framework/Versions/4/phonon"));
|
|
136 |
QCOMPARE(info.sourceFilePath, QLatin1String("/Library/Frameworks/phonon.framework/Versions/4/phonon"));
|
|
137 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/phonon.framework/Versions/4"));
|
|
138 |
}
|
|
139 |
|
|
140 |
{
|
|
141 |
QString line = " /Users/foo/build/qt-4.4/lib/libQtCLucene.4.dylib (compatibility version 4.4.0, current version 4.4.0)";
|
|
142 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
143 |
// qDebug() << info;
|
|
144 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/Users/foo/build/qt-4.4/lib/"));
|
|
145 |
QCOMPARE(info.binaryName, QLatin1String("libQtCLucene.4.dylib"));
|
|
146 |
QCOMPARE(info.frameworkName, QLatin1String("libQtCLucene.4.dylib"));
|
|
147 |
QCOMPARE(info.frameworkPath, QLatin1String("/Users/foo/build/qt-4.4/lib/libQtCLucene.4.dylib"));
|
|
148 |
QCOMPARE(info.installName, QLatin1String("/Users/foo/build/qt-4.4/lib/libQtCLucene.4.dylib"));
|
|
149 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/libQtCLucene.4.dylib"));
|
|
150 |
QCOMPARE(info.sourceFilePath, QLatin1String("/Users/foo/build/qt-4.4/lib/libQtCLucene.4.dylib"));
|
|
151 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/"));
|
|
152 |
}
|
|
153 |
{
|
|
154 |
QString line = "libQtCLucene.4.dylib (compatibility version 4.4.0, current version 4.4.0)";
|
|
155 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
156 |
// qDebug() << info;
|
|
157 |
QCOMPARE(info.frameworkDirectory, QLatin1String("/usr/lib/"));
|
|
158 |
QCOMPARE(info.binaryName, QLatin1String("libQtCLucene.4.dylib"));
|
|
159 |
QCOMPARE(info.frameworkName, QLatin1String("libQtCLucene.4.dylib"));
|
|
160 |
QCOMPARE(info.frameworkPath, QLatin1String("/usr/lib/libQtCLucene.4.dylib"));
|
|
161 |
QCOMPARE(info.installName, QLatin1String("libQtCLucene.4.dylib"));
|
|
162 |
QCOMPARE(info.deployedInstallName, QLatin1String("@executable_path/../Frameworks/libQtCLucene.4.dylib"));
|
|
163 |
QCOMPARE(info.sourceFilePath, QLatin1String("/usr/lib/libQtCLucene.4.dylib"));
|
|
164 |
QCOMPARE(info.destinationDirectory, QLatin1String("Contents/Frameworks/"));
|
|
165 |
}
|
|
166 |
{
|
|
167 |
QString line = "/foo"; //invalid
|
|
168 |
FrameworkInfo info = parseOtoolLibraryLine(line);
|
|
169 |
QCOMPARE(info.frameworkName, QString());
|
|
170 |
}
|
|
171 |
|
|
172 |
}
|
|
173 |
|
|
174 |
void tst_deployment_mac::testgetQtFrameworks()
|
|
175 |
{
|
|
176 |
{
|
|
177 |
QStringList otool = QStringList()
|
|
178 |
<< "/Users/foo/build/qt-4.4/lib/phonon.framework/Versions/4/phonon (compatibility version 4.1.0, current version 4.1.0)"
|
|
179 |
<< "/Users/foo/build/qt-4.4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.4.0, current version 4.4.0)"
|
|
180 |
<< "/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0)"
|
|
181 |
<< "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.27.0)"
|
|
182 |
<< "/Users/foo/build/qt-4.4/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.4.0, current version 4.4.0)"
|
|
183 |
<< "/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)"
|
|
184 |
<< "/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)"
|
|
185 |
<< "/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)"
|
|
186 |
<< "/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)"
|
|
187 |
<< " "
|
|
188 |
;
|
|
189 |
|
|
190 |
QList<FrameworkInfo> frameworks = getQtFrameworks(otool);
|
|
191 |
QCOMPARE(frameworks.count(), 3);
|
|
192 |
QCOMPARE(frameworks.at(0).binaryName, QLatin1String("phonon"));
|
|
193 |
QCOMPARE(frameworks.at(1).binaryName, QLatin1String("QtGui"));
|
|
194 |
QCOMPARE(frameworks.at(2).binaryName, QLatin1String("QtCore"));
|
|
195 |
}
|
|
196 |
{
|
|
197 |
QStringList otool = QStringList()
|
|
198 |
<< "QtHelp.framework/Versions/4/QtHelp (compatibility version 4.4.0, current version 4.4.0)"
|
|
199 |
<< "libQtCLucene.4.dylib (compatibility version 4.4.0, current version 4.4.0)"
|
|
200 |
<< "QtSql.framework/Versions/4/QtSql (compatibility version 4.4.0, current version 4.4.0)"
|
|
201 |
<< "QtXml.framework/Versions/4/QtXml (compatibility version 4.4.0, current version 4.4.0)"
|
|
202 |
<< "QtGui.framework/Versions/4/QtGui (compatibility version 4.4.0, current version 4.4.0)"
|
|
203 |
<< "/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)"
|
|
204 |
<< "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.42.0)"
|
|
205 |
<< "QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.4.0, current version 4.4.0)"
|
|
206 |
<< "QtCore.framework/Versions/4/QtCore (compatibility version 4.4.0, current version 4.4.0)"
|
|
207 |
<< "/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)"
|
|
208 |
<< "/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6)"
|
|
209 |
<< "/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)"
|
|
210 |
<< "/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)"
|
|
211 |
;
|
|
212 |
|
|
213 |
QList<FrameworkInfo> frameworks = getQtFrameworks(otool);
|
|
214 |
QCOMPARE(frameworks.count(), 7);
|
|
215 |
QCOMPARE(frameworks.at(0).binaryName, QLatin1String("QtHelp"));
|
|
216 |
QCOMPARE(frameworks.at(1).binaryName, QLatin1String("libQtCLucene.4.dylib"));
|
|
217 |
QCOMPARE(frameworks.at(2).binaryName, QLatin1String("QtSql"));
|
|
218 |
QCOMPARE(frameworks.at(3).binaryName, QLatin1String("QtXml"));
|
|
219 |
QCOMPARE(frameworks.at(4).binaryName, QLatin1String("QtGui"));
|
|
220 |
QCOMPARE(frameworks.at(5).binaryName, QLatin1String("QtNetwork"));
|
|
221 |
QCOMPARE(frameworks.at(6).binaryName, QLatin1String("QtCore"));
|
|
222 |
}
|
|
223 |
|
|
224 |
}
|
|
225 |
|
|
226 |
void tst_deployment_mac::testFindAppBinarty()
|
|
227 |
{
|
|
228 |
QCOMPARE(findAppBinary("tst_deployment_mac.app"), QLatin1String("tst_deployment_mac.app/Contents/MacOS/tst_deployment_mac"));
|
|
229 |
}
|
|
230 |
|
|
231 |
QTEST_MAIN(tst_deployment_mac)
|
|
232 |
|
|
233 |
#include "tst_deployment_mac.moc" |