aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-12-13 23:45:59 -0800
committerChristian Kandeler <christian.kandeler@qt.io>2016-12-14 10:49:17 +0000
commit433394d0a53319370a009fd5a6461ae46ec92a14 (patch)
tree551678a789e0ca40e93b1f4a001a526795395a2c
parent872d03f2a1177f4afb09ebd32e8d4acef685b310 (diff)
Fix deploymentTarget autotest with older versions of Xcode
As a consequence, Xcode SDKs which Qbs recognizes but which do not exist on disk will now produce a much more readable error message. Change-Id: Ib847fca85ed02cadb33d3a3e944b41fa52a1c6f0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/xcode/xcode.qbs12
-rw-r--r--tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs6
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp40
3 files changed, 40 insertions, 18 deletions
diff --git a/share/qbs/modules/xcode/xcode.qbs b/share/qbs/modules/xcode/xcode.qbs
index 689a5752b..652ee2053 100644
--- a/share/qbs/modules/xcode/xcode.qbs
+++ b/share/qbs/modules/xcode/xcode.qbs
@@ -47,14 +47,14 @@ Module {
}
readonly property string latestSdkName: {
- if (_availableSdks) {
- return _availableSdks[_availableSdks.length - 1]["CanonicalName"];
+ if (_latestSdk) {
+ return _latestSdk["CanonicalName"];
}
}
readonly property string latestSdkVersion: {
- if (_availableSdks) {
- return _availableSdks[_availableSdks.length - 1]["Version"];
+ if (_latestSdk) {
+ return _latestSdk["Version"];
}
}
@@ -132,6 +132,8 @@ Module {
readonly property var _availableSdks: xcodeProbe.availableSdks
+ readonly property var _latestSdk: _availableSdks[_availableSdks.length - 1]
+
readonly property var _sdkSettings: {
if (_availableSdks) {
for (var i in _availableSdks) {
@@ -143,7 +145,7 @@ Module {
// Latest SDK available for the platform
if (DarwinTools.applePlatformName(qbs.targetOS, platformType) === sdk)
- return _availableSdks[_availableSdks.length - 1];
+ return _latestSdk;
}
}
diff --git a/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs b/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs
index f805de67c..27280d896 100644
--- a/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs
+++ b/tests/auto/blackbox/testdata/deploymentTarget/deployment.qbs
@@ -13,4 +13,10 @@ CppApplication {
cpp.driverFlags: ["-v"]
cpp.linkerFlags: ["-v"]
+
+ targetName: {
+ if (cpp.compilerVersionMajor < 6 && qbs.architecture === "x86_64h")
+ throw("x86_64h will be mis-detected as x86_64 with Apple Clang < 6.0");
+ return name;
+ }
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 05ee134ff..2bb056358 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -718,6 +718,7 @@ void TestBlackbox::deploymentTarget()
if (!HostOsInfo::isMacosHost())
QSKIP("only applies on macOS");
+ QFETCH(QString, sdk);
QFETCH(QString, os);
QFETCH(QString, arch);
QFETCH(QString, cflags);
@@ -733,7 +734,19 @@ void TestBlackbox::deploymentTarget()
<< "qbs.architecture:" + arch;
rmDirR(relativeBuildDir());
- QCOMPARE(runQbs(params), 0);
+ int status = runQbs(params);
+
+ const QStringList skippableMessages = QStringList()
+ << "There is no matching SDK available for " + sdk + "."
+ << "x86_64h will be mis-detected as x86_64 with Apple Clang < 6.0";
+ if (status != 0) {
+ for (const auto &message : skippableMessages) {
+ if (m_qbsStderr.contains(message.toUtf8()))
+ QSKIP(message.toUtf8());
+ }
+ }
+
+ QCOMPARE(status, 0);
QVERIFY2(m_qbsStdout.contains(cflags.toLatin1()), m_qbsStdout.constData());
QVERIFY2(m_qbsStdout.contains(lflags.toLatin1()), m_qbsStdout.constData());
}
@@ -748,48 +761,49 @@ void TestBlackbox::deploymentTarget_data()
static const QString watchos = QStringLiteral("watchos,darwin,bsd,unix");
static const QString watchos_sim = QStringLiteral("watchos-simulator,") + watchos;
+ QTest::addColumn<QString>("sdk");
QTest::addColumn<QString>("os");
QTest::addColumn<QString>("arch");
QTest::addColumn<QString>("cflags");
QTest::addColumn<QString>("lflags");
- QTest::newRow("macos x86") << macos << "x86"
+ QTest::newRow("macos x86") << "macosx" << macos << "x86"
<< "-triple i386-apple-macosx10.4"
<< "-macosx_version_min 10.4";
- QTest::newRow("macos x86_64") << macos << "x86_64"
+ QTest::newRow("macos x86_64") << "macosx" << macos << "x86_64"
<< "-triple x86_64-apple-macosx10.4"
<< "-macosx_version_min 10.4";
- QTest::newRow("macos x86_64h") << macos << "x86_64h"
+ QTest::newRow("macos x86_64h") << "macosx" << macos << "x86_64h"
<< "-triple x86_64h-apple-macosx10.12"
<< "-macosx_version_min 10.12";
- QTest::newRow("ios armv7a") << ios << "armv7a"
+ QTest::newRow("ios armv7a") << "iphoneos" << ios << "armv7a"
<< "-triple thumbv7-apple-ios6.0"
<< "-iphoneos_version_min 6.0";
- QTest::newRow("ios armv7s") << ios << "armv7s"
+ QTest::newRow("ios armv7s") << "iphoneos" <<ios << "armv7s"
<< "-triple thumbv7s-apple-ios7.0"
<< "-iphoneos_version_min 7.0";
- QTest::newRow("ios arm64") << ios << "arm64"
+ QTest::newRow("ios arm64") << "iphoneos" <<ios << "arm64"
<< "-triple arm64-apple-ios7.0"
<< "-iphoneos_version_min 7.0";
- QTest::newRow("ios-simulator x86") << ios_sim << "x86"
+ QTest::newRow("ios-simulator x86") << "iphonesimulator" << ios_sim << "x86"
<< "-triple i386-apple-ios6.0"
<< "-ios_simulator_version_min 6.0";
- QTest::newRow("ios-simulator x86_64") << ios_sim << "x86_64"
+ QTest::newRow("ios-simulator x86_64") << "iphonesimulator" << ios_sim << "x86_64"
<< "-triple x86_64-apple-ios7.0"
<< "-ios_simulator_version_min 7.0";
- QTest::newRow("tvos arm64") << tvos << "arm64"
+ QTest::newRow("tvos arm64") << "appletvos" << tvos << "arm64"
<< "-triple arm64-apple-tvos9.0"
<< "-tvos_version_min 9.0";
- QTest::newRow("tvos-simulator x86_64") << tvos_sim << "x86_64"
+ QTest::newRow("tvos-simulator x86_64") << "appletvsimulator" << tvos_sim << "x86_64"
<< "-triple x86_64-apple-tvos9.0"
<< "-tvos_simulator_version_min 9.0";
- QTest::newRow("watchos armv7k") << watchos << "armv7k"
+ QTest::newRow("watchos armv7k") << "watchos" << watchos << "armv7k"
<< "-triple thumbv7k-apple-watchos2.0"
<< "-watchos_version_min 2.0";
- QTest::newRow("watchos-simulator x86") << watchos_sim << "x86"
+ QTest::newRow("watchos-simulator x86") << "watchsimulator" << watchos_sim << "x86"
<< "-triple i386-apple-watchos2.0"
<< "-watchos_simulator_version_min 2.0";
}