aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/api/tst_api.cpp7
-rw-r--r--tests/auto/blackbox/testdata-apple/codesign/codesign.qbs12
-rw-r--r--tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs2
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs11
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt3
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/main.cpp8
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt9
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py36
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp7
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h10
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt7
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py35
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/lorem_ipsum.txt1
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp6
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h3
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/conanfile.py15
-rw-r--r--tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/header.h6
-rw-r--r--tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provider_a.qbs6
-rw-r--r--tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.qbs1
-rw-r--r--tests/auto/blackbox/testdata/capnproto/capnproto_cpp.qbs1
-rw-r--r--tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs19
-rw-r--r--tests/auto/blackbox/testdata/capnproto/conanfile.txt6
-rw-r--r--tests/auto/blackbox/testdata/capnproto/greeter_cpp.qbs5
-rw-r--r--tests/auto/blackbox/testdata/external-libs/external-libs.qbs2
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/bar.fbs9
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/baz.fbs9
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/conanfile.txt6
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat.c36
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat.cpp22
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.cpp25
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.qbs24
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_c.qbs21
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_cpp.qbs21
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.cpp22
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.qbs23
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.cpp22
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.qbs23
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.cpp26
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.qbs25
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_relative_import.cpp25
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/flat_relative_import.qbs22
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/foo.fbs8
-rw-r--r--tests/auto/blackbox/testdata/flatbuf/imports/imported_foo/imported_foo.fbs8
-rw-r--r--tests/auto/blackbox/testdata/grpc/conanfile.txt7
-rw-r--r--tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs5
-rw-r--r--tests/auto/blackbox/testdata/invalid-artifact-path/invalid-artifact-path.qbs18
-rw-r--r--tests/auto/blackbox/testdata/linkerMode/darwin.s6
-rw-r--r--tests/auto/blackbox/testdata/linkerMode/linkerMode.qbs2
-rw-r--r--tests/auto/blackbox/testdata/linkerMode/main.s1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs2
-rw-r--r--tests/auto/blackbox/testdata/protobuf/conanfile.txt6
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp211
-rw-r--r--tests/auto/blackbox/tst_blackbox.h7
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp42
-rw-r--r--tests/auto/blackbox/tst_blackboxbase.cpp13
-rw-r--r--tests/auto/blackbox/tst_blackboxbase.h5
-rw-r--r--tests/auto/blackbox/tst_blackboxexamples.cpp1
-rw-r--r--tests/auto/blackbox/tst_blackboxproviders.cpp66
-rw-r--r--tests/auto/blackbox/tst_blackboxproviders.h2
-rw-r--r--tests/auto/language/testdata/erroneous/module-with-id.qbs4
-rw-r--r--tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithId.qbs1
-rw-r--r--tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithIdParent.qbs1
-rw-r--r--tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs3
-rw-r--r--tests/auto/language/tst_language.cpp1
64 files changed, 917 insertions, 82 deletions
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 3816eca2b..45463312b 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -2902,6 +2902,7 @@ void TestApi::targetArtifactStatus()
void TestApi::timeout()
{
QFETCH(QString, projectDirName);
+ QFETCH(QString, cancelOutput);
const auto setupParams = defaultSetupParameters(projectDirName + "/timeout.qbs");
std::unique_ptr<qbs::SetupProjectJob> setupJob{
qbs::Project().setupProject(setupParams, m_logSink, nullptr)};
@@ -2934,13 +2935,15 @@ void TestApi::timeout()
const auto errorString = buildJob->error().toString();
QVERIFY2(errorString.contains("cancel"), qPrintable(errorString));
QVERIFY(errorString.contains("timeout"));
+ QVERIFY(errorString.contains(cancelOutput));
}
void TestApi::timeout_data()
{
QTest::addColumn<QString>("projectDirName");
- QTest::newRow("JS Command") << QString("timeout-js");
- QTest::newRow("Process Command") << QString("timeout-process");
+ QTest::addColumn<QString>("cancelOutput");
+ QTest::newRow("JS Command") << QString("timeout-js") << QString("infinite loop");
+ QTest::newRow("Process Command") << QString("timeout-process") << QString("infinite-loop");
}
void TestApi::toolInModule()
diff --git a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
index 08c8f730b..c1fc0502a 100644
--- a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
+++ b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
@@ -2,10 +2,13 @@ import "../multiarch-helpers.js" as Helpers
Project {
name: "p"
+ // we do not have the access to xcode version in qbs.architectures so we need to pass it here
property string xcodeVersion
property bool isBundle: true
property bool enableSigning: true
+ property bool multiArch: false
+ property bool multiVariant: false
CppApplication {
name: "A"
@@ -18,7 +21,8 @@ Project {
installDir: ""
qbs.architectures:
- project.xcodeVersion ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ qbs.buildVariants: project.multiVariant ? ["debug", "release"] : []
}
DynamicLibrary {
@@ -32,7 +36,8 @@ Project {
install: true
installDir: ""
qbs.architectures:
- project.xcodeVersion ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ qbs.buildVariants: project.multiVariant ? ["debug", "release"] : []
}
LoadableModule {
@@ -46,6 +51,7 @@ Project {
install: true
installDir: ""
qbs.architectures:
- project.xcodeVersion ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : []
+ qbs.buildVariants: project.multiVariant ? ["debug", "release"] : []
}
}
diff --git a/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs b/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs
index 7e7427561..7336e3970 100644
--- a/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs
+++ b/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbs
@@ -2,7 +2,7 @@ import "../BareMetalApplication.qbs" as BareMetalApplication
import "../BareMetalStaticLibrary.qbs" as BareMetalStaticLibrary
Project {
- property string outputLibrariesDirectory: sourceDirectory + "/libs"
+ property string outputLibrariesDirectory: buildDirectory + "/libs"
BareMetalStaticLibrary {
name: "lib-a"
destinationDirectory: project.outputLibrariesDirectory
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs b/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs
new file mode 100644
index 000000000..e8880fc96
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs
@@ -0,0 +1,11 @@
+CppApplication {
+ consoleApplication: true
+ name: "p"
+ files: "main.cpp"
+ qbsModuleProviders: "conan"
+ qbs.buildVariant: "release"
+ qbs.installPrefix: ""
+ install: true
+ Depends { name: "conanmoduleprovider.testlib" }
+ Depends { name: "conanmoduleprovider.testlibheader" }
+}
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt b/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt
new file mode 100644
index 000000000..7c40ff7d6
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt
@@ -0,0 +1,3 @@
+[requires]
+conanmoduleprovider.testlib/1.2.3
+conanmoduleprovider.testlibheader/0.1.0
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp b/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp
new file mode 100644
index 000000000..6250927b3
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp
@@ -0,0 +1,8 @@
+#include <testlib.h>
+
+#include <header.h>
+
+int main()
+{
+ HelloWorld h(42 + hello());
+}
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt
new file mode 100644
index 000000000..d186d1906
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.15)
+project(conanmoduleprovider.testlib)
+
+find_package(conanmoduleprovider.testlibdep REQUIRED)
+
+add_library(${PROJECT_NAME} STATIC testlib.cpp)
+set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlib.h")
+target_link_libraries(${PROJECT_NAME} conanmoduleprovider.testlibdep::conanmoduleprovider.testlibdep)
+install(TARGETS ${PROJECT_NAME})
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py
new file mode 100644
index 000000000..7cb91f9ef
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py
@@ -0,0 +1,36 @@
+from conan import ConanFile
+from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
+from conan.tools.files import collect_libs
+import os
+
+class ConanModuleProviderTestlib(ConanFile):
+ name = "conanmoduleprovider.testlib"
+ license = "none"
+ version = "1.2.3"
+
+ exports_sources = "*.cpp", "*.h", "CMakeLists.txt"
+ settings = "os", "compiler", "build_type", "arch"
+
+ def requirements(self):
+ self.requires("conanmoduleprovider.testlibdep/1.2.3")
+
+ def layout(self):
+ cmake_layout(self)
+
+ def generate(self):
+ deps = CMakeDeps(self)
+ deps.generate()
+ tc = CMakeToolchain(self, generator="Ninja")
+ tc.generate()
+
+ def build(self):
+ cmake = CMake(self)
+ cmake.configure()
+ cmake.build()
+
+ def package(self):
+ cmake = CMake(self)
+ cmake.install()
+
+ def package_info(self):
+ self.cpp_info.libs = collect_libs(self)
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp
new file mode 100644
index 000000000..7118dfda9
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp
@@ -0,0 +1,7 @@
+#include "testlib.h"
+
+#include <testlibdep.h>
+
+HelloWorld::HelloWorld(int x)
+ : m_x(foo(x))
+{}
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h
new file mode 100644
index 000000000..11a354b70
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h
@@ -0,0 +1,10 @@
+#pragma once
+
+class HelloWorld
+{
+public:
+ explicit HelloWorld(int x);
+
+private:
+ int m_x;
+};
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt
new file mode 100644
index 000000000..5510a9250
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.15)
+project(conanmoduleprovider.testlibdep)
+
+add_library(${PROJECT_NAME} STATIC testlibdep.cpp)
+set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlibdep.h")
+install(TARGETS ${PROJECT_NAME})
+install(FILES lorem_ipsum.txt DESTINATION share) \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py
new file mode 100644
index 000000000..f2c577c5e
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py
@@ -0,0 +1,35 @@
+from conan import ConanFile
+from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
+from conan.tools.files import collect_libs, copy
+import os
+
+class ConanModuleProviderTestlib(ConanFile):
+ name = "conanmoduleprovider.testlibdep"
+ license = "none"
+ version = "1.2.3"
+
+ exports_sources = "*.cpp", "*.h", "*.txt"
+ settings = "os", "compiler", "build_type", "arch"
+
+ def layout(self):
+ cmake_layout(self)
+
+ def generate(self):
+ deps = CMakeDeps(self)
+ deps.generate()
+ tc = CMakeToolchain(self, generator="Ninja")
+ tc.generate()
+
+ def build(self):
+ cmake = CMake(self)
+ cmake.configure()
+ cmake.build()
+
+ def package(self):
+ cmake = CMake(self)
+ cmake.install()
+
+ def package_info(self):
+ self.cpp_info.libs = collect_libs(self)
+ self.cpp_info.resdirs = ['share']
+
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/lorem_ipsum.txt b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/lorem_ipsum.txt
new file mode 100644
index 000000000..d8634396c
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/lorem_ipsum.txt
@@ -0,0 +1 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp
new file mode 100644
index 000000000..893478c82
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp
@@ -0,0 +1,6 @@
+#include "testlibdep.h"
+
+int foo(int i)
+{
+ return i * i;
+} \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h
new file mode 100644
index 000000000..ca7bd3cbc
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h
@@ -0,0 +1,3 @@
+#pragma once
+
+int foo(int i); \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/conanfile.py b/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/conanfile.py
new file mode 100644
index 000000000..6078b9750
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/conanfile.py
@@ -0,0 +1,15 @@
+from conan import ConanFile
+from conan.tools.files import copy
+
+import os
+
+class Recipe(ConanFile):
+ exports_sources = ("header.h")
+ version = '0.1.0'
+ name = 'conanmoduleprovider.testlibheader'
+
+ def package(self):
+ copy(self,
+ "header.h",
+ src=self.source_folder,
+ dst=os.path.join(self.package_folder, "include")) \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/header.h b/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/header.h
new file mode 100644
index 000000000..66bd50d57
--- /dev/null
+++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/header.h
@@ -0,0 +1,6 @@
+#pragma once
+
+inline int hello()
+{
+ return 0;
+} \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provider_a.qbs b/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provider_a.qbs
index a1228b19c..476a83143 100644
--- a/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provider_a.qbs
+++ b/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provider_a.qbs
@@ -1,11 +1,13 @@
import "../../qbs-module-providers-helpers.js" as Helpers
ModuleProvider {
+ property string sysroot: qbs.sysroot
Probe {
id: theProbe
property string theValue: "value"
+ property string dummy: sysroot
configure: {
- console.info("Running probe");
+ console.info("Running probe with irrelevant value '" + dummy + "'");
found = true;
}
}
@@ -14,6 +16,8 @@ ModuleProvider {
property string theValue: theProbe.theValue
relativeSearchPaths: {
Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", theValue, undefined, found);
+ if (sysroot !== qbs.sysroot)
+ throw "this is unexpected";
return "";
}
}
diff --git a/tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.qbs b/tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.qbs
index 0d7c8a1bb..4674d6a6a 100644
--- a/tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.qbs
+++ b/tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.qbs
@@ -17,4 +17,5 @@ CppApplication {
"capnproto_absolute_import.cpp",
"imports/foo.capnp",
]
+ qbs.buildVariant: "release"
}
diff --git a/tests/auto/blackbox/testdata/capnproto/capnproto_cpp.qbs b/tests/auto/blackbox/testdata/capnproto/capnproto_cpp.qbs
index c31824bb0..9f287e906 100644
--- a/tests/auto/blackbox/testdata/capnproto/capnproto_cpp.qbs
+++ b/tests/auto/blackbox/testdata/capnproto/capnproto_cpp.qbs
@@ -15,4 +15,5 @@ CppApplication {
"capnproto_cpp.cpp",
"foo.capnp"
]
+ qbs.buildVariant: "release"
}
diff --git a/tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs b/tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs
deleted file mode 100644
index 90201e440..000000000
--- a/tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs
+++ /dev/null
@@ -1,19 +0,0 @@
-import qbs.Host
-
-CppApplication {
- Depends { name: "capnproto.cpp"; required: false }
- condition: {
- var result = qbs.targetPlatform === Host.platform();
- if (!result)
- console.info("targetPlatform differs from hostPlatform");
- if (!capnproto.cpp.present)
- console.info("capnproto is not present");
- return result && capnproto.cpp.present;
- }
- cpp.minimumMacosVersion: "10.8"
- files: [
- "capnproto_cpp.cpp",
- "foo.capnp"
- ]
- qbsModuleProviders: "qbspkgconfig"
-}
diff --git a/tests/auto/blackbox/testdata/capnproto/conanfile.txt b/tests/auto/blackbox/testdata/capnproto/conanfile.txt
new file mode 100644
index 000000000..7313bb82e
--- /dev/null
+++ b/tests/auto/blackbox/testdata/capnproto/conanfile.txt
@@ -0,0 +1,6 @@
+[requires]
+capnproto/1.0.2
+[tool_requires]
+capnproto/1.0.2
+[generators]
+QbsDeps
diff --git a/tests/auto/blackbox/testdata/capnproto/greeter_cpp.qbs b/tests/auto/blackbox/testdata/capnproto/greeter_cpp.qbs
index 7266e9e15..5fc5464b1 100644
--- a/tests/auto/blackbox/testdata/capnproto/greeter_cpp.qbs
+++ b/tests/auto/blackbox/testdata/capnproto/greeter_cpp.qbs
@@ -14,11 +14,14 @@ Project {
name: "server"
consoleApplication: true
cpp.minimumMacosVersion: "10.8"
+ // workaround for broken capnproto
+ cpp.staticLibraries: qbs.targetOS.contains("windows") ? "Advapi32" : []
capnproto.cpp.useRpc: true
files: [
"greeter.capnp",
"greeter-server.cpp"
]
+ qbs.buildVariant: "release"
}
CppApplication {
Depends { name: "capnproto.cpp"; required: false }
@@ -26,9 +29,11 @@ Project {
consoleApplication: true
capnproto.cpp.useRpc: true
cpp.minimumMacosVersion: "10.8"
+ cpp.staticLibraries: qbs.targetOS.contains("windows") ? "Advapi32" : []
files: [
"greeter.capnp",
"greeter-client.cpp"
]
+ qbs.buildVariant: "release"
}
}
diff --git a/tests/auto/blackbox/testdata/external-libs/external-libs.qbs b/tests/auto/blackbox/testdata/external-libs/external-libs.qbs
index 610df0507..326bf5dae 100644
--- a/tests/auto/blackbox/testdata/external-libs/external-libs.qbs
+++ b/tests/auto/blackbox/testdata/external-libs/external-libs.qbs
@@ -1,7 +1,7 @@
import qbs.TextFile
Project {
- property string libDir: sourceDirectory + "/libs"
+ property string libDir: buildDirectory + "/libs"
StaticLibrary {
name: "lib1"
destinationDirectory: project.libDir
diff --git a/tests/auto/blackbox/testdata/flatbuf/bar.fbs b/tests/auto/blackbox/testdata/flatbuf/bar.fbs
new file mode 100644
index 000000000..47148f800
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/bar.fbs
@@ -0,0 +1,9 @@
+include "foo.fbs";
+
+namespace QbsTest;
+
+table Bar {
+ foo:Foo;
+}
+
+root_type Bar;
diff --git a/tests/auto/blackbox/testdata/flatbuf/baz.fbs b/tests/auto/blackbox/testdata/flatbuf/baz.fbs
new file mode 100644
index 000000000..312183710
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/baz.fbs
@@ -0,0 +1,9 @@
+include "imported_foo/imported_foo.fbs";
+
+namespace QbsTest;
+
+table Baz {
+ foo:Foo;
+}
+
+root_type Baz;
diff --git a/tests/auto/blackbox/testdata/flatbuf/conanfile.txt b/tests/auto/blackbox/testdata/flatbuf/conanfile.txt
new file mode 100644
index 000000000..188da5897
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/conanfile.txt
@@ -0,0 +1,6 @@
+[requires]
+flatbuffers/24.3.25
+[tool_requires]
+flatbuffers/24.3.25
+[generators]
+QbsDeps
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat.c b/tests/auto/blackbox/testdata/flatbuf/flat.c
new file mode 100644
index 000000000..55e25e556
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat.c
@@ -0,0 +1,36 @@
+#include "foo_builder.h"
+
+#include <stdio.h>
+
+#undef ns
+#define ns(x) FLATBUFFERS_WRAP_NAMESPACE(QbsTest, x) // Specified in the schema.
+
+#define test_assert(x) do { if (!(x)) { assert(0); return -1; }} while (0)
+
+int main()
+{
+ void *buffer = NULL;
+ size_t size = 0;
+
+ flatcc_builder_t builder;
+ flatcc_builder_init(&builder);
+
+ flatbuffers_string_ref_t name = flatbuffers_string_create_str(&builder, "John Doe");
+
+ ns(Foo_create_as_root(&builder, name, 42));
+
+ buffer = flatcc_builder_finalize_aligned_buffer(&builder, &size);
+
+ ns(Foo_table_t) foo = ns(Foo_as_root(buffer));
+
+ test_assert(strcmp(ns(Foo_name(foo)), "John Doe") == 0);
+ test_assert(ns(Foo_count(foo)) == 42);
+
+ free(buffer);
+
+ flatcc_builder_clear(&builder);
+
+ printf("The FlatBuffer was successfully created and accessed!\n");
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat.cpp b/tests/auto/blackbox/testdata/flatbuf/flat.cpp
new file mode 100644
index 000000000..56332bacd
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat.cpp
@@ -0,0 +1,22 @@
+#include "foo_generated.h"
+
+#include <iostream>
+
+using namespace QbsTest;
+
+int main()
+{
+ flatbuffers::FlatBufferBuilder builder;
+ auto name = builder.CreateString("John Doe");
+ auto newFoo = QbsTest::CreateFoo(builder, name, 42);
+ builder.Finish(newFoo);
+
+ auto foo = GetFoo(builder.GetBufferPointer());
+
+ assert(foo->name()->str() == "John Doe");
+ assert(foo->count() == 42);
+
+ std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl;
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.cpp b/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.cpp
new file mode 100644
index 000000000..b7c43d8a5
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.cpp
@@ -0,0 +1,25 @@
+#include "baz_generated.h"
+
+#include <iostream>
+
+using namespace QbsTest;
+
+int main()
+{
+ flatbuffers::FlatBufferBuilder builder;
+
+ auto name = builder.CreateString("John Doe");
+ auto newFoo = QbsTest::CreateFoo(builder, name, 42);
+
+ auto newBaz = QbsTest::CreateBaz(builder, newFoo);
+ builder.Finish(newBaz);
+
+ auto baz = GetBaz(builder.GetBufferPointer());
+
+ assert(baz->foo()->name()->str() == "John Doe");
+ assert(baz->foo()->count() == 42);
+
+ std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl;
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.qbs
new file mode 100644
index 000000000..888bfd4e3
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.qbs
@@ -0,0 +1,24 @@
+CppApplication {
+ Depends { name: "flatbuf.cpp"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuf.cpp.present);
+ return flatbuf.cpp.present;
+ }
+
+ flatbuf.cpp.importPaths: "imports/"
+
+ files: [
+ "flat_absolute_import.cpp",
+ "baz.fbs",
+ "imports/imported_foo/imported_foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_c.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_c.qbs
new file mode 100644
index 000000000..6d365252e
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_c.qbs
@@ -0,0 +1,21 @@
+CppApplication {
+ Depends { name: "flatbuffers.c"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuffers.c.present);
+ return flatbuffers.c.present;
+ }
+
+ files: [
+ "flat.c",
+ "foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_cpp.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_cpp.qbs
new file mode 100644
index 000000000..99e89a5fa
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_cpp.qbs
@@ -0,0 +1,21 @@
+CppApplication {
+ Depends { name: "flatbuf.cpp"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuf.cpp.present);
+ return flatbuf.cpp.present;
+ }
+
+ files: [
+ "flat.cpp",
+ "foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.cpp b/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.cpp
new file mode 100644
index 000000000..77ed64acd
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.cpp
@@ -0,0 +1,22 @@
+#include "foo_generated.hpp"
+
+#include <iostream>
+
+using namespace QbsTest;
+
+int main()
+{
+ flatbuffers::FlatBufferBuilder builder;
+ auto name = builder.CreateString("John Doe");
+ auto newFoo = QbsTest::CreateFoo(builder, name, 42);
+ builder.Finish(newFoo);
+
+ auto foo = GetFoo(builder.GetBufferPointer());
+
+ assert(foo->name()->str() == "John Doe");
+ assert(foo->count() == 42);
+
+ std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl;
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.qbs
new file mode 100644
index 000000000..31eec7629
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.qbs
@@ -0,0 +1,23 @@
+CppApplication {
+ Depends { name: "flatbuf.cpp"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuf.cpp.present);
+ return flatbuf.cpp.present;
+ }
+
+ flatbuf.cpp.filenameExtension: "hpp"
+
+ files: [
+ "flat_filename_extension.cpp",
+ "foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.cpp b/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.cpp
new file mode 100644
index 000000000..630e4aaef
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.cpp
@@ -0,0 +1,22 @@
+#include "foo.fbs.h"
+
+#include <iostream>
+
+using namespace QbsTest;
+
+int main()
+{
+ flatbuffers::FlatBufferBuilder builder;
+ auto name = builder.CreateString("John Doe");
+ auto newFoo = QbsTest::CreateFoo(builder, name, 42);
+ builder.Finish(newFoo);
+
+ auto foo = GetFoo(builder.GetBufferPointer());
+
+ assert(foo->name()->str() == "John Doe");
+ assert(foo->count() == 42);
+
+ std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl;
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.qbs
new file mode 100644
index 000000000..5103b041f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.qbs
@@ -0,0 +1,23 @@
+CppApplication {
+ Depends { name: "flatbuf.cpp"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuf.cpp.present);
+ return flatbuf.cpp.present;
+ }
+
+ flatbuf.cpp.filenameSuffix: ".fbs"
+
+ files: [
+ "flat_filename_suffix.cpp",
+ "foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.cpp b/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.cpp
new file mode 100644
index 000000000..5f4b55e96
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.cpp
@@ -0,0 +1,26 @@
+#include "baz_generated.h"
+#include "imported_foo/imported_foo_generated.h"
+
+#include <iostream>
+
+using namespace QbsTest;
+
+int main()
+{
+ flatbuffers::FlatBufferBuilder builder;
+
+ auto name = builder.CreateString("John Doe");
+ auto newFoo = QbsTest::CreateFoo(builder, name, 42);
+
+ auto newBaz = QbsTest::CreateBaz(builder, newFoo);
+ builder.Finish(newBaz);
+
+ auto baz = GetBaz(builder.GetBufferPointer());
+
+ assert(baz->foo()->name()->str() == "John Doe");
+ assert(baz->foo()->count() == 42);
+
+ std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl;
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.qbs
new file mode 100644
index 000000000..0ea0d1dac
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.qbs
@@ -0,0 +1,25 @@
+CppApplication {
+ Depends { name: "flatbuf.cpp"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuf.cpp.present);
+ return flatbuf.cpp.present;
+ }
+
+ flatbuf.cpp.importPaths: "imports/"
+ flatbuf.cpp.keepPrefix: true
+
+ files: [
+ "flat_keep_prefix.cpp",
+ "baz.fbs",
+ "imports/imported_foo/imported_foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.cpp b/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.cpp
new file mode 100644
index 000000000..bec6dadfd
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.cpp
@@ -0,0 +1,25 @@
+#include "bar_generated.h"
+
+#include <iostream>
+
+using namespace QbsTest;
+
+int main()
+{
+ flatbuffers::FlatBufferBuilder builder;
+
+ auto name = builder.CreateString("John Doe");
+ auto newFoo = QbsTest::CreateFoo(builder, name, 42);
+
+ auto newBar = QbsTest::CreateBar(builder, newFoo);
+ builder.Finish(newBar);
+
+ auto bar = GetBar(builder.GetBufferPointer());
+
+ assert(bar->foo()->name()->str() == "John Doe");
+ assert(bar->foo()->count() == 42);
+
+ std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl;
+
+ return 0;
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.qbs b/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.qbs
new file mode 100644
index 000000000..f5a2c5d0b
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.qbs
@@ -0,0 +1,22 @@
+CppApplication {
+ Depends { name: "flatbuf.cpp"; required: false }
+
+ consoleApplication: true
+ condition: {
+ var result = qbs.targetPlatform === qbs.hostPlatform;
+ if (!result)
+ console.info("targetPlatform differs from hostPlatform");
+ return result && hasFlatbuffers;
+ }
+ property bool hasFlatbuffers: {
+ console.info("has flatbuffers: " + flatbuf.cpp.present);
+ return flatbuf.cpp.present;
+ }
+
+ files: [
+ "flat_relative_import.cpp",
+ "bar.fbs",
+ "foo.fbs",
+ ]
+ qbsModuleProviders: "conan"
+}
diff --git a/tests/auto/blackbox/testdata/flatbuf/foo.fbs b/tests/auto/blackbox/testdata/flatbuf/foo.fbs
new file mode 100644
index 000000000..dff3b488f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/foo.fbs
@@ -0,0 +1,8 @@
+namespace QbsTest;
+
+table Foo {
+ name:string;
+ count:int;
+}
+
+root_type Foo;
diff --git a/tests/auto/blackbox/testdata/flatbuf/imports/imported_foo/imported_foo.fbs b/tests/auto/blackbox/testdata/flatbuf/imports/imported_foo/imported_foo.fbs
new file mode 100644
index 000000000..dff3b488f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/flatbuf/imports/imported_foo/imported_foo.fbs
@@ -0,0 +1,8 @@
+namespace QbsTest;
+
+table Foo {
+ name:string;
+ count:int;
+}
+
+root_type Foo;
diff --git a/tests/auto/blackbox/testdata/grpc/conanfile.txt b/tests/auto/blackbox/testdata/grpc/conanfile.txt
new file mode 100644
index 000000000..f88e6e8d6
--- /dev/null
+++ b/tests/auto/blackbox/testdata/grpc/conanfile.txt
@@ -0,0 +1,7 @@
+[requires]
+grpc/1.54.3
+[tool_requires]
+protobuf/3.21.12
+grpc/1.54.3
+[generators]
+QbsDeps
diff --git a/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs b/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs
index 4b004a884..d1bdd5d60 100644
--- a/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs
+++ b/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs
@@ -12,8 +12,9 @@ CppApplication {
Depends { name: "cpp" }
cpp.cxxLanguageVersion: "c++17"
- cpp.minimumMacosVersion: "10.8"
+ cpp.minimumMacosVersion: "10.15"
cpp.warningLevel: "none"
+ qbs.buildVariant: "release"
Depends { name: "protobuf.cpp"; required: false }
Depends { name: "grpc++"; id: grpcpp; required: false }
@@ -22,7 +23,7 @@ CppApplication {
property bool hasDependencies: {
console.info("has grpc: " + protobuf.cpp.present);
console.info("has modules: " + grpcpp.present);
- return protobuf.cpp.present;
+ return protobuf.cpp.present && grpcpp.present;
}
files: "grpc.cpp"
diff --git a/tests/auto/blackbox/testdata/invalid-artifact-path/invalid-artifact-path.qbs b/tests/auto/blackbox/testdata/invalid-artifact-path/invalid-artifact-path.qbs
new file mode 100644
index 000000000..650233d86
--- /dev/null
+++ b/tests/auto/blackbox/testdata/invalid-artifact-path/invalid-artifact-path.qbs
@@ -0,0 +1,18 @@
+Project {
+ property string artifactDir
+ Product {
+ type: "t"
+ Rule {
+ multiplex: true
+ Artifact {
+ filePath: project.artifactDir + "/file.out"
+ fileTags: "t"
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.sourceCode = function() {};
+ return cmd;
+ }
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/linkerMode/darwin.s b/tests/auto/blackbox/testdata/linkerMode/darwin.s
new file mode 100644
index 000000000..fb165114b
--- /dev/null
+++ b/tests/auto/blackbox/testdata/linkerMode/darwin.s
@@ -0,0 +1,6 @@
+.globl _main
+.globl main
+
+_main:
+main:
+ ret
diff --git a/tests/auto/blackbox/testdata/linkerMode/linkerMode.qbs b/tests/auto/blackbox/testdata/linkerMode/linkerMode.qbs
index 9934efb04..176730ce0 100644
--- a/tests/auto/blackbox/testdata/linkerMode/linkerMode.qbs
+++ b/tests/auto/blackbox/testdata/linkerMode/linkerMode.qbs
@@ -2,7 +2,7 @@ Project {
CppApplication {
consoleApplication: true
name: "LinkedProduct-Assembly"
- files: ["main.s"]
+ files: qbs.targetOS.includes("darwin") ? "darwin.s" : "main.s"
cpp.linkerPath: cpp.compilerPathByLanguage["c"]
diff --git a/tests/auto/blackbox/testdata/linkerMode/main.s b/tests/auto/blackbox/testdata/linkerMode/main.s
index fb165114b..ef88f8c52 100644
--- a/tests/auto/blackbox/testdata/linkerMode/main.s
+++ b/tests/auto/blackbox/testdata/linkerMode/main.s
@@ -3,4 +3,3 @@
_main:
main:
- ret
diff --git a/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs b/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs
index 2db71fd03..959552ea5 100644
--- a/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs
@@ -11,7 +11,7 @@ CppApplication {
consoleApplication: true
Depends { name: "cpp" }
- cpp.minimumMacosVersion: "10.8"
+ cpp.minimumMacosVersion: "10.15"
Depends { name: "protobuf.cpp"; required: false }
property bool hasProtobuf: {
diff --git a/tests/auto/blackbox/testdata/protobuf/conanfile.txt b/tests/auto/blackbox/testdata/protobuf/conanfile.txt
new file mode 100644
index 000000000..e7d849b1a
--- /dev/null
+++ b/tests/auto/blackbox/testdata/protobuf/conanfile.txt
@@ -0,0 +1,6 @@
+[requires]
+protobuf/3.21.12
+[tool_requires]
+protobuf/3.21.12
+[generators]
+QbsDeps
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index c62fdbca0..dbabfb311 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -144,6 +144,26 @@ QString TestBlackbox::findArchiver(const QString &fileName, int *status)
return binary;
}
+bool TestBlackbox::prepareAndRunConan()
+{
+ QString executable = findExecutable({"conan"});
+ if (executable.isEmpty()) {
+ qInfo() << "conan is not installed or not available in PATH.";
+ return false;
+ }
+ const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test";
+ if (!QFileInfo(profilePath).exists()) {
+ qInfo() << "conan profile is not installed, run './scripts/setup-conan-profiles.sh'";
+ return false;
+ }
+ QProcess conan;
+ QDir::setCurrent(testDataDir + "/conan-provider/testlibdep");
+ rmDirR("build");
+ QStringList arguments{"install", ".", "--profile:all=qbs-test", "--output-folder=build"};
+ conan.start(executable, arguments);
+ return waitForProcessSuccess(conan, 60000);
+}
+
bool TestBlackbox::lexYaccExist()
{
return !findExecutable(QStringList("lex")).isEmpty()
@@ -707,6 +727,45 @@ void TestBlackbox::buildDirectories()
QVERIFY2(outputLines.contains(projectDir), m_qbsStdout.constData());
}
+void TestBlackbox::buildDirPlaceholders_data()
+{
+ QTest::addColumn<QString>("buildDir");
+ QTest::addColumn<bool>("setProjectFile");
+ QTest::addColumn<bool>("successExpected");
+
+ QTest::newRow("normal dir, with project file") << "somedir" << true << true;
+ QTest::newRow("normal dir, without project file") << "somedir" << false << true;
+ QTest::newRow("@project, with project file") << "somedir/@project" << true << true;
+ QTest::newRow("@project, without project file") << "somedir/@project" << false << false;
+ QTest::newRow("@path, with project file") << "somedir/@path" << true << true;
+ QTest::newRow("@path, without project file") << "somedir/@path" << false << false;
+}
+
+void TestBlackbox::buildDirPlaceholders()
+{
+ QFETCH(QString, buildDir);
+ QFETCH(bool, setProjectFile);
+ QFETCH(bool, successExpected);
+
+ const QString projectDir = testDataDir + "/build-dir-placeholders";
+ rmDirR(projectDir);
+ QVERIFY(QDir().mkpath(projectDir));
+ QDir::setCurrent(projectDir);
+ QFile projectFile("build-dir-placeholders.qbs");
+ QVERIFY(projectFile.open(QIODevice::WriteOnly));
+ projectFile.write("Product {\n}\n");
+ projectFile.flush();
+ rmDirR(relativeBuildDir());
+ QbsRunParameters params;
+ params.buildDirectory = buildDir;
+ if (setProjectFile) {
+ params.arguments << "-f"
+ << "build-dir-placeholders.qbs";
+ }
+ params.expectFailure = !successExpected;
+ QCOMPARE(runQbs(params) == 0, successExpected);
+}
+
void TestBlackbox::buildEnvChange()
{
QDir::setCurrent(testDataDir + "/buildenv-change");
@@ -793,28 +852,45 @@ void TestBlackbox::buildVariantDefaults()
void TestBlackbox::capnproto()
{
QFETCH(QString, projectFile);
+ QFETCH(QStringList, arguments);
QDir::setCurrent(testDataDir + "/capnproto");
rmDirR(relativeBuildDir());
+ if (QTest::currentDataTag() == QLatin1String("cpp-conan")
+ || QTest::currentDataTag() == QLatin1String("rpc-conan")) {
+ if (!prepareAndRunConan())
+ QSKIP("conan is not prepared, check messages above");
+ }
+
QbsRunParameters params{QStringLiteral("resolve"), {QStringLiteral("-f"), projectFile}};
+ params.arguments << arguments;
+ QCOMPARE(runQbs(params), 0);
if (m_qbsStdout.contains("targetPlatform differs from hostPlatform"))
QSKIP("Cannot run binaries in cross-compiled build");
if (m_qbsStdout.contains("capnproto is not present"))
QSKIP("capnproto is not present");
- params.command.clear();
+ params.command = QStringLiteral("build");
QCOMPARE(runQbs(params), 0);
}
void TestBlackbox::capnproto_data()
{
QTest::addColumn<QString>("projectFile");
+ QTest::addColumn<QStringList>("arguments");
- QTest::newRow("cpp") << QStringLiteral("capnproto_cpp.qbs");
- QTest::newRow("cpp-pkgconfig") << QStringLiteral("capnproto_cpp_pkgconfig.qbs");
- QTest::newRow("greeter cpp (grpc)") << QStringLiteral("greeter_cpp.qbs");
- QTest::newRow("relative import") << QStringLiteral("capnproto_relative_import.qbs");
- QTest::newRow("absolute import") << QStringLiteral("capnproto_absolute_import.qbs");
+ QStringList pkgConfigArgs({"project.qbsModuleProviders:qbspkgconfig"});
+ QTest::newRow("cpp-pkgconfig") << QStringLiteral("capnproto_cpp.qbs") << pkgConfigArgs;
+ QTest::newRow("rpc-pkgconfig") << QStringLiteral("greeter_cpp.qbs") << pkgConfigArgs;
+ QTest::newRow("relative import")
+ << QStringLiteral("capnproto_relative_import.qbs") << pkgConfigArgs;
+ QTest::newRow("absolute import")
+ << QStringLiteral("capnproto_absolute_import.qbs") << pkgConfigArgs;
+
+ QStringList conanArgs(
+ {"project.qbsModuleProviders:conan", "moduleProviders.conan.installDirectory:build"});
+ QTest::newRow("cpp-conan") << QStringLiteral("capnproto_cpp.qbs") << conanArgs;
+ QTest::newRow("rpc-conan") << QStringLiteral("greeter_cpp.qbs") << conanArgs;
}
void TestBlackbox::changedFiles_data()
@@ -1386,19 +1462,6 @@ void TestBlackbox::variantSuffix_data()
std::make_pair(QString("unix"), QStringList())});
}
-static bool waitForProcessSuccess(QProcess &p, int msecs = 30000)
-{
- if (!p.waitForStarted(msecs) || !p.waitForFinished(msecs)) {
- qDebug() << p.errorString();
- return false;
- }
- if (p.exitCode() != 0) {
- qDebug() << p.readAllStandardError();
- return false;
- }
- return true;
-}
-
void TestBlackbox::vcsGit()
{
const QString gitFilePath = findExecutable(QStringList("git"));
@@ -1925,6 +1988,9 @@ void TestBlackbox::conanfileProbe()
{
QFETCH(bool, forceFailure);
+ if (qEnvironmentVariableIsSet("GITHUB_ACTIONS"))
+ QSKIP("Skip this test when running on GitHub");
+
QString executable = findExecutable({"conan"});
if (executable.isEmpty())
QSKIP("conan is not installed or not available in PATH.");
@@ -4343,6 +4409,43 @@ void TestBlackbox::fileTagsFilterMerging()
QVERIFY2(QFile::exists(otherOutput), qPrintable(otherOutput));
}
+void TestBlackbox::flatbuf()
+{
+ QFETCH(QString, projectFile);
+
+ QDir::setCurrent(testDataDir + "/flatbuf");
+
+ rmDirR(relativeBuildDir());
+ if (!prepareAndRunConan())
+ QSKIP("conan is not prepared, check messages above");
+
+ QbsRunParameters resolveParams(
+ "resolve", QStringList{"-f", projectFile, "moduleProviders.conan.installDirectory:build"});
+ QCOMPARE(runQbs(resolveParams), 0);
+ if (m_qbsStdout.contains("targetPlatform differs from hostPlatform"))
+ QSKIP("Cannot run binaries in cross-compiled build");
+ const bool withFlatbuffers = m_qbsStdout.contains("has flatbuffers: true");
+ const bool withoutFlatbuffers = m_qbsStdout.contains("has flatbuffers: false");
+ QVERIFY2(withFlatbuffers || withoutFlatbuffers, m_qbsStdout.constData());
+ if (withoutFlatbuffers)
+ QSKIP("flatbuf module not present");
+ QbsRunParameters runParams("run");
+ QCOMPARE(runQbs(runParams), 0);
+}
+
+void TestBlackbox::flatbuf_data()
+{
+ QTest::addColumn<QString>("projectFile");
+
+ // QTest::newRow("c") << QString("flat_c.qbs");
+ QTest::newRow("cpp") << QString("flat_cpp.qbs");
+ QTest::newRow("relative import") << QString("flat_relative_import.qbs");
+ QTest::newRow("absolute import") << QString("flat_absolute_import.qbs");
+ QTest::newRow("filename suffix") << QString("flat_filename_suffix.qbs");
+ QTest::newRow("filename extension") << QString("flat_filename_extension.qbs");
+ QTest::newRow("keep prefix") << QString("flat_keep_prefix.qbs");
+}
+
void TestBlackbox::freedesktop()
{
if (!HostOsInfo::isAnyUnixHost())
@@ -4597,6 +4700,33 @@ void TestBlackbox::installTree()
QVERIFY(QFile::exists(installRoot + "content/subdir2/baz.txt"));
}
+void TestBlackbox::invalidArtifactPath_data()
+{
+ QTest::addColumn<QString>("baseDir");
+ QTest::addColumn<bool>("isValid");
+
+ QTest::newRow("inside, normal case") << "subdir" << true;
+ QTest::newRow("inside, build dir 1") << "project.buildDirectory" << true;
+ QTest::newRow("inside, build dir 2") << "subdir/.." << true;
+ QTest::newRow("outside, absolute") << "/tmp" << false;
+ QTest::newRow("outside, relative 1") << "../../" << false;
+ QTest::newRow("outside, relative 2") << "subdir/../../.." << false;
+}
+
+void TestBlackbox::invalidArtifactPath()
+{
+ QFETCH(QString, baseDir);
+ QFETCH(bool, isValid);
+
+ rmDirR(relativeBuildDir());
+ QDir::setCurrent(testDataDir + "/invalid-artifact-path");
+ QbsRunParameters params(QStringList("project.artifactDir:" + baseDir));
+ params.expectFailure = !isValid;
+ QCOMPARE(runQbs(params) == 0, isValid);
+ if (!isValid)
+ QVERIFY2(m_qbsStderr.contains("outside of build directory"), m_qbsStderr.constData());
+}
+
void TestBlackbox::invalidCommandProperty_data()
{
QTest::addColumn<QString>("errorType");
@@ -6061,6 +6191,12 @@ void TestBlackbox::protobuf_data()
QTest::newRow("cpp-pkgconfig")
<< QString("addressbook_cpp.qbs")
<< QStringList({"project.qbsModuleProviders:qbspkgconfig"}) << true << true;
+ QTest::newRow("cpp-conan") << QString("addressbook_cpp.qbs")
+ << QStringList(
+ {"project.qbsModuleProviders:conan",
+ "qbs.buildVariant:release",
+ "moduleProviders.conan.installDirectory:build"})
+ << true << true;
QTest::newRow("objc") << QString("addressbook_objc.qbs") << QStringList() << false << true;
QTest::newRow("nanopb") << QString("addressbook_nanopb.qbs") << QStringList() << false << true;
QTest::newRow("import") << QString("import.qbs") << QStringList() << true << true;
@@ -6081,6 +6217,12 @@ void TestBlackbox::protobuf()
QFETCH(bool, hasModules);
QFETCH(bool, successExpected);
rmDirR(relativeBuildDir());
+
+ if (QTest::currentDataTag() == QLatin1String("cpp-conan")) {
+ if (!prepareAndRunConan())
+ QSKIP("conan is not prepared, check messages above");
+ }
+
QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile} << properties);
QCOMPARE(runQbs(resolveParams), 0);
if (m_qbsStdout.contains("targetPlatform differs from hostPlatform"))
@@ -7531,6 +7673,7 @@ void TestBlackbox::autotestTimeout()
{
QFETCH(QStringList, resolveParams);
QFETCH(bool, expectFailure);
+ QFETCH(QString, errorDetails);
QDir::setCurrent(testDataDir + "/autotest-timeout");
QbsRunParameters resolveParameters("resolve", resolveParams);
QCOMPARE(runQbs(resolveParameters), 0);
@@ -7540,7 +7683,9 @@ void TestBlackbox::autotestTimeout()
buildParameters.expectFailure = expectFailure;
if (expectFailure) {
QVERIFY(runQbs(buildParameters) != 0);
- QVERIFY(m_qbsStderr.contains("cancelled") && m_qbsStderr.contains("timeout"));
+ QVERIFY(
+ m_qbsStderr.contains("cancelled") && m_qbsStderr.contains("timeout")
+ && m_qbsStderr.contains(errorDetails.toLocal8Bit()));
}
else
QVERIFY(runQbs(buildParameters) == 0);
@@ -7550,11 +7695,12 @@ void TestBlackbox::autotestTimeout_data()
{
QTest::addColumn<QStringList>("resolveParams");
QTest::addColumn<bool>("expectFailure");
- QTest::newRow("no timeout") << QStringList() << false;
- QTest::newRow("timeout on test") << QStringList({"products.testApp.autotest.timeout:2"})
- << true;
- QTest::newRow("timeout on runner") << QStringList({"products.autotest-runner.timeout:2"})
- << true;
+ QTest::addColumn<QString>("errorDetails");
+ QTest::newRow("no timeout") << QStringList() << false << QString();
+ QTest::newRow("timeout on test")
+ << QStringList({"products.testApp.autotest.timeout:2"}) << true << QString("testApp");
+ QTest::newRow("timeout on runner")
+ << QStringList({"products.autotest-runner.timeout:2"}) << true << QString("testApp");
}
void TestBlackbox::autotests_data()
@@ -8636,6 +8782,9 @@ void TestBlackbox::grpc_data()
<< "moduleProviders.qbspkgconfig.extraPaths:/usr/local/opt/openssl@1.1/lib/pkgconfig";
}
QTest::newRow("cpp-pkgconfig") << QString("grpc_cpp.qbs") << pkgConfigArgs << true;
+ QStringList conanArgs(
+ {"project.qbsModuleProviders:conan", "moduleProviders.conan.installDirectory:build"});
+ QTest::newRow("cpp-conan") << QString("grpc_cpp.qbs") << conanArgs << true;
}
void TestBlackbox::grpc()
@@ -8646,14 +8795,12 @@ void TestBlackbox::grpc()
QFETCH(bool, hasModules);
rmDirR(relativeBuildDir());
- QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile});
- if (QTest::currentDataTag() == QLatin1String("cpp")) {
- if (const QString extraLibs = qEnvironmentVariable("QBS_EXTRA_GRPC_LIBS");
- !extraLibs.isEmpty()) {
- resolveParams.arguments << (QLatin1String("modules.protobuf.cpp._extraGrpcLibs:")
- + extraLibs);
- }
+ if (QTest::currentDataTag() == QLatin1String("cpp-conan")) {
+ if (!prepareAndRunConan())
+ QSKIP("conan is not prepared, check messages above");
}
+
+ QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile});
resolveParams.arguments << arguments;
QCOMPARE(runQbs(resolveParams), 0);
const bool withGrpc = m_qbsStdout.contains("has grpc: true");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 5ba53ef52..3f817b481 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -60,6 +60,8 @@ private slots:
void bomSources();
void buildDataOfDisabledProduct();
void buildDirectories();
+ void buildDirPlaceholders_data();
+ void buildDirPlaceholders();
void buildEnvChange();
void buildGraphVersions();
void buildVariantDefaults_data();
@@ -133,6 +135,8 @@ private slots:
void externalLibs();
void fileDependencies();
void fileTagsFilterMerging();
+ void flatbuf();
+ void flatbuf_data();
void freedesktop();
void generatedArtifactAsInputToDynamicRule();
void generateLinkerMapFile();
@@ -165,6 +169,8 @@ private slots:
void installPackage();
void installRootFromProjectFile();
void installTree();
+ void invalidArtifactPath_data();
+ void invalidArtifactPath();
void invalidCommandProperty_data();
void invalidCommandProperty();
void invalidExtensionInstantiation();
@@ -359,6 +365,7 @@ private:
QMap<QString, QString> findNodejs(int *status);
QMap<QString, QString> findTypeScript(int *status);
QString findArchiver(const QString &fileName, int *status = nullptr);
+ bool prepareAndRunConan();
static bool lexYaccExist();
static qbs::Version bisonVersion();
};
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index 02b56f603..30e20a1c9 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -712,9 +712,11 @@ void TestBlackboxApple::byteArrayInfoPlist()
void TestBlackboxApple::codesign()
{
+ QFETCH(int, expectedCount);
QFETCH(bool, isBundle);
QFETCH(bool, enableSigning);
QFETCH(bool, multiArch);
+ QFETCH(bool, multiVariant);
const auto xcodeVersion = findXcodeVersion();
@@ -723,20 +725,21 @@ void TestBlackboxApple::codesign()
QDir::setCurrent(testDataDir + "/codesign");
QbsRunParameters params(QStringList{"qbs.installPrefix:''"});
- params.arguments
- << QStringLiteral("project.isBundle:%1").arg(isBundle ? "true" : "false");
- params.arguments
- << QStringLiteral("project.enableSigning:%1").arg(enableSigning ? "true" : "false");
- if (multiArch)
- params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion->toString();
+ // the test can't use xcode module to determine version itself
+ params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion->toString();
+ params.arguments << QStringLiteral("project.isBundle:%1").arg(isBundle ? "true" : "false");
+ params.arguments << QStringLiteral("project.enableSigning:%1")
+ .arg(enableSigning ? "true" : "false");
+ params.arguments << QStringLiteral("project.multiArch:%1").arg(multiArch ? "true" : "false");
+ params.arguments << QStringLiteral("project.multiVariant:%1")
+ .arg(multiVariant ? "true" : "false");
rmDirR(relativeBuildDir());
QCOMPARE(runQbs(params), 0);
const int codeSignCount =
QString::fromUtf8(m_qbsStdout).count(QStringLiteral("codesign"));
- // We have 3 products, we have to sign each exactly once, even in the multiplexed case
- QCOMPARE(codeSignCount, enableSigning ? 3 : 0);
+ QCOMPARE(codeSignCount, expectedCount);
const auto appName = isBundle ? QStringLiteral("A.app") : QStringLiteral("A");
const auto appPath = defaultInstallRoot + "/" + appName;
@@ -781,16 +784,25 @@ void TestBlackboxApple::codesign()
void TestBlackboxApple::codesign_data()
{
+ QTest::addColumn<int>("expectedCount");
QTest::addColumn<bool>("isBundle");
QTest::addColumn<bool>("enableSigning");
QTest::addColumn<bool>("multiArch");
-
- QTest::newRow("bundle, unsigned") << true << false << false;
- QTest::newRow("standalone, unsigned") << false << false << false;
- QTest::newRow("bundle, signed") << true << true << false;
- QTest::newRow("standalone, signed") << false << true << false;
- QTest::newRow("bundle, signed, multiarch") << true << true << true;
- QTest::newRow("standalone, signed, multiarch") << false << true << true;
+ QTest::addColumn<bool>("multiVariant");
+
+ QTest::newRow("standalone, unsigned") << 0 << false << false << false << false;
+ QTest::newRow("bundle, unsigned") << 0 << true << false << false << false;
+ QTest::newRow("standalone, signed") << 3 << false << true << false << false;
+ QTest::newRow("bundle, signed") << 3 << true << true << false << false;
+ // here we only sign the resulting lipo artifact
+ QTest::newRow("standalone, signed, multiarch") << 3 << false << true << true << false;
+ QTest::newRow("bundle, signed, multiarch") << 3 << true << true << true << false;
+ // here we sign all artifacts
+ QTest::newRow("standalone, signed, multivariant") << 15 << false << true << false << true;
+ QTest::newRow("bundle, signed, multivariant") << 15 << true << true << false << true;
+ QTest::newRow("standalone, signed, multiarch, multivariant")
+ << 15 << false << true << true << true;
+ QTest::newRow("bundle, signed, multiarch, multivariant") << 15 << true << true << true << true;
}
void TestBlackboxApple::deploymentTarget()
diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp
index 17652e779..317a6b663 100644
--- a/tests/auto/blackbox/tst_blackboxbase.cpp
+++ b/tests/auto/blackbox/tst_blackboxbase.cpp
@@ -274,3 +274,16 @@ qbs::Version TestBlackboxBase::qmakeVersion(const QString &qmakeFilePath)
qDebug() << "qmake '" << qmakeFilePath << "' version is not valid.";
return version;
}
+
+bool waitForProcessSuccess(QProcess &p, int msecs)
+{
+ if (!p.waitForStarted(msecs) || !p.waitForFinished(msecs)) {
+ qDebug() << p.errorString();
+ return false;
+ }
+ if (p.exitCode() != 0) {
+ qDebug() << p.readAllStandardError();
+ return false;
+ }
+ return true;
+}
diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h
index d020b7cd9..5733cacd7 100644
--- a/tests/auto/blackbox/tst_blackboxbase.h
+++ b/tests/auto/blackbox/tst_blackboxbase.h
@@ -90,6 +90,8 @@ public:
public slots:
virtual void initTestCase();
+ static QString findExecutable(const QStringList &fileNames);
+
protected:
virtual void validateTestProfile();
@@ -99,7 +101,6 @@ protected:
static QByteArray unifiedLineEndings(const QByteArray &ba);
static void sanitizeOutput(QByteArray *ba);
static void ccp(const QString &sourceDirPath, const QString &targetDirPath);
- static QString findExecutable(const QStringList &fileNames);
QMap<QString, QString> findJdkTools(int *status);
static qbs::Version qmakeVersion(const QString &qmakeFilePath);
@@ -113,4 +114,6 @@ protected:
int m_needsQt = false;
};
+bool waitForProcessSuccess(QProcess &p, int msecs = 30000);
+
#endif // TST_BLACKBOXBASE_H
diff --git a/tests/auto/blackbox/tst_blackboxexamples.cpp b/tests/auto/blackbox/tst_blackboxexamples.cpp
index b6a26b7f3..13ccb7796 100644
--- a/tests/auto/blackbox/tst_blackboxexamples.cpp
+++ b/tests/auto/blackbox/tst_blackboxexamples.cpp
@@ -82,6 +82,7 @@ void TestBlackboxExamples::examples_data()
auto examples = collectExamples(testDataDir);
examples.append(collectExamples(testDataDir + "/protobuf"));
+ examples.append(collectExamples(testDataDir + "/flatbuffers"));
std::sort(examples.begin(), examples.end());
for (const auto &example: examples) {
diff --git a/tests/auto/blackbox/tst_blackboxproviders.cpp b/tests/auto/blackbox/tst_blackboxproviders.cpp
index 3d64d32d5..cf6594229 100644
--- a/tests/auto/blackbox/tst_blackboxproviders.cpp
+++ b/tests/auto/blackbox/tst_blackboxproviders.cpp
@@ -87,6 +87,72 @@ void TestBlackboxProviders::brokenProvider()
QCOMPARE(m_qbsStderr.count("This provider is broken"), 2);
}
+void TestBlackboxProviders::conanProvider()
+{
+ QFETCH(bool, generateConanFiles);
+ QFETCH(bool, successExpected);
+
+ const auto executable = findExecutable({"conan"});
+ if (executable.isEmpty())
+ QSKIP("conan is not installed or not available in PATH.");
+
+ const auto generator = QDir::homePath() + "/.conan2/extensions/generators/qbsdeps.py";
+ if (!QFileInfo(generator).exists()) {
+ QSKIP(
+ "qbsdeps.py is not installed, call 'conan config install src/conan/ from qbs source'.");
+ }
+
+ const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test";
+ if (!QFileInfo(profilePath).exists())
+ QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'.");
+
+ // install testlibdep first
+ QProcess conan;
+ QDir::setCurrent(testDataDir + "/conan-provider/testlibdep");
+ conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
+ QVERIFY(waitForProcessSuccess(conan));
+
+ // install testlib second
+ QDir::setCurrent(testDataDir + "/conan-provider/testlib");
+ conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
+ QVERIFY(waitForProcessSuccess(conan));
+
+ // install header lib third
+ QDir::setCurrent(testDataDir + "/conan-provider/testlibheader");
+ conan.start(executable, {"create", ".", "--profile:all=qbs-test"});
+ QVERIFY(waitForProcessSuccess(conan));
+
+ // now build an app using those libs
+ QDir::setCurrent(testDataDir + "/conan-provider");
+
+ rmDirR(relativeBuildDir());
+ rmDirR("build");
+
+ if (generateConanFiles) {
+ QStringList arguments{
+ "install", ".", "-g=QbsDeps", "--profile:all=qbs-test", "--output-folder=build"};
+ QProcess conan;
+ conan.start(executable, arguments);
+ QVERIFY(waitForProcessSuccess(conan));
+ }
+
+ QbsRunParameters buildParams(
+ "build",
+ {"--force-probe-execution",
+ "moduleProviders.conan.installDirectory:" + QDir::currentPath() + "/build"});
+ buildParams.expectFailure = !successExpected;
+ QCOMPARE(runQbs(buildParams) == 0, successExpected);
+}
+
+void TestBlackboxProviders::conanProvider_data()
+{
+ QTest::addColumn<bool>("generateConanFiles");
+ QTest::addColumn<bool>("successExpected");
+
+ QTest::addRow("no conan files generated") << false << false;
+ QTest::addRow("conan files generated") << true << true;
+}
+
void TestBlackboxProviders::moduleProviders()
{
QDir::setCurrent(testDataDir + "/module-providers");
diff --git a/tests/auto/blackbox/tst_blackboxproviders.h b/tests/auto/blackbox/tst_blackboxproviders.h
index dd0039013..088cea6a3 100644
--- a/tests/auto/blackbox/tst_blackboxproviders.h
+++ b/tests/auto/blackbox/tst_blackboxproviders.h
@@ -44,6 +44,8 @@ private slots:
void allowedValues();
void allowedValues_data();
void brokenProvider();
+ void conanProvider();
+ void conanProvider_data();
void moduleProviders();
void moduleProvidersCache();
void nonEagerModuleProvider();
diff --git a/tests/auto/language/testdata/erroneous/module-with-id.qbs b/tests/auto/language/testdata/erroneous/module-with-id.qbs
new file mode 100644
index 000000000..5b980100f
--- /dev/null
+++ b/tests/auto/language/testdata/erroneous/module-with-id.qbs
@@ -0,0 +1,4 @@
+Product {
+ name: "p"
+ Depends { name: "module-with-id" }
+}
diff --git a/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithId.qbs b/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithId.qbs
new file mode 100644
index 000000000..d20b96784
--- /dev/null
+++ b/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithId.qbs
@@ -0,0 +1 @@
+ModuleWithIdParent { id: foo }
diff --git a/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithIdParent.qbs b/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithIdParent.qbs
new file mode 100644
index 000000000..5e45122de
--- /dev/null
+++ b/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithIdParent.qbs
@@ -0,0 +1 @@
+Module {}
diff --git a/tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs b/tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs
index 746c7e37b..2764af9c2 100644
--- a/tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs
+++ b/tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs
@@ -1,11 +1,10 @@
Module {
- id: qtcore
property int versionMajor: 5
property int versionMinor: 0
property int versionPatch: 0
property string version: versionMajor.toString() + "." + versionMinor.toString() + "." + versionPatch.toString()
property string coreProperty: "coreProperty"
- property string coreVersion: qtcore.version
+ property string coreVersion: version
property string zort: "zort in dummyqt.core"
Depends { name: "dummy" }
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index 456e8b9d0..6a3344842 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -1017,6 +1017,7 @@ void TestLanguage::erroneousFiles_data()
QTest::newRow("frozen-object-list") << "object is not extensible";
QTest::newRow("module-property-binding-in-project")
<< "Module properties cannot be set in Project items";
+ QTest::newRow("module-with-id") << "Module items cannot have an id property";
}
void TestLanguage::erroneousFiles()