summaryrefslogtreecommitdiffstats
path: root/patches/0103-Modularized-tst_symbols.patch
blob: fa13d33ee4b4b6f07cb55dcfff33928c9f3ffc16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
From 4251a251f1e704420c47249519e5ab1666ffbf20 Mon Sep 17 00:00:00 2001
From: Liang Qi <liang.qi@nokia.com>
Date: Tue, 22 Mar 2011 20:04:58 +0100
Subject: [PATCH] Modularized tst_symbols

---
 qtqa/tests/auto/symbols/symbols.pro     |    1 +
 qtqa/tests/auto/symbols/tst_symbols.cpp |   51 +++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/qtqa/tests/auto/symbols/symbols.pro b/qtqa/tests/auto/symbols/symbols.pro
index 2b772f4..370aee5 100644
--- a/qtqa/tests/auto/symbols/symbols.pro
+++ b/qtqa/tests/auto/symbols/symbols.pro
@@ -1,6 +1,7 @@
 load(qttest_p4)
 
 cross_compile: DEFINES += QT_CROSS_COMPILED
+INCLUDEPATH += ../../shared
 SOURCES += tst_symbols.cpp
 QT = core
 
diff --git a/qtqa/tests/auto/symbols/tst_symbols.cpp b/qtqa/tests/auto/symbols/tst_symbols.cpp
index 6f21c71..ff5d3a3 100644
--- a/qtqa/tests/auto/symbols/tst_symbols.cpp
+++ b/qtqa/tests/auto/symbols/tst_symbols.cpp
@@ -43,6 +43,8 @@
 #include <QtCore/QtCore>
 #include <QtTest/QtTest>
 
+#include "global.h"
+
 #ifdef QT_NAMESPACE
 #define STRINGIFY_HELPER(s) #s
 #define STRINGIFY(s) STRINGIFY_HELPER(s)
@@ -55,10 +57,43 @@ class tst_Symbols: public QObject
 {
     Q_OBJECT
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
+
     void prefix();
     void globalObjects();
+
+private:
+    QString qtModuleDir;
+    QString qtBaseDir;
+    QHash<QString, QString> modules;
+    QStringList keys;
 };
 
+void tst_Symbols::initTestCase()
+{
+    qtModuleDir = QString::fromLocal8Bit(qgetenv("QT_MODULE_TO_TEST"));
+    QVERIFY2(!qtModuleDir.isEmpty(), "This test needs $QT_MODULE_TO_TEST, we need it to search data and etc.");
+
+    QString configFile = qtModuleDir + "/tests/global/global.cfg";
+    modules = qt_tests_shared_global_get_modules(configFile);
+
+    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.");
+
+    keys = modules.keys();
+    QList<QString>::iterator i;
+    for (i = keys.begin(); i != keys.end(); ++i)
+        *i = "lib" + *i + ".so";
+    qDebug() << keys;
+}
+
+void tst_Symbols::cleanupTestCase()
+{
+}
+
 /* Computes the line number from a symbol */
 static QString symbolToLine(const QString &symbol, const QString &lib)
 {
@@ -111,11 +146,14 @@ void tst_Symbols::globalObjects()
 
     bool isFailed = false;
 
-    QDir dir(QLibraryInfo::location(QLibraryInfo::LibrariesPath), "*.so");
+    QDir dir(qtBaseDir + "/lib", "*.so");
     QStringList files = dir.entryList();
     QVERIFY(!files.isEmpty());
 
     foreach (QString lib, files) {
+        if (!keys.contains(lib))
+            continue;
+
         if (lib == "libQtCLucene.so") {
             // skip this library, it's 3rd-party C++
             continue;
@@ -125,6 +163,9 @@ void tst_Symbols::globalObjects()
             continue;
         }
 
+        qDebug() << lib
+                 << ", " << dir.absolutePath();
+
         QProcess proc;
         proc.start("nm",
            QStringList() << "-C" << "--format=posix"
@@ -288,17 +329,23 @@ void tst_Symbols::prefix()
     excusedPrefixes["phonon"] =
         QStringList() << ns + "Phonon";
 
-    QDir dir(qgetenv("QTDIR") + "/lib", "*.so");
+    QDir dir(qtBaseDir + "/lib", "*.so");
     QStringList files = dir.entryList();
     QVERIFY(!files.isEmpty());
 
     bool isFailed = false;
     foreach (QString lib, files) {
+        if (!keys.contains(lib))
+            continue;
+
         if (lib.contains("Designer") || lib.contains("QtCLucene") || lib.contains("XmlPatternsSDK"))
             continue;
 
         bool isPhonon = lib.contains("phonon");
 
+        qDebug() << lib
+                 << ", " << dir.absolutePath();
+
         QProcess proc;
         proc.start("nm",
            QStringList() << "-g" << "-C" << "-D" << "--format=posix"
-- 
1.7.5.rc2.4.g4d8b3