summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-05-29 20:18:51 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-06-04 15:42:13 +0200
commit66802ef8bf7989dc025e34bf91d93576189c483c (patch)
treeeffeeaa771262109d38686d5009d00632e569a51 /tests
parent571234786a3ff7e8e3a9220f12d22a9f74f7a53c (diff)
downloadqt-creator-66802ef8bf7989dc025e34bf91d93576189c483c.tar.gz
implement simple VFS to support caching during project parsing
this tremendously speeds up loading of qt 5.1 based projects (including qt itself) under mac os, as these look up the sdk dynamically, and use caching to avoid doing that in every subproject. Change-Id: I833253f81c3159056fab2ff888f293b36cc2ef56 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/profilewriter/tst_profilewriter.cpp16
-rw-r--r--tests/manual/proparser/main.cpp13
-rw-r--r--tests/manual/proparser/testreader.pro23
3 files changed, 40 insertions, 12 deletions
diff --git a/tests/auto/profilewriter/tst_profilewriter.cpp b/tests/auto/profilewriter/tst_profilewriter.cpp
index cf31b48efe..4dd71629b8 100644
--- a/tests/auto/profilewriter/tst_profilewriter.cpp
+++ b/tests/auto/profilewriter/tst_profilewriter.cpp
@@ -27,6 +27,7 @@
**
****************************************************************************/
+#include <qmakevfs.h>
#include <qmakeparser.h>
#include <prowriter.h>
@@ -449,7 +450,8 @@ void tst_ProFileWriter::adds()
QStringList lines = input.isEmpty() ? QStringList() : input.split(QLatin1String("\n"));
QString var = QLatin1String("SOURCES");
- QMakeParser parser(0, &parseHandler);
+ QMakeVfs vfs;
+ QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
PW::putVarValues(proFile, &lines, values, var, PW::PutFlags(flags), scope);
@@ -619,7 +621,8 @@ void tst_ProFileWriter::removes()
QStringList lines = input.split(QLatin1String("\n"));
QStringList vars; vars << QLatin1String("SOURCES");
- QMakeParser parser(0, &parseHandler);
+ QMakeVfs vfs;
+ QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::removeVarValues(proFile, &lines, values, vars);
@@ -647,7 +650,8 @@ void tst_ProFileWriter::multiVar()
<< QString::fromLatin1(BASE_DIR "/bak");
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
- QMakeParser parser(0, &parseHandler);
+ QMakeVfs vfs;
+ QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
@@ -667,7 +671,8 @@ void tst_ProFileWriter::addFiles()
" sub/bar.cpp"
);
- QMakeParser parser(0, &parseHandler);
+ QMakeVfs vfs;
+ QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, QDir(BASE_DIR),
@@ -688,7 +693,8 @@ void tst_ProFileWriter::removeFiles()
"SOURCES = foo.cpp"
);
- QMakeParser parser(0, &parseHandler);
+ QMakeVfs vfs;
+ QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, QDir(BASE_DIR),
diff --git a/tests/manual/proparser/main.cpp b/tests/manual/proparser/main.cpp
index 36ee676106..c7b5d97232 100644
--- a/tests/manual/proparser/main.cpp
+++ b/tests/manual/proparser/main.cpp
@@ -28,6 +28,7 @@
****************************************************************************/
#include "qmakeglobals.h"
+#include "qmakevfs.h"
#include "qmakeparser.h"
#include "qmakeevaluator.h"
#include "profileevaluator.h"
@@ -69,14 +70,15 @@ public:
static EvalHandler evalHandler;
static int evaluate(const QString &fileName, const QString &in_pwd, const QString &out_pwd,
- bool cumulative, ProFileGlobals *option, QMakeParser *parser, int level)
+ bool cumulative, ProFileGlobals *option, QMakeParser *parser, QMakeVfs *vfs,
+ int level)
{
static QSet<QString> visited;
if (visited.contains(fileName))
return 0;
visited.insert(fileName);
- ProFileEvaluator visitor(option, parser, &evalHandler);
+ ProFileEvaluator visitor(option, parser, vfs, &evalHandler);
#ifdef PROEVALUATOR_CUMULATIVE
visitor.setCumulative(cumulative);
#endif
@@ -130,7 +132,7 @@ static int evaluate(const QString &fileName, const QString &in_pwd, const QStrin
fflush(stdout);
nlevel++;
}
- evaluate(inFile, inPwd, outPwd, cumulative, option, parser, nlevel);
+ evaluate(inFile, inPwd, outPwd, cumulative, option, parser, vfs, nlevel);
}
}
@@ -195,6 +197,7 @@ int main(int argc, char **argv)
out_pwd = in_pwd;
option.setDirectories(in_pwd, out_pwd);
- QMakeParser parser(0, &evalHandler);
- return evaluate(file, in_pwd, out_pwd, cumulative, &option, &parser, level);
+ QMakeVfs vfs;
+ QMakeParser parser(0, &vfs, &evalHandler);
+ return evaluate(file, in_pwd, out_pwd, cumulative, &option, &parser, &vfs, level);
}
diff --git a/tests/manual/proparser/testreader.pro b/tests/manual/proparser/testreader.pro
index 6d58c9e257..022ac67667 100644
--- a/tests/manual/proparser/testreader.pro
+++ b/tests/manual/proparser/testreader.pro
@@ -15,8 +15,27 @@ build_all:!build_pass {
CONFIG += release
}
-SOURCES = main.cpp qmakeglobals.cpp qmakeparser.cpp qmakeevaluator.cpp profileevaluator.cpp qmakebuiltins.cpp proitems.cpp ioutils.cpp
-HEADERS = qmakeglobals.h qmakeparser.h profileevaluator.h qmakeevaluator.h qmakeevaluator_p.h proitems.h ioutils.h
+SOURCES += \
+ main.cpp \
+ qmakeglobals.cpp \
+ qmakeparser.cpp \
+ qmakeevaluator.cpp \
+ profileevaluator.cpp \
+ qmakebuiltins.cpp \
+ proitems.cpp \
+ qmakevfs.cpp \
+ ioutils.cpp
+
+HEADERS += \
+ qmake_global.h \
+ qmakeglobals.h \
+ qmakeparser.h \
+ qmakeevaluator.h \
+ qmakeevaluator_p.h \
+ profileevaluator.h \
+ proitems.h \
+ qmakevfs.h \
+ ioutils.h
RESOURCES += proparser.qrc
DEFINES += QMAKE_BUILTIN_PRFS