aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-08-25 11:01:42 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-08-25 11:01:42 +0200
commit1013817edb176a5c65748b7d1e84279ea39d164f (patch)
tree7e567f998d7145b1cbf74eca38ddb4dec7662ba3 /tests/auto
parentd664ad15981d677ea1fc7b4d11ed9be0e4e3deb6 (diff)
parentb4c7d6078c2eed3d655e8eb074bf1dca6a93f0e0 (diff)
Merge 2.1 into master
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/blackbox/find/find-xcode.qbs4
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp36
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.h6
3 files changed, 37 insertions, 9 deletions
diff --git a/tests/auto/blackbox/find/find-xcode.qbs b/tests/auto/blackbox/find/find-xcode.qbs
index bb6ee9718..15c2aa17e 100644
--- a/tests/auto/blackbox/find/find-xcode.qbs
+++ b/tests/auto/blackbox/find/find-xcode.qbs
@@ -14,7 +14,9 @@ Product {
cmd.description = output.filePath;
cmd.sourceCode = function() {
var tools = {};
- if (product.moduleProperty("xcode", "present")) {
+ var present = product.moduleProperty("xcode", "present");
+ tools["present"] = !!present;
+ if (present) {
var keys = [
"developerPath",
"version"
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index 01446c815..fdb656c72 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -191,10 +191,12 @@ void TestBlackboxApple::initTestCase()
void TestBlackboxApple::appleMultiConfig()
{
const auto xcodeVersion = findXcodeVersion();
+ if (!xcodeVersion)
+ QSKIP("requires Xcode profile");
QDir::setCurrent(testDataDir + "/apple-multiconfig");
QCOMPARE(runQbs(QbsRunParameters(QStringList{
"qbs.installPrefix:''",
- QStringLiteral("project.xcodeVersion:") + xcodeVersion.toString()})), 0);
+ QStringLiteral("project.xcodeVersion:") + xcodeVersion->toString()})), 0);
if (m_qbsStdout.contains("isShallow: false")) {
QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/MacOS/singleapp").isExecutable());
@@ -304,6 +306,10 @@ void TestBlackboxApple::appleMultiConfig()
void TestBlackboxApple::aggregateDependencyLinking()
{
const auto xcodeVersion = findXcodeVersion();
+
+ if (!xcodeVersion)
+ QSKIP("requires Xcode profile");
+
// XCode 11 produces warning about deprecation of 32-bit apps, but still works
const bool hasX86Mac = xcodeVersion < qbs::Version(12);
const bool hasArmMac = xcodeVersion >= qbs::Version(12, 2);
@@ -363,6 +369,9 @@ void TestBlackboxApple::assetCatalog()
rmDirR(relativeBuildDir());
+ if (!findXcode())
+ QSKIP("requires Xcode profile");
+
QbsRunParameters params;
const QString flattens = "modules.ib.flatten:" + QString(flatten ? "true" : "false");
const QString macosTarget = "modules.cpp.minimumMacosVersion:'10.15'";
@@ -709,6 +718,9 @@ void TestBlackboxApple::codesign()
const auto xcodeVersion = findXcodeVersion();
+ if (!xcodeVersion)
+ QSKIP("requires Xcode profile");
+
QDir::setCurrent(testDataDir + "/codesign");
QbsRunParameters params(QStringList{"qbs.installPrefix:''"});
params.arguments
@@ -716,7 +728,7 @@ void TestBlackboxApple::codesign()
params.arguments
<< QStringLiteral("project.enableSigning:%1").arg(enableSigning ? "true" : "false");
if (multiArch)
- params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion.toString();
+ params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion->toString();
rmDirR(relativeBuildDir());
QCOMPARE(runQbs(params), 0);
@@ -791,6 +803,9 @@ void TestBlackboxApple::deploymentTarget()
QDir::setCurrent(testDataDir + "/deploymentTarget");
+ if (!findXcode())
+ QSKIP("requires Xcode profile");
+
QbsRunParameters params;
params.arguments = QStringList()
<< "--command-echo-mode"
@@ -1097,6 +1112,9 @@ void TestBlackboxApple::overrideInfoPlist()
void TestBlackboxApple::xcode()
{
+ if (!findXcode())
+ QSKIP("requires Xcode profile");
+
QProcess xcodeSelect;
xcodeSelect.start("xcode-select", QStringList() << "--print-path");
QVERIFY2(xcodeSelect.waitForStarted(), qPrintable(xcodeSelect.errorString()));
@@ -1149,7 +1167,7 @@ void TestBlackboxApple::xcode()
QTEST_MAIN(TestBlackboxApple)
-QVariantMap TestBlackboxApple::findXcode(int *status)
+std::optional<QVariantMap> TestBlackboxApple::findXcode(int *status)
{
QTemporaryDir temp;
QbsRunParameters params = QStringList({"-f", testDataDir + "/find/find-xcode.qbs"});
@@ -1161,10 +1179,16 @@ QVariantMap TestBlackboxApple::findXcode(int *status)
+ "/xcode.json");
if (!file.open(QIODevice::ReadOnly))
return {};
- return QJsonDocument::fromJson(file.readAll()).toVariant().toMap();
+ auto result = QJsonDocument::fromJson(file.readAll()).toVariant().toMap();
+ if (!result["present"].toBool())
+ return {};
+ return result;
}
-qbs::Version TestBlackboxApple::findXcodeVersion()
+std::optional<qbs::Version> TestBlackboxApple::findXcodeVersion()
{
- return qbs::Version::fromString(findXcode().value("version").toString());
+ const auto xcode = findXcode();
+ if (!xcode)
+ return {};
+ return qbs::Version::fromString(xcode->value("version").toString());
}
diff --git a/tests/auto/blackbox/tst_blackboxapple.h b/tests/auto/blackbox/tst_blackboxapple.h
index 9c329e961..a51414917 100644
--- a/tests/auto/blackbox/tst_blackboxapple.h
+++ b/tests/auto/blackbox/tst_blackboxapple.h
@@ -31,6 +31,8 @@
#include "tst_blackboxbase.h"
+#include <optional>
+
namespace qbs {
class Version;
} // namespace qbs
@@ -72,8 +74,8 @@ private slots:
void xcode();
private:
- QVariantMap findXcode(int *status = nullptr);
- qbs::Version findXcodeVersion();
+ std::optional<QVariantMap> findXcode(int *status = nullptr);
+ std::optional<qbs::Version> findXcodeVersion();
};
#endif // TST_BLACKBOXAPPLE_H