aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-04-15 17:44:55 +0200
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-04-15 17:45:24 +0200
commitadeb73931197ad6b6cc42ae573bca94d7500c860 (patch)
treec4d9f8413eeaa62b7bf33358ff414d986005a878 /tests
parent4c99d114d30dac54ff624843b535a3e24b2022b9 (diff)
parente31446f563ec8fb1f23e073a97017a5661fbede9 (diff)
Merge remote-tracking branch 'origin/1.5'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/api/testdata/error-in-setup-run-environment/error-in-setup-run-environment.qbs5
-rw-r--r--tests/auto/api/testdata/error-in-setup-run-environment/modules/mymodule/mymodule.qbs7
-rw-r--r--tests/auto/api/testdata/moc-hpp-included/object2.h13
-rw-r--r--tests/auto/api/testdata/moc-hpp-included/object2.mm16
-rw-r--r--tests/auto/api/testdata/moc-hpp-included/project.qbs6
-rw-r--r--tests/auto/api/testdata/simple-probe/project.qbs6
-rw-r--r--tests/auto/api/tst_api.cpp30
-rw-r--r--tests/auto/api/tst_api.h1
-rw-r--r--tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs167
-rw-r--r--tests/auto/blackbox/testdata/bundle-structure/dummy.c1
-rw-r--r--tests/auto/blackbox/testdata/bundle-structure/dummy.h0
-rw-r--r--tests/auto/blackbox/testdata/bundle-structure/dummy_p.h0
-rw-r--r--tests/auto/blackbox/testdata/bundle-structure/resource.txt0
-rw-r--r--tests/auto/blackbox/testdata/change-in-imported-file/prepare.js2
-rw-r--r--tests/auto/blackbox/testdata/concurrent-executor/concurrent-executor.qbs2
-rw-r--r--tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs9
-rw-r--r--tests/auto/blackbox/testdata/deploymentTarget/main.c1
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/empty.m1
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/empty.mm1
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/emptymain.cpp1
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/exceptions-objc.qbs6
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp-cpp.qbs6
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp.qbs7
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/exceptions.qbs7
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/main.cpp8
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/main.m5
-rw-r--r--tests/auto/blackbox/testdata/enableExceptions/none.qbs10
-rw-r--r--tests/auto/blackbox/testdata/enableRtti/main.cpp23
-rw-r--r--tests/auto/blackbox/testdata/enableRtti/rtti.qbs13
-rw-r--r--tests/auto/blackbox/testdata/error-info/helper.js9
-rw-r--r--tests/auto/blackbox/testdata/error-info/project.qbs71
-rw-r--r--tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs2
-rw-r--r--tests/auto/blackbox/testdata/nodejs/hello.qbs1
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/dependee.qbs15
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/dependency.qbs8
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/modules/depmodule/depmodule.qbs21
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/modules/mymodule/mymodule.qbs27
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/probe-in-exported-module.qbs5
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/test.in0
-rw-r--r--tests/auto/blackbox/testdata/probe-in-exported-module/test2.in0
-rw-r--r--tests/auto/blackbox/testdata/probeProperties/bin/tool0
-rw-r--r--tests/auto/blackbox/testdata/probeProperties/main.c1
-rw-r--r--tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs30
-rw-r--r--tests/auto/blackbox/testdata/referenceErrorInExport/main.c1
-rw-r--r--tests/auto/blackbox/testdata/referenceErrorInExport/project.qbs20
-rw-r--r--tests/auto/blackbox/testdata/separate-debug-info/project.qbs73
-rw-r--r--tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js2
-rw-r--r--tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs2
-rw-r--r--tests/auto/blackbox/testdata/typescript/typescript.qbs3
-rw-r--r--tests/auto/blackbox/testdata/versionscript/versionscript.qbs2
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp537
-rw-r--r--tests/auto/blackbox/tst_blackbox.h11
52 files changed, 1159 insertions, 36 deletions
diff --git a/tests/auto/api/testdata/error-in-setup-run-environment/error-in-setup-run-environment.qbs b/tests/auto/api/testdata/error-in-setup-run-environment/error-in-setup-run-environment.qbs
new file mode 100644
index 000000000..f3247f6f8
--- /dev/null
+++ b/tests/auto/api/testdata/error-in-setup-run-environment/error-in-setup-run-environment.qbs
@@ -0,0 +1,5 @@
+import qbs
+
+CppApplication {
+ Depends { name: "mymodule" }
+}
diff --git a/tests/auto/api/testdata/error-in-setup-run-environment/modules/mymodule/mymodule.qbs b/tests/auto/api/testdata/error-in-setup-run-environment/modules/mymodule/mymodule.qbs
new file mode 100644
index 000000000..e698b45b5
--- /dev/null
+++ b/tests/auto/api/testdata/error-in-setup-run-environment/modules/mymodule/mymodule.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+Module {
+ setupRunEnvironment: {
+ trallala
+ }
+}
diff --git a/tests/auto/api/testdata/moc-hpp-included/object2.h b/tests/auto/api/testdata/moc-hpp-included/object2.h
new file mode 100644
index 000000000..14e811124
--- /dev/null
+++ b/tests/auto/api/testdata/moc-hpp-included/object2.h
@@ -0,0 +1,13 @@
+#ifndef OBJECT2_H
+#define OBJECT2_H
+#include <QObject>
+
+class Object2 : public QObject
+{
+ Q_OBJECT
+public:
+ Object2(QObject *parent = 0);
+};
+
+#endif
+
diff --git a/tests/auto/api/testdata/moc-hpp-included/object2.mm b/tests/auto/api/testdata/moc-hpp-included/object2.mm
new file mode 100644
index 000000000..6fd95d31f
--- /dev/null
+++ b/tests/auto/api/testdata/moc-hpp-included/object2.mm
@@ -0,0 +1,16 @@
+#include "object2.h"
+
+Object2::Object2(QObject *parent)
+ : QObject(parent)
+{}
+
+#include "moc_object2.cpp"
+#include <cstdio>
+
+int main2()
+{
+ Object2 obj;
+ printf("Hello World\n");
+ return 0;
+}
+
diff --git a/tests/auto/api/testdata/moc-hpp-included/project.qbs b/tests/auto/api/testdata/moc-hpp-included/project.qbs
index d78493b2f..554b0a2b3 100644
--- a/tests/auto/api/testdata/moc-hpp-included/project.qbs
+++ b/tests/auto/api/testdata/moc-hpp-included/project.qbs
@@ -8,11 +8,11 @@ Project {
Depends { name: "Qt.core" }
- files : [ "object.cpp" ]
+ files: ["object.cpp", "object.h"]
Group {
- files : [ "object.h" ]
- fileTags: [ "hpp" ]
+ condition: qbs.targetOS.contains("darwin")
+ files: ["object2.mm", "object2.h"]
}
}
}
diff --git a/tests/auto/api/testdata/simple-probe/project.qbs b/tests/auto/api/testdata/simple-probe/project.qbs
index 9a869c3de..34700a99b 100644
--- a/tests/auto/api/testdata/simple-probe/project.qbs
+++ b/tests/auto/api/testdata/simple-probe/project.qbs
@@ -16,17 +16,17 @@ CppApplication {
found = false;
}
}
+ type: ["application"]
name: "MyApp"
- type: {
+ consoleApplication: {
if (!probe1.found)
throw "probe1 not found";
if (probe2.found)
throw "probe2 unexpectedly found";
if (probe1.someString !== "one")
throw "probe1.someString expected to be \"one\"."
- return "application"
+ return true
}
- consoleApplication: true
files: ["main.cpp"]
}
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index de930a13d..e90237f40 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -32,6 +32,7 @@
#include "../shared.h"
+#include <api/runenvironment.h>
#include <qbs.h>
#include <tools/fileinfo.h>
#include <tools/hostosinfo.h>
@@ -828,6 +829,35 @@ void TestApi::enableAndDisableProduct()
QVERIFY(!bdr.descriptions.contains("compiling"));
}
+void TestApi::errorInSetupRunEnvironment()
+{
+ qbs::SetupProjectParameters setupParams
+ = defaultSetupParameters("error-in-setup-run-environment/"
+ "error-in-setup-run-environment.qbs");
+ QScopedPointer<qbs::SetupProjectJob> job(qbs::Project().setupProject(setupParams,
+ m_logSink, 0));
+ waitForFinished(job.data());
+ QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString()));
+ const qbs::Project project = job->project();
+ QVERIFY(project.isValid());
+ QCOMPARE(project.projectData().products().count(), 1);
+ const qbs::ProductData product = project.projectData().products().first();
+
+ bool exceptionCaught = false;
+ try {
+ qbs::Settings settings((QString()));
+ qbs::RunEnvironment runEnv = project.getRunEnvironment(product, qbs::InstallOptions(),
+ QProcessEnvironment(), &settings);
+ qbs::ErrorInfo error;
+ const QProcessEnvironment env = runEnv.runEnvironment(&error);
+ QVERIFY(error.hasError());
+ QVERIFY(error.toString().contains("trallala"));
+ } catch (const qbs::ErrorInfo &e) {
+ exceptionCaught = true;
+ }
+ QVERIFY(!exceptionCaught);
+}
+
static qbs::ErrorInfo forceRuleEvaluation(const qbs::Project project)
{
qbs::BuildOptions buildOptions;
diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h
index 57be0d660..92571781b 100644
--- a/tests/auto/api/tst_api.h
+++ b/tests/auto/api/tst_api.h
@@ -79,6 +79,7 @@ private slots:
void emptyFileTagList();
void emptySubmodulesList();
void enableAndDisableProduct();
+ void errorInSetupRunEnvironment();
void explicitlyDependsOn();
void exportSimple();
void exportWithRecursiveDepends();
diff --git a/tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs b/tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs
new file mode 100644
index 000000000..19586522c
--- /dev/null
+++ b/tests/auto/blackbox/testdata/bundle-structure/bundle-structure.qbs
@@ -0,0 +1,167 @@
+import qbs
+
+Project {
+ property stringList bundleFileTags: [
+ "aggregate_infoplist", "pkginfo", "hpp",
+ "icns", "resourcerules", "xcent",
+ "compiled_ibdoc", "compiled_assetcatalog",
+ "bundle.symlink.headers", "bundle.symlink.private-headers",
+ "bundle.symlink.resources", "bundle.symlink.executable",
+ "bundle.symlink.version", "bundle.hpp", "bundle.resource",
+ ]
+
+ property stringList buildableProducts: ["A", "B", "C", "D", "E", "F", "G"]
+
+ Application {
+ Depends { name: "cpp" }
+ Depends { name: "B" }
+ Depends { name: "C" }
+ Depends { name: "D" }
+ condition: buildableProducts.contains("A")
+ name: "A"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ Application {
+ Depends { name: "cpp" }
+ Depends { name: "B" }
+ Depends { name: "C" }
+ Depends { name: "D" }
+ condition: buildableProducts.contains("ABadApple")
+ name: "ABadApple"
+ bundle._productTypeIdentifier: "com.apple.product-type.will.never.exist.ever.guaranteed"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ Application {
+ Depends { name: "cpp" }
+ Depends { name: "B" }
+ Depends { name: "C" }
+ Depends { name: "D" }
+ condition: buildableProducts.contains("ABadThirdParty")
+ name: "ABadThirdParty"
+ bundle._productTypeIdentifier: "org.special.third.party.non.existent.product.type"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ DynamicLibrary {
+ Depends { name: "cpp" }
+ condition: buildableProducts.containsAny(["A", "B", "ABadApple", "ABadThirdParty"])
+ name: "B"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ StaticLibrary {
+ Depends { name: "cpp" }
+ condition: buildableProducts.containsAny(["A", "C", "ABadApple", "ABadThirdParty"])
+ name: "C"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ LoadableModule {
+ Depends { name: "cpp" }
+ condition: buildableProducts.containsAny(["A", "D", "ABadApple", "ABadThirdParty"])
+ name: "D"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ ApplicationExtension {
+ Depends { name: "cpp" }
+ condition: buildableProducts.contains("E")
+ name: "E"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ XPCService {
+ Depends { name: "cpp" }
+ condition: buildableProducts.contains("F")
+ name: "F"
+ bundle.isBundle: true
+ bundle.publicHeaders: ["dummy.h"]
+ bundle.privateHeaders: ["dummy_p.h"]
+ bundle.resources: ["resource.txt"]
+ files: ["dummy.c"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ Product {
+ Depends { name: "bundle" }
+ condition: buildableProducts.contains("G")
+ type: ["inapppurchase"]
+ name: "G"
+ bundle.isBundle: true
+ bundle.resources: ["resource.txt"]
+ Group {
+ fileTagsFilter: product.type.concat(project.bundleFileTags)
+ qbs.install: true
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/bundle-structure/dummy.c b/tests/auto/blackbox/testdata/bundle-structure/dummy.c
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/bundle-structure/dummy.c
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata/bundle-structure/dummy.h b/tests/auto/blackbox/testdata/bundle-structure/dummy.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/bundle-structure/dummy.h
diff --git a/tests/auto/blackbox/testdata/bundle-structure/dummy_p.h b/tests/auto/blackbox/testdata/bundle-structure/dummy_p.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/bundle-structure/dummy_p.h
diff --git a/tests/auto/blackbox/testdata/bundle-structure/resource.txt b/tests/auto/blackbox/testdata/bundle-structure/resource.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/bundle-structure/resource.txt
diff --git a/tests/auto/blackbox/testdata/change-in-imported-file/prepare.js b/tests/auto/blackbox/testdata/change-in-imported-file/prepare.js
index 8d1b44c61..fa73f0ff1 100644
--- a/tests/auto/blackbox/testdata/change-in-imported-file/prepare.js
+++ b/tests/auto/blackbox/testdata/change-in-imported-file/prepare.js
@@ -1,3 +1,3 @@
function prepare(cmd) {
- cmd.sourceCode = function() { print("old output"); };
+ cmd.sourceCode = function() { console.info("old output"); };
}
diff --git a/tests/auto/blackbox/testdata/concurrent-executor/concurrent-executor.qbs b/tests/auto/blackbox/testdata/concurrent-executor/concurrent-executor.qbs
index 672576263..9031890bd 100644
--- a/tests/auto/blackbox/testdata/concurrent-executor/concurrent-executor.qbs
+++ b/tests/auto/blackbox/testdata/concurrent-executor/concurrent-executor.qbs
@@ -27,7 +27,7 @@ Product {
cmd.createFile = i == 9;
cmd.sourceCode = function() {
if (createFile) {
- print("Creating file");
+ console.info("Creating file");
var file = new TextFile(output.filePath, TextFile.WriteOnly);
file.close();
}
diff --git a/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs b/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs
new file mode 100644
index 000000000..104bbae81
--- /dev/null
+++ b/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs
@@ -0,0 +1,9 @@
+import qbs
+
+CppApplication {
+ files: ["main.c"]
+ cpp.minimumOsxVersion: "10.4"
+ cpp.minimumIosVersion: "5.0"
+ cpp.cFlags: ["-v"]
+ cpp.linkerFlags: ["-v"]
+}
diff --git a/tests/auto/blackbox/testdata/deploymentTarget/main.c b/tests/auto/blackbox/testdata/deploymentTarget/main.c
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/deploymentTarget/main.c
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata/enableExceptions/empty.m b/tests/auto/blackbox/testdata/enableExceptions/empty.m
new file mode 100644
index 000000000..d3714dc09
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/empty.m
@@ -0,0 +1 @@
+int main2() { return 0; }
diff --git a/tests/auto/blackbox/testdata/enableExceptions/empty.mm b/tests/auto/blackbox/testdata/enableExceptions/empty.mm
new file mode 100644
index 000000000..fe94a49a3
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/empty.mm
@@ -0,0 +1 @@
+int main3() { return 0; }
diff --git a/tests/auto/blackbox/testdata/enableExceptions/emptymain.cpp b/tests/auto/blackbox/testdata/enableExceptions/emptymain.cpp
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/emptymain.cpp
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata/enableExceptions/exceptions-objc.qbs b/tests/auto/blackbox/testdata/enableExceptions/exceptions-objc.qbs
new file mode 100644
index 000000000..74738ad12
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/exceptions-objc.qbs
@@ -0,0 +1,6 @@
+import qbs
+
+CppApplication {
+ files: ["main.m"]
+ cpp.frameworks: ["Foundation"]
+}
diff --git a/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp-cpp.qbs b/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp-cpp.qbs
new file mode 100644
index 000000000..679cdebbe
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp-cpp.qbs
@@ -0,0 +1,6 @@
+import qbs
+
+CppApplication {
+ files: ["main.cpp"]
+ fileTags: ["objcpp"]
+}
diff --git a/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp.qbs b/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp.qbs
new file mode 100644
index 000000000..6856f53bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+CppApplication {
+ files: ["main.m"]
+ fileTags: ["objcpp"]
+ cpp.frameworks: ["Foundation"]
+}
diff --git a/tests/auto/blackbox/testdata/enableExceptions/exceptions.qbs b/tests/auto/blackbox/testdata/enableExceptions/exceptions.qbs
new file mode 100644
index 000000000..da6fdbc2d
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/exceptions.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+CppApplication {
+ files: ["main.cpp"]
+ cpp.treatWarningsAsErrors: true
+ cpp.defines: qbs.toolchain.contains("msvc") && !cpp.enableExceptions ? ["FORCE_FAIL_VS"] : []
+}
diff --git a/tests/auto/blackbox/testdata/enableExceptions/main.cpp b/tests/auto/blackbox/testdata/enableExceptions/main.cpp
new file mode 100644
index 000000000..1b99ea96d
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/main.cpp
@@ -0,0 +1,8 @@
+#include <stdexcept>
+
+int main() {
+#ifdef FORCE_FAIL_VS
+#error "Microsoft Visual C++ cannot disable exceptions at compile-time"
+#endif
+ throw std::runtime_error("failed");
+}
diff --git a/tests/auto/blackbox/testdata/enableExceptions/main.m b/tests/auto/blackbox/testdata/enableExceptions/main.m
new file mode 100644
index 000000000..86b45fc37
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/main.m
@@ -0,0 +1,5 @@
+#import <Foundation/Foundation.h>
+
+int main() {
+ @throw [NSError new];
+}
diff --git a/tests/auto/blackbox/testdata/enableExceptions/none.qbs b/tests/auto/blackbox/testdata/enableExceptions/none.qbs
new file mode 100644
index 000000000..332af7614
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableExceptions/none.qbs
@@ -0,0 +1,10 @@
+import qbs
+
+CppApplication {
+ files: ["emptymain.cpp"]
+
+ Group {
+ condition: qbs.targetOS.contains("darwin")
+ files: ["empty.m", "empty.mm"]
+ }
+}
diff --git a/tests/auto/blackbox/testdata/enableRtti/main.cpp b/tests/auto/blackbox/testdata/enableRtti/main.cpp
new file mode 100644
index 000000000..630e75170
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableRtti/main.cpp
@@ -0,0 +1,23 @@
+#include <typeinfo>
+
+class I {
+public:
+ virtual ~I() { }
+ virtual void x() { }
+};
+
+class A : public I {
+ void x() override { }
+};
+
+class B : public I {
+ void x() override { }
+};
+
+int main() {
+ I *a = new A();
+ B *b = dynamic_cast<B *>(a);
+ (void)b;
+ delete a;
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/enableRtti/rtti.qbs b/tests/auto/blackbox/testdata/enableRtti/rtti.qbs
new file mode 100644
index 000000000..f032bb16b
--- /dev/null
+++ b/tests/auto/blackbox/testdata/enableRtti/rtti.qbs
@@ -0,0 +1,13 @@
+import qbs
+
+Project {
+ property bool treatAsObjcpp: false
+ CppApplication {
+ cpp.cxxLanguageVersion: "c++11"
+ cpp.treatWarningsAsErrors: true
+ Group {
+ files: ["main.cpp"]
+ fileTags: [project.treatAsObjcpp ? "objcpp" : "cpp"]
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/error-info/helper.js b/tests/auto/blackbox/testdata/error-info/helper.js
new file mode 100644
index 000000000..18323df4a
--- /dev/null
+++ b/tests/auto/blackbox/testdata/error-info/helper.js
@@ -0,0 +1,9 @@
+var x;
+
+function doSomethingBad() {
+ nothinghere.works;
+}
+
+function doSomethingEvil() {
+ throw "OUCH!";
+}
diff --git a/tests/auto/blackbox/testdata/error-info/project.qbs b/tests/auto/blackbox/testdata/error-info/project.qbs
new file mode 100644
index 000000000..f2c65597f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/error-info/project.qbs
@@ -0,0 +1,71 @@
+import qbs
+import "helper.js" as Helper
+
+Project {
+ property bool fail1: false
+ property bool fail2: false
+ property bool fail3: false
+ property bool fail4: false
+ property bool fail5: false
+ property bool fail6: false
+ property bool fail7: false
+
+ Product {
+ type: ["foo", "bar"]
+
+ Rule {
+ inputs: ["qbs"]
+
+ Artifact {
+ fileTags: ["foo"]
+ filePath: {
+ var path = "foo";
+ if (project.fail1)
+ throw "fail1";
+ return path;
+ }
+ }
+
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.sourceCode = function () {
+
+ };
+ cmd.silent = true;
+ if (project.fail2)
+ generate.an.error;
+ if (project.fail6)
+ Helper.doSomethingEvil();
+ return cmd;
+ }
+ }
+
+ Rule {
+ inputs: ["qbs"]
+
+ outputFileTags: ["bar"]
+ outputArtifacts: {
+ var list = [];
+ list.push({ fileTags: ["bar"], filePath: "bar" });
+ if (project.fail3)
+ throw "fail3";
+ if (project.fail5)
+ Helper.doSomethingBad();
+ return list;
+ }
+
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.fail7 = project.fail7;
+ cmd.sourceCode = function () {
+ if (fail7)
+ will.fail;
+ };
+ cmd.silent = true;
+ if (project.fail4)
+ generate.an.error;
+ return cmd;
+ }
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs b/tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs
index 1f3bf010c..4423d68e0 100644
--- a/tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs
+++ b/tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs
@@ -20,7 +20,7 @@ DynamicLibrary {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() {
- print("---" + product.moduleProperty("cpp", "nmPath") + "---");
+ console.info("---" + product.moduleProperty("cpp", "nmPath") + "---");
}
return [cmd];
}
diff --git a/tests/auto/blackbox/testdata/nodejs/hello.qbs b/tests/auto/blackbox/testdata/nodejs/hello.qbs
index e11b1a599..d5e92209a 100644
--- a/tests/auto/blackbox/testdata/nodejs/hello.qbs
+++ b/tests/auto/blackbox/testdata/nodejs/hello.qbs
@@ -3,5 +3,4 @@ import qbs
NodeJSApplication {
nodejs.applicationFile: "hello.js"
name: "hello"
- files: "hello.js"
}
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/dependee.qbs b/tests/auto/blackbox/testdata/probe-in-exported-module/dependee.qbs
new file mode 100644
index 000000000..94e266499
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/dependee.qbs
@@ -0,0 +1,15 @@
+import qbs
+
+Product {
+ name: "dependee"
+ Depends { name: "dependency" }
+ type: ["out", "dep-out"]
+ Group {
+ files: "test.in"
+ fileTags: ["dep-in"]
+ }
+ Group {
+ files: "test2.in"
+ fileTags: ["in"]
+ }
+}
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/dependency.qbs b/tests/auto/blackbox/testdata/probe-in-exported-module/dependency.qbs
new file mode 100644
index 000000000..1413777dc
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/dependency.qbs
@@ -0,0 +1,8 @@
+import qbs
+
+Product {
+ name: "dependency"
+ Export {
+ Depends { name: "mymodule" }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/modules/depmodule/depmodule.qbs b/tests/auto/blackbox/testdata/probe-in-exported-module/modules/depmodule/depmodule.qbs
new file mode 100644
index 000000000..b477e2bf7
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/modules/depmodule/depmodule.qbs
@@ -0,0 +1,21 @@
+import qbs
+
+Module {
+ property string prop
+
+ Rule {
+ inputs: ["dep-in"]
+ Artifact {
+ filePath: "dummy.txt"
+ fileTags: ["dep-out"]
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "Creating dep-out artifact";
+ cmd.sourceCode = function() {
+ console.info("prop: " + product.moduleProperty("depmodule", "prop"));
+ };
+ return [cmd];
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/modules/mymodule/mymodule.qbs b/tests/auto/blackbox/testdata/probe-in-exported-module/modules/mymodule/mymodule.qbs
new file mode 100644
index 000000000..af1c33049
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/modules/mymodule/mymodule.qbs
@@ -0,0 +1,27 @@
+import qbs
+
+Module {
+ Depends { name: "depmodule" }
+ Probe {
+ id: theProbe
+ configure: { found = true; }
+ }
+ property bool found: theProbe.found
+ depmodule.prop: found ? "yes" : "no"
+
+ Rule {
+ inputs: ["in"]
+ Artifact {
+ filePath: "dummy2.txt"
+ fileTags: ["out"]
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "Creating out artifact";
+ cmd.sourceCode = function() {
+ console.info("found: " + product.moduleProperty("mymodule", "found"));
+ };
+ return [cmd];
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/probe-in-exported-module.qbs b/tests/auto/blackbox/testdata/probe-in-exported-module/probe-in-exported-module.qbs
new file mode 100644
index 000000000..4e0f13f60
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/probe-in-exported-module.qbs
@@ -0,0 +1,5 @@
+import qbs
+
+Project {
+ references: [ "dependee.qbs", "dependency.qbs" ]
+}
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/test.in b/tests/auto/blackbox/testdata/probe-in-exported-module/test.in
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/test.in
diff --git a/tests/auto/blackbox/testdata/probe-in-exported-module/test2.in b/tests/auto/blackbox/testdata/probe-in-exported-module/test2.in
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probe-in-exported-module/test2.in
diff --git a/tests/auto/blackbox/testdata/probeProperties/bin/tool b/tests/auto/blackbox/testdata/probeProperties/bin/tool
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probeProperties/bin/tool
diff --git a/tests/auto/blackbox/testdata/probeProperties/main.c b/tests/auto/blackbox/testdata/probeProperties/main.c
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probeProperties/main.c
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs b/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs
new file mode 100644
index 000000000..36842e40b
--- /dev/null
+++ b/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs
@@ -0,0 +1,30 @@
+import qbs
+import qbs.Probes
+
+CppApplication {
+ Probes.PathProbe {
+ id: probe1
+ names: ["bin/tool"]
+ platformPaths: [product.sourceDirectory]
+ }
+
+ Probes.PathProbe {
+ id: probe2
+ names: ["tool"]
+ platformPaths: [product.sourceDirectory + "/bin"]
+ }
+
+ targetName: {
+ console.info("probe1.fileName=" + probe1.fileName);
+ console.info("probe1.path=" + probe1.path);
+ console.info("probe1.filePath=" + probe1.filePath);
+
+ console.info("probe2.fileName=" + probe2.fileName);
+ console.info("probe2.path=" + probe2.path);
+ console.info("probe2.filePath=" + probe2.filePath);
+
+ return name;
+ }
+
+ files: ["main.c"]
+}
diff --git a/tests/auto/blackbox/testdata/referenceErrorInExport/main.c b/tests/auto/blackbox/testdata/referenceErrorInExport/main.c
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata/referenceErrorInExport/main.c
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata/referenceErrorInExport/project.qbs b/tests/auto/blackbox/testdata/referenceErrorInExport/project.qbs
new file mode 100644
index 000000000..91069f629
--- /dev/null
+++ b/tests/auto/blackbox/testdata/referenceErrorInExport/project.qbs
@@ -0,0 +1,20 @@
+import qbs
+
+Project {
+ CppApplication {
+ Depends { name: "other" }
+ files: ["main.c"]
+ cpp.includePaths: ["."]
+ }
+
+ DynamicLibrary {
+ name: "other"
+ files: ["main.c"]
+
+ property stringList includePaths: []
+ Export {
+ Depends { name: "cpp" }
+ cpp.includePaths: includePaths
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/separate-debug-info/project.qbs b/tests/auto/blackbox/testdata/separate-debug-info/project.qbs
index 0939f7227..c0498df3d 100644
--- a/tests/auto/blackbox/testdata/separate-debug-info/project.qbs
+++ b/tests/auto/blackbox/testdata/separate-debug-info/project.qbs
@@ -20,6 +20,7 @@ Project {
files: ["foo.cpp"]
cpp.separateDebugInformation: true
}
+
CppApplication {
name: "app2"
type: ["application"]
@@ -39,4 +40,76 @@ Project {
files: ["foo.cpp"]
cpp.separateDebugInformation: false
}
+
+ CppApplication {
+ name: "app3"
+ type: ["application"]
+ files: ["main.cpp"]
+ cpp.separateDebugInformation: true
+ cpp.dsymutilFlags: ["--flat"]
+ }
+ DynamicLibrary {
+ Depends { name: "cpp" }
+ name: "foo3"
+ type: ["dynamiclibrary"]
+ files: ["foo.cpp"]
+ cpp.separateDebugInformation: true
+ cpp.dsymutilFlags: ["--flat"]
+ }
+ LoadableModule {
+ Depends { name: "cpp" }
+ name: "bar3"
+ files: ["foo.cpp"]
+ cpp.separateDebugInformation: true
+ cpp.dsymutilFlags: ["--flat"]
+ }
+
+ CppApplication {
+ name: "app4"
+ type: ["application"]
+ files: ["main.cpp"]
+ bundle.isBundle: false
+ cpp.separateDebugInformation: true
+ }
+ DynamicLibrary {
+ Depends { name: "cpp" }
+ name: "foo4"
+ type: ["dynamiclibrary"]
+ files: ["foo.cpp"]
+ bundle.isBundle: false
+ cpp.separateDebugInformation: true
+ }
+ LoadableModule {
+ Depends { name: "cpp" }
+ name: "bar4"
+ files: ["foo.cpp"]
+ bundle.isBundle: false
+ cpp.separateDebugInformation: true
+ }
+
+ CppApplication {
+ name: "app5"
+ type: ["application"]
+ files: ["main.cpp"]
+ bundle.isBundle: false
+ cpp.separateDebugInformation: true
+ cpp.dsymutilFlags: ["--flat"]
+ }
+ DynamicLibrary {
+ Depends { name: "cpp" }
+ name: "foo5"
+ type: ["dynamiclibrary"]
+ files: ["foo.cpp"]
+ bundle.isBundle: false
+ cpp.separateDebugInformation: true
+ cpp.dsymutilFlags: ["--flat"]
+ }
+ LoadableModule {
+ Depends { name: "cpp" }
+ name: "bar5"
+ files: ["foo.cpp"]
+ bundle.isBundle: false
+ cpp.separateDebugInformation: true
+ cpp.dsymutilFlags: ["--flat"]
+ }
}
diff --git a/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js b/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js
index c3dfe2b11..159a7d32a 100644
--- a/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js
+++ b/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js
@@ -1,4 +1,4 @@
function fileList() { return []; }
-function filesFromFs(qbs) { return File.exists(path + "/fileExists.cpp") ? ["fileExists.cpp"] : []; }
+function filesFromFs(path) { return File.exists(path + "/fileExists.cpp") ? ["fileExists.cpp"] : []; }
diff --git a/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs b/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs
index 05060acd7..e99d6b350 100644
--- a/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs
+++ b/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs
@@ -6,7 +6,7 @@ import "fileList.js" as FileList
CppApplication {
property stringList filesFromEnv: Environment.getEnv("QBS_TEST_PULL_IN_FILE_VIA_ENV")
? ["environmentChange.cpp"] : []
- files: ["main.cpp"].concat(FileList.fileList()).concat(filesFromEnv).concat(FileList.filesFromFs(qbs))
+ files: ["main.cpp"].concat(FileList.fileList()).concat(filesFromEnv).concat(FileList.filesFromFs(path))
Group {
condition: Environment.getEnv("INCLUDE_PATH_TEST")
diff --git a/tests/auto/blackbox/testdata/typescript/typescript.qbs b/tests/auto/blackbox/testdata/typescript/typescript.qbs
index 1b4c675c3..d15e9db50 100644
--- a/tests/auto/blackbox/testdata/typescript/typescript.qbs
+++ b/tests/auto/blackbox/testdata/typescript/typescript.qbs
@@ -15,8 +15,7 @@ Project {
files: [
"animals.ts",
"extra.js",
- "woosh/extra.ts",
- "main.ts"
+ "woosh/extra.ts"
]
}
diff --git a/tests/auto/blackbox/testdata/versionscript/versionscript.qbs b/tests/auto/blackbox/testdata/versionscript/versionscript.qbs
index f845f2457..56260a022 100644
--- a/tests/auto/blackbox/testdata/versionscript/versionscript.qbs
+++ b/tests/auto/blackbox/testdata/versionscript/versionscript.qbs
@@ -20,7 +20,7 @@ DynamicLibrary {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() {
- print("---" + product.moduleProperty("cpp", "nmPath") + "---");
+ console.info("---" + product.moduleProperty("cpp", "nmPath") + "---");
}
return [cmd];
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index d58d70b00..0c20eb1c9 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -327,14 +327,12 @@ void TestBlackbox::sevenZip()
const QString outputFile = relativeProductBuildDir("archivable") + "/archivable.7z";
QVERIFY2(regularFileExists(outputFile), qPrintable(outputFile));
QProcess listContents;
- listContents.start(binary, QStringList() << "t" << outputFile);
+ listContents.start(binary, QStringList() << "l" << outputFile);
QVERIFY2(listContents.waitForStarted(), qPrintable(listContents.errorString()));
QVERIFY2(listContents.waitForFinished(), qPrintable(listContents.errorString()));
QVERIFY2(listContents.exitCode() == 0, listContents.readAllStandardError().constData());
const QByteArray output = listContents.readAllStandardOutput();
- if (output.count("Testing") != 2)
- qDebug("%s", output.constData());
- QCOMPARE(output.count("Testing"), 2);
+ QVERIFY2(output.contains("2 files"), output.constData());
QVERIFY2(output.contains("test.txt"), output.constData());
QVERIFY2(output.contains("archivable.qbs"), output.constData());
}
@@ -462,6 +460,12 @@ void TestBlackbox::android()
int status;
const auto androidPaths = findAndroid(&status);
+ const auto ndkPath = androidPaths["ndk"];
+ static const QStringList ndkSamplesDirs = QStringList() << "teapot" << "no-native";
+ if (!ndkPath.isEmpty() && !QFileInfo(ndkPath + "/samples").isDir()
+ && ndkSamplesDirs.contains(projectDir))
+ QSKIP("NDK samples directory not present");
+
QDir::setCurrent(testDataDir + "/android/" + projectDir);
Settings s((QString()));
Profile p("qbs_autotests-android", &s);
@@ -520,6 +524,254 @@ void TestBlackbox::buildDirectories()
QVERIFY2(outputLines.contains(projectDir), m_qbsStdout.constData());
}
+class QFileInfo2 : public QFileInfo {
+public:
+ QFileInfo2(const QString &path) : QFileInfo(path) { }
+ bool isRegularFile() const { return isFile() && !isSymLink(); }
+ bool isRegularDir() const { return isDir() && !isSymLink(); }
+ bool isFileSymLink() const { return isFile() && isSymLink(); }
+ bool isDirSymLink() const { return isDir() && isSymLink(); }
+};
+
+void TestBlackbox::bundleStructure()
+{
+ if (!HostOsInfo::isOsxHost())
+ QSKIP("only applies on OS X");
+
+ QFETCH(QString, productName);
+ QFETCH(QString, productTypeIdentifier);
+ QFETCH(bool, isShallow);
+
+ QDir::setCurrent(testDataDir + "/bundle-structure");
+ QbsRunParameters params;
+ params.arguments << "project.buildableProducts:" + productName;
+ if (isShallow) {
+ // Coerce shallow bundles - don't set bundle.isShallow directly because we want to test the
+ // automatic detection
+ params.arguments
+ << "qbs.targetOS:ios,darwin,bsd,unix"
+ << "qbs.architecture:arm64";
+ }
+
+ if (productName == "ABadApple" || productName == "ABadThirdParty")
+ params.expectFailure = true;
+
+ rmDirR(relativeBuildDir());
+ const int status = runQbs(params);
+ if (status != 0) {
+ QVERIFY2(m_qbsStderr.contains("Bundle product type "
+ + productTypeIdentifier.toLatin1()
+ + " is not supported."),
+ m_qbsStderr.constData());
+ return;
+ }
+
+ QCOMPARE(status, 0);
+
+ if (!isShallow) {
+ if (productName == "A") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/MacOS").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/MacOS/A").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/PkgInfo").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Resources").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents/Resources/resource.txt").isRegularFile());
+ }
+
+ if (productName == "B") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/B").isFileSymLink());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers").isDirSymLink());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules").isDirSymLink());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/B.framework/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders").isDirSymLink());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Resources").isDirSymLink());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/B").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Headers/dummy.h").isRegularFile());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Modules").isRegularDir());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Modules/module.modulemap").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Resources").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/A/Resources/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Versions/Current").isDirSymLink());
+ }
+
+ if (productName == "C") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/C").isFileSymLink());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers").isDirSymLink());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules").isDirSymLink());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/C.framework/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders").isDirSymLink());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Resources").isDirSymLink());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/C").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Headers/dummy.h").isRegularFile());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Modules").isRegularDir());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Modules/module.modulemap").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Resources").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/A/Resources/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Versions/Current").isDirSymLink());
+ }
+
+ if (productName == "D") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/MacOS").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/MacOS/D").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Resources").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Contents/Resources/resource.txt").isRegularFile());
+ }
+
+ if (productName == "E") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/MacOS").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/MacOS/E").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/E.appex/Contents/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Resources").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Contents/Resources/resource.txt").isRegularFile());
+ }
+
+ if (productName == "F") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/MacOS").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/MacOS/F").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Resources").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Contents/Resources/resource.txt").isRegularFile());
+ }
+
+ if (productName == "G") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/G").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile());
+ }
+ } else {
+ if (productName == "A") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/A").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Info.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/PkgInfo").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/resource.txt").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/ResourceRules.plist").isRegularFile());
+ }
+
+ if (productName == "B") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/B").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Headers/dummy.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Info.plist").isRegularFile());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules").isRegularDir());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/Modules/module.modulemap").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/B.framework/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/resource.txt").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/B.framework/ResourceRules.plist").isRegularFile());
+ }
+
+ if (productName == "C") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/C").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Headers/dummy.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Info.plist").isRegularFile());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules").isRegularDir());
+ //QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/Modules/module.modulemap").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/C.framework/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/resource.txt").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/C.framework/ResourceRules.plist").isRegularFile());
+ }
+
+ if (productName == "D") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/D").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Headers/dummy.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/Info.plist").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/D.bundle/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/resource.txt").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/D.bundle/ResourceRules.plist").isRegularFile());
+ }
+
+ if (productName == "E") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/E").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Headers/dummy.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/Info.plist").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/E.appex/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/resource.txt").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/E.appex/ResourceRules.plist").isRegularFile());
+ }
+
+ if (productName == "F") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/F").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Headers").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Headers/dummy.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/Info.plist").isRegularFile());
+ QVERIFY(!QFileInfo2(defaultInstallRoot + "/F.xpc/PkgInfo").exists());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/PrivateHeaders").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/PrivateHeaders/dummy_p.h").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/resource.txt").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/F.xpc/ResourceRules.plist").isRegularFile());
+ }
+
+ if (productName == "G") {
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/G").isRegularDir());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile());
+ QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile());
+ }
+ }
+}
+
+void TestBlackbox::bundleStructure_data()
+{
+ QTest::addColumn<QString>("productName");
+ QTest::addColumn<QString>("productTypeIdentifier");
+ QTest::addColumn<bool>("isShallow");
+
+ const auto addRows = [](bool isShallow) {
+ const QString s = (isShallow ? " shallow" : "");
+ QTest::newRow(("A" + s).toLatin1()) << "A" << "com.apple.product-type.application" << isShallow;
+ QTest::newRow(("ABadApple" + s).toLatin1()) << "ABadApple" << "com.apple.product-type.will.never.exist.ever.guaranteed" << isShallow;
+ QTest::newRow(("ABadThirdParty" + s).toLatin1()) << "ABadThirdParty" << "org.special.third.party.non.existent.product.type" << isShallow;
+ QTest::newRow(("B" + s).toLatin1()) << "B" << "com.apple.product-type.framework" << isShallow;
+ QTest::newRow(("C" + s).toLatin1()) << "C" << "com.apple.product-type.framework.static" << isShallow;
+ QTest::newRow(("D" + s).toLatin1()) << "D" << "com.apple.product-type.bundle" << isShallow;
+ QTest::newRow(("E" + s).toLatin1()) << "E" << "com.apple.product-type.app-extension" << isShallow;
+ QTest::newRow(("F" + s).toLatin1()) << "F" << "com.apple.product-type.xpc-service" << isShallow;
+ QTest::newRow(("G" + s).toLatin1()) << "G" << "com.apple.product-type.in-app-purchase-content" << isShallow;
+ };
+
+ addRows(true);
+ addRows(false);
+}
+
void TestBlackbox::changedFiles_data()
{
QTest::addColumn<bool>("useChangedFilesForInitialBuild");
@@ -575,7 +827,7 @@ void TestBlackbox::changeInImportedFile()
{
QDir::setCurrent(testDataDir + "/change-in-imported-file");
QCOMPARE(runQbs(), 0);
- QVERIFY2(m_qbsStderr.contains("old output"), m_qbsStderr.constData());
+ QVERIFY2(m_qbsStdout.contains("old output"), m_qbsStdout.constData());
WAIT_FOR_NEW_TIMESTAMP();
QFile jsFile("prepare.js");
@@ -586,7 +838,7 @@ void TestBlackbox::changeInImportedFile()
jsFile.write(content);
jsFile.close();
QCOMPARE(runQbs(), 0);
- QVERIFY2(m_qbsStderr.contains("new output"), m_qbsStderr.constData());
+ QVERIFY2(m_qbsStdout.contains("new output"), m_qbsStdout.constData());
WAIT_FOR_NEW_TIMESTAMP();
QVERIFY2(jsFile.open(QIODevice::ReadWrite), qPrintable(jsFile.errorString()));
@@ -594,7 +846,7 @@ void TestBlackbox::changeInImportedFile()
jsFile.write(content);
jsFile.close();
QCOMPARE(runQbs(), 0);
- QVERIFY2(!m_qbsStderr.contains("output"), m_qbsStderr.constData());
+ QVERIFY2(!m_qbsStdout.contains("output"), m_qbsStdout.constData());
}
void TestBlackbox::dependenciesProperty()
@@ -662,6 +914,48 @@ void TestBlackbox::dependencyProfileMismatch()
m_qbsStderr.constData());
}
+void TestBlackbox::deploymentTarget()
+{
+ if (!HostOsInfo::isOsxHost())
+ QSKIP("only applies on OS X");
+
+ QFETCH(QString, os);
+ QFETCH(QString, arch);
+ QFETCH(QString, cflags);
+ QFETCH(QString, lflags);
+
+ QDir::setCurrent(testDataDir + "/deploymentTarget");
+
+ QbsRunParameters params;
+ params.arguments = QStringList()
+ << "--command-echo-mode"
+ << "command-line"
+ << "qbs.targetOS:" + os
+ << "qbs.architecture:" + arch;
+
+ rmDirR(relativeBuildDir());
+ QCOMPARE(runQbs(params), 0);
+ QVERIFY2(m_qbsStdout.contains(cflags.toLatin1()), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains(lflags.toLatin1()), m_qbsStdout.constData());
+}
+
+void TestBlackbox::deploymentTarget_data()
+{
+ QTest::addColumn<QString>("os");
+ QTest::addColumn<QString>("arch");
+ QTest::addColumn<QString>("cflags");
+ QTest::addColumn<QString>("lflags");
+ QTest::newRow("osx") << "osx,darwin,bsd,unix" << "x86_64"
+ << "-triple x86_64-apple-macosx10.4"
+ << "-macosx_version_min 10.4";
+ QTest::newRow("ios") << "ios,darwin,bsd,unix" << "arm64"
+ << "-triple arm64-apple-ios5.0"
+ << "-iphoneos_version_min 5.0";
+ QTest::newRow("ios-sim") << "ios-simulator,ios,darwin,bsd,unix" << "x86_64"
+ << "-triple x86_64-apple-ios5.0"
+ << "-ios_simulator_version_min 5.0";
+}
+
void TestBlackbox::symlinkRemoval()
{
if (HostOsInfo::isWindowsHost())
@@ -699,7 +993,7 @@ void TestBlackbox::versionScript()
QDir::setCurrent(testDataDir + "/versionscript");
QCOMPARE(runQbs(QbsRunParameters(QStringList("-qq")
<< ("qbs.installRoot:" + QDir::currentPath()))), 0);
- const QString output = QString::fromLocal8Bit(m_qbsStderr);
+ const QString output = QString::fromLocal8Bit(m_qbsStdout);
QRegExp pattern(".*---(.*)---.*");
QVERIFY2(pattern.exactMatch(output), qPrintable(output));
QCOMPARE(pattern.captureCount(), 1);
@@ -861,12 +1155,69 @@ void TestBlackbox::separateDebugInfo()
QStringList toolchain = buildProfile.value("qbs.toolchain").toStringList();
QStringList targetOS = buildProfile.value("qbs.targetOS").toStringList();
if (targetOS.contains("darwin") || (targetOS.isEmpty() && HostOsInfo::isOsxHost())) {
- QVERIFY(QFile::exists(relativeProductBuildDir("app1") + "/app1.app.dSYM"));
+ QVERIFY(directoryExists(relativeProductBuildDir("app1") + "/app1.app.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("app1")
+ + "/app1.app.dSYM/Contents/Info.plist"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("app1")
+ + "/app1.app.dSYM/Contents/Resources/DWARF/app1"));
+ QCOMPARE(QDir(relativeProductBuildDir("app1")
+ + "/app1.app.dSYM/Contents/Resources/DWARF")
+ .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1);
QVERIFY(!QFile::exists(relativeProductBuildDir("app2") + "/app2.app.dSYM"));
- QVERIFY(QFile::exists(relativeProductBuildDir("foo1") + "/foo1.framework.dSYM"));
+ QVERIFY(!QFile::exists(relativeProductBuildDir("app3") + "/app3.app.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("app3")
+ + "/app3.app/Contents/MacOS/app3.dwarf"));
+ QVERIFY(directoryExists(relativeProductBuildDir("app4") + "/app4.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("app4")
+ + "/app4.dSYM/Contents/Info.plist"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("app4")
+ + "/app4.dSYM/Contents/Resources/DWARF/app4"));
+ QCOMPARE(QDir(relativeProductBuildDir("app4")
+ + "/app4.dSYM/Contents/Resources/DWARF")
+ .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1);
+ QVERIFY(regularFileExists(relativeProductBuildDir("app5") + "/app5.dwarf"));
+ QVERIFY(directoryExists(relativeProductBuildDir("foo1") + "/foo1.framework.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("foo1")
+ + "/foo1.framework.dSYM/Contents/Info.plist"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("foo1")
+ + "/foo1.framework.dSYM/Contents/Resources/DWARF/foo1"));
+ QCOMPARE(QDir(relativeProductBuildDir("foo1")
+ + "/foo1.framework.dSYM/Contents/Resources/DWARF")
+ .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1);
QVERIFY(!QFile::exists(relativeProductBuildDir("foo2") + "/foo2.framework.dSYM"));
- QVERIFY(QFile::exists(relativeProductBuildDir("bar1") + "/bar1.bundle.dSYM"));
+ QVERIFY(!QFile::exists(relativeProductBuildDir("foo3") + "/foo3.framework.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("foo3")
+ + "/foo3.framework/Versions/A/foo3.dwarf"));
+ QVERIFY(directoryExists(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("foo4")
+ + "/libfoo4.dylib.dSYM/Contents/Info.plist"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("foo4")
+ + "/libfoo4.dylib.dSYM/Contents/Resources/DWARF/libfoo4.dylib"));
+ QCOMPARE(QDir(relativeProductBuildDir("foo4")
+ + "/libfoo4.dylib.dSYM/Contents/Resources/DWARF")
+ .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1);
+ QVERIFY(regularFileExists(relativeProductBuildDir("foo5") + "/libfoo5.dylib.dwarf"));
+ QVERIFY(directoryExists(relativeProductBuildDir("bar1") + "/bar1.bundle.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("bar1")
+ + "/bar1.bundle.dSYM/Contents/Info.plist"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("bar1")
+ + "/bar1.bundle.dSYM/Contents/Resources/DWARF/bar1"));
+ QCOMPARE(QDir(relativeProductBuildDir("bar1")
+ + "/bar1.bundle.dSYM/Contents/Resources/DWARF")
+ .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1);
QVERIFY(!QFile::exists(relativeProductBuildDir("bar2") + "/bar2.bundle.dSYM"));
+ QVERIFY(!QFile::exists(relativeProductBuildDir("bar3") + "/bar3.bundle.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("bar3")
+ + "/bar3.bundle/Contents/MacOS/bar3.dwarf"));
+ QVERIFY(directoryExists(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("bar4")
+ + "/bar4.bundle.dSYM/Contents/Info.plist"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("bar4")
+ + "/bar4.bundle.dSYM/Contents/Resources/DWARF/bar4.bundle"));
+ QCOMPARE(QDir(relativeProductBuildDir("bar4")
+ + "/bar4.bundle.dSYM/Contents/Resources/DWARF")
+ .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1);
+ QVERIFY(regularFileExists(relativeProductBuildDir("bar5") + "/bar5.bundle.dwarf"));
} else if (toolchain.contains("gcc")) {
QVERIFY(QFile::exists(relativeProductBuildDir("app1") + "/app1.debug"));
QVERIFY(!QFile::exists(relativeProductBuildDir("app2") + "/app2.debug"));
@@ -1301,6 +1652,17 @@ void TestBlackbox::recursiveWildcards()
QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file2.txt").exists());
}
+void TestBlackbox::referenceErrorInExport()
+{
+ QDir::setCurrent(testDataDir + "/referenceErrorInExport");
+ QbsRunParameters params;
+ params.expectFailure = true;
+ QVERIFY(runQbs(params) != 0);
+ QEXPECT_FAIL(0, "QBS-946", Abort);
+ QVERIFY(m_qbsStderr.contains(
+ "project.qbs:17:31 ReferenceError: Can't find variable: includePaths"));
+}
+
void TestBlackbox::reproducibleBuild()
{
Settings s((QString()));
@@ -1384,6 +1746,29 @@ void TestBlackbox::overrideProjectProperties()
QCOMPARE(runQbs(params), 0);
}
+void TestBlackbox::probeProperties()
+{
+ QDir::setCurrent(testDataDir + "/probeProperties");
+ const QByteArray dir = QDir::cleanPath(testDataDir).toLatin1() + "/probeProperties";
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.contains("probe1.fileName=bin/tool"), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains("probe1.path=" + dir), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains("probe1.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains("probe2.fileName=tool"), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains("probe2.path=" + dir + "/bin"), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains("probe2.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData());
+}
+
+void TestBlackbox::probeInExportedModule()
+{
+ QDir::setCurrent(testDataDir + "/probe-in-exported-module");
+ QCOMPARE(runQbs(QbsRunParameters(QStringList() << QLatin1String("-f")
+ << QLatin1String("probe-in-exported-module.qbs"))), 0);
+ QVERIFY2(m_qbsStdout.contains("found: true"), m_qbsStdout.constData());
+ QEXPECT_FAIL(0, "QBS-955", Abort);
+ QVERIFY2(m_qbsStdout.contains("prop: yes"), m_qbsStdout.constData());
+}
+
void TestBlackbox::productProperties()
{
QDir::setCurrent(testDataDir + "/productproperties");
@@ -1713,6 +2098,44 @@ void TestBlackbox::erroneousFiles()
}
}
+void TestBlackbox::errorInfo()
+{
+ QDir::setCurrent(testDataDir + "/error-info");
+ QCOMPARE(runQbs(), 0);
+
+ QbsRunParameters params;
+ params.expectFailure = true;
+
+ params.arguments = QStringList() << "project.fail1:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("project.qbs:24"), m_qbsStderr);
+
+ params.arguments = QStringList() << "project.fail2:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("project.qbs:36"), m_qbsStderr);
+
+ params.arguments = QStringList() << "project.fail3:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("project.qbs:51"), m_qbsStderr);
+
+ params.arguments = QStringList() << "project.fail4:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("project.qbs:66"), m_qbsStderr);
+
+ params.arguments = QStringList() << "project.fail5:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("helper.js:4"), m_qbsStderr);
+
+ params.arguments = QStringList() << "project.fail6:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("helper.js:8"), m_qbsStderr);
+
+ params.arguments = QStringList() << "project.fail7:true";
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY2(m_qbsStderr.contains("JavaScriptCommand.sourceCode"), m_qbsStderr);
+ QVERIFY2(m_qbsStderr.contains("project.qbs:57"), m_qbsStderr);
+}
+
void TestBlackbox::exportRule()
{
QDir::setCurrent(testDataDir + "/export-rule");
@@ -2087,7 +2510,7 @@ void TestBlackbox::linkerScripts()
QDir::setCurrent(testDataDir + "/linkerscripts");
QCOMPARE(runQbs(QbsRunParameters(QStringList("-qq")
<< ("qbs.installRoot:" + QDir::currentPath()))), 0);
- const QString output = QString::fromLocal8Bit(m_qbsStderr);
+ const QString output = QString::fromLocal8Bit(m_qbsStdout);
QRegExp pattern(".*---(.*)---.*");
QVERIFY2(pattern.exactMatch(output), qPrintable(output));
QCOMPARE(pattern.captureCount(), 1);
@@ -2760,12 +3183,12 @@ void TestBlackbox::assembly()
bool haveMSVC = profile.value("qbs.toolchain").toStringList().contains("msvc");
QDir::setCurrent(testDataDir + "/assembly");
QVERIFY(runQbs() == 0);
- QCOMPARE((bool)m_qbsStdout.contains("assembling testa.s"), haveGcc);
- QCOMPARE((bool)m_qbsStdout.contains("compiling testb.S"), haveGcc);
- QCOMPARE((bool)m_qbsStdout.contains("compiling testc.sx"), haveGcc);
- QCOMPARE((bool)m_qbsStdout.contains("creating libtesta.a"), haveGcc);
- QCOMPARE((bool)m_qbsStdout.contains("creating libtestb.a"), haveGcc);
- QCOMPARE((bool)m_qbsStdout.contains("creating libtestc.a"), haveGcc);
+ QCOMPARE(m_qbsStdout.contains("assembling testa.s"), haveGcc);
+ QCOMPARE(m_qbsStdout.contains("compiling testb.S"), haveGcc);
+ QCOMPARE(m_qbsStdout.contains("compiling testc.sx"), haveGcc);
+ QCOMPARE(m_qbsStdout.contains("creating libtesta.a"), haveGcc);
+ QCOMPARE(m_qbsStdout.contains("creating libtestb.a"), haveGcc);
+ QCOMPARE(m_qbsStdout.contains("creating libtestc.a"), haveGcc);
QCOMPARE(m_qbsStdout.contains("creating testd.lib"), haveMSVC);
}
@@ -2841,6 +3264,76 @@ void TestBlackbox::embedInfoPlist()
QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty());
}
+void TestBlackbox::enableExceptions()
+{
+ QFETCH(QString, file);
+ QFETCH(bool, enable);
+ QFETCH(bool, expectSuccess);
+
+ QDir::setCurrent(testDataDir + QStringLiteral("/enableExceptions"));
+
+ QbsRunParameters params;
+ params.arguments = QStringList() << "-f" << file << (QStringLiteral("cpp.enableExceptions:")
+ + (enable ? "true" : "false"));
+ params.expectFailure = !expectSuccess;
+ rmDirR(relativeBuildDir());
+ if (!params.expectFailure)
+ QCOMPARE(runQbs(params), 0);
+ else
+ QVERIFY(runQbs(params) != 0);
+}
+
+void TestBlackbox::enableExceptions_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<bool>("enable");
+ QTest::addColumn<bool>("expectSuccess");
+
+ QTest::newRow("no exceptions, enabled") << "none.qbs" << true << true;
+ QTest::newRow("no exceptions, disabled") << "none.qbs" << false << true;
+
+ QTest::newRow("C++ exceptions, enabled") << "exceptions.qbs" << true << true;
+ QTest::newRow("C++ exceptions, disabled") << "exceptions.qbs" << false << false;
+
+ if (HostOsInfo::isOsxHost()) {
+ QTest::newRow("Objective-C exceptions, enabled") << "exceptions-objc.qbs" << true << true;
+ QTest::newRow("Objective-C exceptions in Objective-C++ source, enabled") << "exceptions-objcpp.qbs" << true << true;
+ QTest::newRow("C++ exceptions in Objective-C++ source, enabled") << "exceptions-objcpp-cpp.qbs" << true << true;
+ QTest::newRow("Objective-C, disabled") << "exceptions-objc.qbs" << false << false;
+ QTest::newRow("Objective-C exceptions in Objective-C++ source, disabled") << "exceptions-objcpp.qbs" << false << false;
+ QTest::newRow("C++ exceptions in Objective-C++ source, disabled") << "exceptions-objcpp-cpp.qbs" << false << false;
+ }
+}
+
+void TestBlackbox::enableRtti()
+{
+ QDir::setCurrent(testDataDir + QStringLiteral("/enableRtti"));
+
+ QbsRunParameters params;
+
+ params.arguments = QStringList() << "cpp.enableRtti:true";
+ rmDirR(relativeBuildDir());
+ QCOMPARE(runQbs(params), 0);
+
+ if (HostOsInfo::isOsxHost()) {
+ params.arguments = QStringList() << "cpp.enableRtti:true" << "project.treatAsObjcpp:true";
+ rmDirR(relativeBuildDir());
+ QCOMPARE(runQbs(params), 0);
+ }
+
+ params.expectFailure = true;
+
+ params.arguments = QStringList() << "cpp.enableRtti:false";
+ rmDirR(relativeBuildDir());
+ QVERIFY(runQbs(params) != 0);
+
+ if (HostOsInfo::isOsxHost()) {
+ params.arguments = QStringList() << "cpp.enableRtti:false" << "project.treatAsObjcpp:true";
+ rmDirR(relativeBuildDir());
+ QVERIFY(runQbs(params) != 0);
+ }
+}
+
void TestBlackbox::frameworkStructure()
{
if (!HostOsInfo::isOsxHost())
@@ -2977,9 +3470,11 @@ void TestBlackbox::typescript()
QDir::setCurrent(testDataDir + QLatin1String("/typescript"));
status = runQbs();
- if (p.value("typescript.toolchainInstallPath").toString().isEmpty()
- && status != 0 && m_qbsStderr.contains("toolchainInstallPath")) {
- QSKIP("typescript.toolchainInstallPath not set and automatic detection failed");
+ if (p.value("typescript.toolchainInstallPath").toString().isEmpty() && status != 0) {
+ if (m_qbsStderr.contains("typescript.toolchainInstallPath"))
+ QSKIP("typescript.toolchainInstallPath not set and automatic detection failed");
+ if (m_qbsStderr.contains("nodejs.interpreterFilePath"))
+ QSKIP("nodejs.interpreterFilePath not set and automatic detection failed");
}
QCOMPARE(status, 0);
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 9ac814960..72dff6088 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -103,6 +103,8 @@ private slots:
void assetCatalog_data();
void badInterpreter();
void buildDirectories();
+ void bundleStructure();
+ void bundleStructure_data();
void changedFiles_data();
void changedFiles();
void changeInDisabledProduct();
@@ -113,11 +115,17 @@ private slots:
void concurrentExecutor();
void dependenciesProperty();
void dependencyProfileMismatch();
+ void deploymentTarget();
+ void deploymentTarget_data();
void dynamicMultiplexRule();
void dynamicRuleOutputs();
void embedInfoPlist();
+ void enableExceptions();
+ void enableExceptions_data();
+ void enableRtti();
void erroneousFiles_data();
void erroneousFiles();
+ void errorInfo();
void exportRule();
void fileDependencies();
void frameworkStructure();
@@ -156,6 +164,8 @@ private slots:
void objcArc();
void outputArtifactAutoTagging();
void overrideProjectProperties();
+ void probeProperties();
+ void probeInExportedModule();
void probesInNestedModules();
void productDependenciesByType();
void productProperties();
@@ -169,6 +179,7 @@ private slots:
void radAfterIncompleteBuild();
void recursiveRenaming();
void recursiveWildcards();
+ void referenceErrorInExport();
void reproducibleBuild();
void reproducibleBuild_data();
void ruleConditions();