summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-08-22 14:40:50 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-23 04:58:10 +0200
commitf68a9bcad26c2cfa3f3d1191c56a346a574d154b (patch)
treecef1b538908efaab0b930fd454583e0b63dbcc67
parent336de9f237c42d54fc89fa7b859da57f22583afa (diff)
test: replace QT_MODULE_KERNEL with QLibraryInfo to find Qt lib dir
QLibraryInfo is the canonical way to programmatically obtain the location of the Qt libs dir. Previously this test used an environment variable named QT_MODULE_KERNEL. No test script has ever contained the logic for setting this variable. Also, using QLibraryInfo avoids assuming that the libs directory is located at $PREFIX/lib, which is not necessarily the case for custom builds. Change-Id: I41d8c8cc1647969f022d22bc5a47d862ebf396b3 Reviewed-on: http://codereview.qt.nokia.com/3283 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Keith Isdale <keith.isdale@nokia.com>
-rw-r--r--tests/auto/symbols/tst_symbols.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp
index e6e9db73..86d42466 100644
--- a/tests/auto/symbols/tst_symbols.cpp
+++ b/tests/auto/symbols/tst_symbols.cpp
@@ -65,7 +65,7 @@ private slots:
private:
QString qtModuleDir;
- QString qtBaseDir;
+ QString qtLibDir;
QHash<QString, QString> modules;
QStringList keys;
};
@@ -83,14 +83,19 @@ void tst_Symbols::initTestCase()
QVERIFY2(modules.size() > 0, "Something is wrong in the global config file.");
- qtBaseDir = QString::fromLocal8Bit(qgetenv("QT_MODULE_KERNEL"));
- QVERIFY2(!qtBaseDir.isEmpty(), "This test needs $QT_MODULE_KERNEL, we need it to search libs.");
+ qtLibDir = QLibraryInfo::location( QLibraryInfo::LibrariesPath );
+ QFileInfo qtLibDirInfo(qtLibDir);
+ QVERIFY2(qtLibDirInfo.isDir(), qPrintable(
+ QString("QLibraryInfo::LibrariesPath `%1' %2\nIs your build complete and installed?")
+ .arg(qtLibDir)
+ .arg(!qtLibDirInfo.exists() ? "doesn't exist" : "isn't a directory")
+ ));
keys = modules.keys();
QList<QString>::iterator i;
for (i = keys.begin(); i != keys.end(); ++i)
*i = "lib" + *i + ".so";
- qDebug() << keys;
+ qDebug() << qtLibDir << keys;
}
void tst_Symbols::cleanupTestCase()
@@ -149,7 +154,7 @@ void tst_Symbols::globalObjects()
bool isFailed = false;
- QDir dir(qtBaseDir + "/lib", "*.so");
+ QDir dir(qtLibDir, "*.so");
QStringList files = dir.entryList();
QVERIFY(!files.isEmpty());
@@ -328,7 +333,7 @@ void tst_Symbols::prefix()
excusedPrefixes["phonon"] =
QStringList() << ns + "Phonon";
- QDir dir(qtBaseDir + "/lib", "*.so");
+ QDir dir(qtLibDir, "*.so");
QStringList files = dir.entryList();
QVERIFY(!files.isEmpty());