aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-07-24 10:33:45 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2017-07-24 11:24:20 +0000
commit4f7df3758ca7601b7f8977e2256eb1f0191f7c5f (patch)
tree98bc8d482f3c0962aab496c62242186403185fda
parentf489dde33403e432286bddced04d2077aced02e0 (diff)
Add test case for a "dynamic project"
While we did not consciously implement that feature, we should strive to keep it working, as people are using it. Change-Id: I15f43a45b02e7c241bf9d37bed507b0c2037822d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs42
-rw-r--r--tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp1
-rw-r--r--tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp1
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp8
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
5 files changed, 53 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs b/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs
new file mode 100644
index 000000000..52a6857d2
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs
@@ -0,0 +1,42 @@
+import qbs
+import qbs.File
+import qbs.FileInfo
+import qbs.TextFile
+
+Project
+{
+ Probe
+ {
+ id: projectBuilder
+ property stringList refs: []
+
+ configure:
+ {
+ var tempDir = FileInfo.joinPaths(sourceDirectory, "temp");
+ File.makePath(tempDir);
+ var srcDir = FileInfo.joinPaths(sourceDirectory, "src");
+ var projectDirs = File.directoryEntries(srcDir, File.Dirs | File.NoDotAndDotDot);
+ var list = [];
+ for (it in projectDirs) {
+ var name = projectDirs[it];
+ var productSrcDir = FileInfo.joinPaths(srcDir, name);
+ var productFilePath = FileInfo.joinPaths(tempDir, name + ".qbs");
+ var file = new TextFile(productFilePath, TextFile.WriteOnly);
+ try {
+ file.writeLine("import qbs");
+ file.writeLine("CppApplication");
+ file.writeLine("{");
+ file.writeLine("\tfiles: [ \"" + productSrcDir + "/*.cpp\" ]");
+ file.writeLine("}");
+ } finally {
+ file.close();
+ }
+ list.push(productFilePath);
+ }
+ found = true;
+ refs = list;
+ }
+ }
+
+ references: projectBuilder.refs
+}
diff --git a/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp b/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp b/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 75e9bf0d9..7154893e6 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -2413,6 +2413,14 @@ void TestBlackbox::dynamicMultiplexRule()
QVERIFY(regularFileExists(outputFilePath));
}
+void TestBlackbox::dynamicProject()
+{
+ const QString testDir = testDataDir + "/dynamic-project";
+ QDir::setCurrent(testDir);
+ QCOMPARE(runQbs(), 0);
+ QCOMPARE(m_qbsStdout.count("compiling main.cpp"), 2);
+}
+
void TestBlackbox::dynamicRuleOutputs()
{
const QString testDir = testDataDir + "/dynamicRuleOutputs";
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 505019b4b..1337644fb 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -66,6 +66,7 @@ private slots:
void deprecatedProperty();
void disappearedProfile();
void dynamicMultiplexRule();
+ void dynamicProject();
void dynamicRuleOutputs();
void enableExceptions();
void enableExceptions_data();