summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-25 10:55:00 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-25 16:22:00 +0200
commitf45d6414ad6ef1d75f049a61411cd954bcae29c3 (patch)
treeebde425c3c7b2dab39227f49d5ea460d9088fc14 /tests
parent79a389c34618880fab7a0b4f397ed3b0f0c0c675 (diff)
Fix qmake's pro file cache to interact correctly with write_file
When writing a file with write_file() we have to inform the pro file parser cache to discard the file if it's existant in the cache, to ensure that calling include() after write_file() always works. Change-Id: I7d09269a57de55ca30b0e11dd40770de9f919f64 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro19
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp7
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro b/tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro
new file mode 100644
index 0000000000..e324c3f25f
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+CONFIG -= debug_and_release_target
+
+SOURCES =
+
+content = ""
+write_file("include.pri", content)
+include(include.pri)
+
+content = "SOURCES = main.cpp"
+write_file("include.pri", content)
+include(include.pri)
+
+# Make sure that including the .pri file a second time will reload it properly
+# off disk with the new content.
+isEmpty(SOURCES): error(No sources defined)
+
+# Empty it again to silence qmake about non-existance sources
+SOURCES =
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index 6e2eb316b9..fbecb7db96 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -92,6 +92,7 @@ private slots:
void includefunction();
void substitutes();
void project();
+ void proFileCache();
private:
TestCompiler test_compiler;
@@ -546,5 +547,11 @@ void tst_qmake::project()
QVERIFY( test_compiler.removeProject( workDir, "project" ));
}
+void tst_qmake::proFileCache()
+{
+ QString workDir = base_path + "/testdata/pro_file_cache";
+ QVERIFY( test_compiler.qmake( workDir, "pro_file_cache" ));
+}
+
QTEST_MAIN(tst_qmake)
#include "tst_qmake.moc"