diff options
64 files changed, 784 insertions, 165 deletions
diff --git a/.travis.yml b/.travis.yml index 628700ecf..486ee6a76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -118,6 +118,29 @@ jobs: lldb --core $f --batch --one-line "bt" done; + - <<: *build-on-macos + name: With Qbs on macOS (xcode 11.3) using iOS profile + if: branch = master + env: + # Address sanitizer slows autotests down too much. + # We would hit the maximum build time on Travis. + BUILD_OPTIONS=modules.qbsbuildconfig.enableAddressSanitizer:false + QT_INSTALL_DIR=/Users/travis/Qt + PATH="${QT_INSTALL_DIR}/Qt Creator.app/Contents/MacOS:${PATH}" + QMAKE_PATH=${QT_INSTALL_DIR}/${QT_VERSION}/clang_64/bin/qmake + QBS_AUTOTEST_QMAKE_PATH=${QT_INSTALL_DIR}/${QT_VERSION}/ios/bin/qmake + QBS_BUILD_PROFILE=qt + QBS_AUTOTEST_BASE_PROFILE=xcode-iphoneos-arm64 + WITH_DOCS=0 + before_install: + - ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QT_VERSION} qtbase qtdeclarative qttools qtscript + - ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QT_VERSION} --target ios --toolchain ios qtbase qtdeclarative qttools qtscript + - ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QTCREATOR_VERSION} qtcreator + script: + - qbs setup-toolchains --detect + - qbs setup-qt ${QMAKE_PATH} qt + - qbs config profiles.qt.baseProfile xcode-macosx-x86_64 + - scripts/build-qbs-with-qbs.sh - <<: *build-on-macos name: With Qbs on macOS (xcode 10.3) diff --git a/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs b/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs index 571feced8..3237e90dc 100644 --- a/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs +++ b/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs @@ -6,11 +6,6 @@ Project { Depends { name: 'cpp' } - Properties { - condition: qbs.toolchain.contains("gcc") - cpp.cxxFlags: "-march=native" - } - Group { cpp.defines: ['WORLD="BANANA"'] files : [ "main.cpp" ] diff --git a/tests/auto/api/testdata/explicitly-depends-on/explicitly-depends-on.qbs b/tests/auto/api/testdata/explicitly-depends-on/explicitly-depends-on.qbs index 05886a99e..1823384f5 100644 --- a/tests/auto/api/testdata/explicitly-depends-on/explicitly-depends-on.qbs +++ b/tests/auto/api/testdata/explicitly-depends-on/explicitly-depends-on.qbs @@ -11,6 +11,12 @@ Project { } } Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "p" type: ["mytype"] diff --git a/tests/auto/api/testdata/process-result/process-result.qbs b/tests/auto/api/testdata/process-result/process-result.qbs index c77a382f5..5b71ecaaa 100644 --- a/tests/auto/api/testdata/process-result/process-result.qbs +++ b/tests/auto/api/testdata/process-result/process-result.qbs @@ -5,6 +5,12 @@ Project { files: ["main.cpp"] } Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "app-caller" type: "mytype" Depends { name: "app" } diff --git a/tests/auto/api/testdata/timeout-process/timeout.qbs b/tests/auto/api/testdata/timeout-process/timeout.qbs index bb8deac9b..30f390946 100644 --- a/tests/auto/api/testdata/timeout-process/timeout.qbs +++ b/tests/auto/api/testdata/timeout-process/timeout.qbs @@ -13,6 +13,12 @@ Project { } Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } type: "product-under-test" name: "caller" Depends { name: "infinite-loop" } diff --git a/tests/auto/api/testdata/tool-in-module/use-within-project/use-within-project.qbs b/tests/auto/api/testdata/tool-in-module/use-within-project/use-within-project.qbs index 575f4020e..d0f7c35ed 100644 --- a/tests/auto/api/testdata/tool-in-module/use-within-project/use-within-project.qbs +++ b/tests/auto/api/testdata/tool-in-module/use-within-project/use-within-project.qbs @@ -4,6 +4,13 @@ Project { consoleApplication: true files: "main.cpp" + property bool skip: { + var result = qbs.targetPlatform !== qbs.hostPlatform; + if (result) + console.info("Skip this test"); + return result; + } + install: true installDir: "" qbs.installPrefix: "" diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 36f30306f..6211b99bf 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -1140,6 +1140,8 @@ void TestApi::explicitlyDependsOn() BuildDescriptionReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("explicitly-depends-on", &receiver); VERIFY_NO_ERROR(errorInfo); + if (m_logSink->output.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QVERIFY2(receiver.descriptions.contains("compiling compiler.cpp"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling a.in"), qPrintable(receiver.descriptions)); @@ -2215,6 +2217,8 @@ void TestApi::processResult() ProcessResultReceiver resultReceiver; const qbs::ErrorInfo errorInfo = doBuildProject("process-result", nullptr, &resultReceiver, nullptr, qbs::BuildOptions(), overridden); + if (m_logSink->output.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(expectedExitCode != 0, errorInfo.hasError()); QVERIFY(resultReceiver.results.size() > 1); const qbs::ProcessResult &result = resultReceiver.results.back(); @@ -2797,6 +2801,8 @@ void TestApi::timeout() std::unique_ptr<qbs::SetupProjectJob> setupJob{ qbs::Project().setupProject(setupParams, m_logSink, nullptr)}; waitForFinished(setupJob.get()); + if (m_logSink->output.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); auto project = setupJob->project(); const auto products = project.projectData().products(); @@ -2836,29 +2842,39 @@ void TestApi::toolInModule() { QVariantMap overrides({std::make_pair("qbs.installRoot", m_workingDataDir + "/tool-in-module/use-outside-project")}); - const qbs::ErrorInfo error - = doBuildProject("tool-in-module/use-within-project/use-within-project.qbs", nullptr, - nullptr, nullptr, qbs::BuildOptions(), overrides); - QVERIFY2(!error.hasError(), qPrintable(error.toString())); + + qbs::SetupProjectParameters params + = defaultSetupParameters("tool-in-module/use-within-project/use-within-project.qbs"); + params.setOverriddenValues(overrides); + std::unique_ptr<qbs::SetupProjectJob> setupJob( + qbs::Project().setupProject(params, m_logSink, 0)); + QVERIFY(waitForFinished(setupJob.get())); + QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); + if (m_logSink->output.contains("Skip this test")) + QSKIP("Skip this test"); + + std::unique_ptr<qbs::BuildJob> buildJob(setupJob->project() + .buildAllProducts(qbs::BuildOptions())); + + QVERIFY(waitForFinished(buildJob.get())); + QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); + const QString toolOutput = relativeProductBuildDir("user-in-project") + "/tool-output.txt"; QVERIFY2(QFile::exists(toolOutput), qPrintable(toolOutput)); - const qbs::SetupProjectParameters params - = defaultSetupParameters("tool-in-module/use-outside-project/use-outside-project.qbs"); - const std::unique_ptr<qbs::SetupProjectJob> setupJob(qbs::Project().setupProject(params, - m_logSink, 0)); + params = defaultSetupParameters("tool-in-module/use-outside-project/use-outside-project.qbs"); + setupJob.reset(qbs::Project().setupProject(params, m_logSink, 0)); QVERIFY(waitForFinished(setupJob.get())); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); - const qbs::Project project = setupJob->project(); - const qbs::ProjectData projectData = project.projectData(); - const QList<qbs::ProductData> products = projectData.products(); + const auto project = setupJob->project(); + const auto projectData = project.projectData(); + const auto products = projectData.products(); QCOMPARE(products.size(), 1); const qbs::ProductData product = products.front(); const auto groups = product.groups(); for (const qbs::GroupData &group : groups) QVERIFY(group.name() != "thetool binary"); - const std::unique_ptr<qbs::BuildJob> buildJob(setupJob->project() - .buildAllProducts(qbs::BuildOptions())); + buildJob.reset(setupJob->project().buildAllProducts(qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); const QString toolOutput2 = relativeProductBuildDir("user-outside-project") diff --git a/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs b/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs index 438624f70..caf7e5768 100644 --- a/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs +++ b/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs @@ -1,17 +1,25 @@ import qbs.Utilities +import "helpers.js" as Helpers + Project { minimumQbsVersion: "1.8" - property bool enableX86 + condition: xcodeVersion + property string xcodeVersion CppApplication { Depends { name: "singlelib" } Depends { name: "bundle" } + property bool isShallow: { + console.info("isShallow: " + bundle.isShallow); + return bundle.isShallow; + } name: "singleapp" targetName: "singleapp" files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" + cpp.minimumIosVersion: "8.0" // Turn off multiplexing aggregate: false @@ -29,10 +37,11 @@ Project { files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" + cpp.minimumIosVersion: "8.0" // Force aggregation when not needed aggregate: true - qbs.architectures: ["x86_64"] + qbs.architectures: [Helpers.getNewArch(qbs)] qbs.buildVariants: ["release"] install: true @@ -64,6 +73,7 @@ Project { files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" + cpp.minimumIosVersion: "8.0" install: true installDir: "" @@ -77,10 +87,12 @@ Project { files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" - qbs.architectures: project.enableX86 ? ["x86", "x86_64"] : ["x86_64"] - qbs.architecture: "x86_64" - multiplexByQbsProperties: project.enableX86 ? ["architectures", "buildVariants"] - : ["buildVariants"] + cpp.minimumIosVersion: "8.0" + qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) + qbs.architecture: Helpers.getNewArch(qbs) + multiplexByQbsProperties: Helpers.enableOldArch(qbs, project.xcodeVersion) + ? ["architectures", "buildVariants"] + : ["buildVariants"] qbs.buildVariants: "debug" install: true @@ -95,7 +107,8 @@ Project { files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" - qbs.architectures: project.enableX86 ? ["x86", "x86_64"] : ["x86_64"] + cpp.minimumIosVersion: "8.0" + qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profile"] install: true @@ -108,9 +121,10 @@ Project { name: "multilib" targetName: "multilib" files: ["lib.c"] + cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] - qbs.architectures: project.enableX86 ? ["x86", "x86_64"] : ["x86_64"] + qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["release", "debug", "profile"] install: true @@ -123,9 +137,10 @@ Project { name: "multilib-no-release" targetName: "multilib-no-release" files: ["lib.c"] + cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] - qbs.architectures: project.enableX86 ? ["x86", "x86_64"] : ["x86_64"] + qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profile"] install: true @@ -138,9 +153,10 @@ Project { Depends { name: "multilibB" } name: "multilibA" files: ["lib.c"] + cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: "@rpath" cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] - qbs.architectures: project.enableX86 ? ["x86", "x86_64"] : ["x86_64"] + qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profile"] install: true installDir: "" @@ -150,9 +166,10 @@ Project { Depends { name: "bundle" } name: "multilibB" files: ["lib.c"] + cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: "@rpath" cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] - qbs.architectures: project.enableX86 ? ["x86", "x86_64"] : ["x86_64"] + qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profile"] install: true installDir: "" diff --git a/tests/auto/blackbox/testdata-apple/apple-multiconfig/helpers.js b/tests/auto/blackbox/testdata-apple/apple-multiconfig/helpers.js new file mode 100644 index 000000000..aaab9baae --- /dev/null +++ b/tests/auto/blackbox/testdata-apple/apple-multiconfig/helpers.js @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +var Utilities = require("qbs.Utilities"); + +// Typically, multiple architectures are used for migration from "old" arch to a "new" one +// For example: x86 -> x86_64 on macOS, armv7 -> arm64 on iOS + +function enableOldArch(qbs, xcodeVersion) { + return qbs.targetOS.contains("macos") + && xcodeVersion + && Utilities.versionCompare(xcodeVersion, "10") < 0 + || qbs.targetOS.contains("ios") +} + +function getNewArch(qbs) { + if (qbs.targetOS.contains("macos")) + return "x86_64" + else if (qbs.targetOS.contains("ios")) + return "arm64" + else if (qbs.targetOS.contains("tvos")) + return "arm64" + else if (qbs.targetOS.contains("watchos")) + return "armv7k" + throw "unsupported targetOS: " + qbs.targetOS; +} + +function getOldArch(qbs) { + if (qbs.targetOS.contains("macos")) + return "x86" + else if (qbs.targetOS.contains("ios")) + return "armv7a" + throw "unsupported targetOS: " + qbs.targetOS; +} + +function getArchitectures(qbs, xcodeVersion) { + return enableOldArch(qbs, xcodeVersion) + ? [getOldArch(qbs), getNewArch(qbs)] + : [getNewArch(qbs)]; +} diff --git a/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs b/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs index 8cf031e33..db5f15b18 100644 --- a/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs @@ -3,6 +3,15 @@ Project { property stringList buildableProducts: ["A", "B", "C", "D", "E", "F", "G"] + Product { + Depends { name: "bundle" } + condition: { + console.info("bundle.isShallow: " + bundle.isShallow); + console.info("qbs.targetOS: " + qbs.targetOS); + return false; + } + } + Application { Depends { name: "cpp" } Depends { name: "B" } diff --git a/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs b/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs index a812ae513..3c6d39332 100644 --- a/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs +++ b/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs @@ -2,6 +2,12 @@ Project { property bool includeHeaders: true Library { Depends { name: "cpp" } + Depends { name: "bundle" } + + property bool isShallow: { + console.info("isShallow: " + bundle.isShallow); + return bundle.isShallow; + } name: "Widget" bundle.isBundle: true diff --git a/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs index 622fa46cb..94361f34d 100644 --- a/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs @@ -1,6 +1,12 @@ import qbs.Utilities Project { + condition: { + var result = qbs.targetOS.contains("macos"); + if (!result) + console.info("Skip this test"); + return result; + } property bool includeIconset CppApplication { diff --git a/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs index 04e6ce0ce..dd39d1639 100644 --- a/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs +++ b/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs @@ -1,4 +1,9 @@ CppApplication { Depends { name: "ib" } + Depends { name: "bundle" } + property bool isShallow: { + console.info("isShallow: " + bundle.isShallow); + return bundle.isShallow; + } files: ["main.c", "white.iconset"] } diff --git a/tests/auto/blackbox/testdata-qt/auto-qrc/auto-qrc.qbs b/tests/auto/blackbox/testdata-qt/auto-qrc/auto-qrc.qbs index e08f89032..92b290719 100644 --- a/tests/auto/blackbox/testdata-qt/auto-qrc/auto-qrc.qbs +++ b/tests/auto/blackbox/testdata-qt/auto-qrc/auto-qrc.qbs @@ -1,5 +1,12 @@ Project { QtApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } + name: "app" files: ["main.cpp"] diff --git a/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs b/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs index a59aaa28e..736f40347 100644 --- a/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs +++ b/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs @@ -1,4 +1,10 @@ QtApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } files: "main.cpp" Group { name: "QObject service provider" diff --git a/tests/auto/blackbox/testdata-qt/pkgconfig/pkgconfig.qbs b/tests/auto/blackbox/testdata-qt/pkgconfig/pkgconfig.qbs index 04b0097ef..87ec6dc7d 100644 --- a/tests/auto/blackbox/testdata-qt/pkgconfig/pkgconfig.qbs +++ b/tests/auto/blackbox/testdata-qt/pkgconfig/pkgconfig.qbs @@ -3,6 +3,12 @@ import qbs.Probes Project { property string name: 'pkgconfig' CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: project.name Probes.PkgConfigProbe { id: pkgConfig diff --git a/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs b/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs index f018b34e0..7fb477575 100644 --- a/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs +++ b/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs @@ -1,5 +1,12 @@ Project { QtApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } + name: "app" consoleApplication: true diff --git a/tests/auto/blackbox/testdata-qt/qrc/i.qbs b/tests/auto/blackbox/testdata-qt/qrc/i.qbs index c005490c4..604652a8e 100644 --- a/tests/auto/blackbox/testdata-qt/qrc/i.qbs +++ b/tests/auto/blackbox/testdata-qt/qrc/i.qbs @@ -1,5 +1,11 @@ Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } consoleApplication: true type: "application" name: "i" diff --git a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs index 208305c1f..90b968ec9 100644 --- a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs +++ b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs @@ -24,6 +24,12 @@ Project { } Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "runner" type: ["runner"] Depends { name: "app" } diff --git a/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/lib.cpp b/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/lib.cpp new file mode 100644 index 000000000..dd79cbe6c --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/lib.cpp @@ -0,0 +1 @@ +void function() {} diff --git a/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/static-qt-plugin-linking.qbs b/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/static-qt-plugin-linking.qbs index 745fe5527..97c04f419 100644 --- a/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/static-qt-plugin-linking.qbs +++ b/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/static-qt-plugin-linking.qbs @@ -15,6 +15,11 @@ Product { files: "main.cpp" } + Group { + condition: type.contains("staticlibrary") + files: "lib.cpp" + } + Depends { name: "Qt.core" } Depends { name: "Qt.gui" } Depends { name: "Qt.qminimal"; condition: Qt.core.staticBuild; } diff --git a/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs b/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs index 49ee35d3a..8ae4f3ceb 100644 --- a/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs +++ b/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs @@ -1,5 +1,11 @@ Project { CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "testApp" type: ["application", "autotest"] Depends { name: "autotest" } diff --git a/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs b/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs index 7ae6cef73..b64473526 100644 --- a/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs +++ b/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs @@ -2,6 +2,12 @@ import qbs.FileInfo Project { CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "helper-app" type: ["application", "test-helper"] consoleApplication: true diff --git a/tests/auto/blackbox/testdata/autotests/autotests.qbs b/tests/auto/blackbox/testdata/autotests/autotests.qbs index 10334156e..4927a8869 100644 --- a/tests/auto/blackbox/testdata/autotests/autotests.qbs +++ b/tests/auto/blackbox/testdata/autotests/autotests.qbs @@ -1,6 +1,12 @@ Project { references: ["test1", "test2", "test3"] AutotestRunner { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } Depends { name: "cpp" // Make sure build environment is set up properly. condition: qbs.hostOS.contains("windows") && qbs.toolchain.contains("gcc") diff --git a/tests/auto/blackbox/testdata/badInterpreter/badInterpreter.qbs b/tests/auto/blackbox/testdata/badInterpreter/badInterpreter.qbs index bef82a003..2317e6edf 100644 --- a/tests/auto/blackbox/testdata/badInterpreter/badInterpreter.qbs +++ b/tests/auto/blackbox/testdata/badInterpreter/badInterpreter.qbs @@ -1,4 +1,11 @@ Project { + property bool enabled: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } + qbsSearchPaths: base.concat(["qbs"]) Product { diff --git a/tests/auto/blackbox/testdata/configure/configure.qbs b/tests/auto/blackbox/testdata/configure/configure.qbs index af5638dde..62dfa4ce4 100644 --- a/tests/auto/blackbox/testdata/configure/configure.qbs +++ b/tests/auto/blackbox/testdata/configure/configure.qbs @@ -1,6 +1,12 @@ import qbs.FileInfo Project { + property bool enabled: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } property string name: 'configure' qbsSearchPaths: '.' Product { diff --git a/tests/auto/blackbox/testdata/dynamic-library-in-module/theapp.qbs b/tests/auto/blackbox/testdata/dynamic-library-in-module/theapp.qbs index b9149d091..26b3f2cab 100644 --- a/tests/auto/blackbox/testdata/dynamic-library-in-module/theapp.qbs +++ b/tests/auto/blackbox/testdata/dynamic-library-in-module/theapp.qbs @@ -1,5 +1,11 @@ Project { CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "theapp" cpp.minimumMacosVersion: "10.7" // For -rpath Depends { name: "theotherlib" } diff --git a/tests/auto/blackbox/testdata/env-merging/env-merging.qbs b/tests/auto/blackbox/testdata/env-merging/env-merging.qbs index 6edeca444..b927003eb 100644 --- a/tests/auto/blackbox/testdata/env-merging/env-merging.qbs +++ b/tests/auto/blackbox/testdata/env-merging/env-merging.qbs @@ -5,6 +5,12 @@ Project { } Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "p" type: "custom" Depends { name: "tool" } diff --git a/tests/auto/blackbox/testdata/exports-qbs/consumer.qbs b/tests/auto/blackbox/testdata/exports-qbs/consumer.qbs index 02affdfe8..79ac50e0b 100644 --- a/tests/auto/blackbox/testdata/exports-qbs/consumer.qbs +++ b/tests/auto/blackbox/testdata/exports-qbs/consumer.qbs @@ -1,4 +1,10 @@ CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "consumer" qbsSearchPaths: "default/install-root/usr/qbs" property string outTag: "cpp" diff --git a/tests/auto/blackbox/testdata/groups-in-modules/groups-in-modules.qbs b/tests/auto/blackbox/testdata/groups-in-modules/groups-in-modules.qbs index 7347b1211..0508872db 100644 --- a/tests/auto/blackbox/testdata/groups-in-modules/groups-in-modules.qbs +++ b/tests/auto/blackbox/testdata/groups-in-modules/groups-in-modules.qbs @@ -1,5 +1,11 @@ Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } Depends { name: "dep" } Depends { name: "helper" } Depends { diff --git a/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs b/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs index b7a594c13..353a40f8c 100644 --- a/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs +++ b/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs @@ -3,7 +3,12 @@ import qbs CppApplication { name: "grpc_cpp" consoleApplication: true - condition: hasDependencies + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && hasDependencies; + } Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++11" diff --git a/tests/auto/blackbox/testdata/host-os-properties/host-os-properties.qbs b/tests/auto/blackbox/testdata/host-os-properties/host-os-properties.qbs index b6b862d1c..e1e722764 100644 --- a/tests/auto/blackbox/testdata/host-os-properties/host-os-properties.qbs +++ b/tests/auto/blackbox/testdata/host-os-properties/host-os-properties.qbs @@ -1,4 +1,10 @@ CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } consoleApplication: true cpp.defines: [ 'HOST_ARCHITECTURE="' + qbs.hostArchitecture + '"', diff --git a/tests/auto/blackbox/testdata/includeLookup/includeLookup.qbs b/tests/auto/blackbox/testdata/includeLookup/includeLookup.qbs index 182d1e232..5b645fad3 100644 --- a/tests/auto/blackbox/testdata/includeLookup/includeLookup.qbs +++ b/tests/auto/blackbox/testdata/includeLookup/includeLookup.qbs @@ -4,6 +4,12 @@ Project { property string name: 'includeLookup' qbsSearchPaths: '.' Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } type: 'application' consoleApplication: true name: project.name diff --git a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs index c5d07077f..994b4b146 100644 --- a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs +++ b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs @@ -1,11 +1,14 @@ Project { property bool dummy: { - if (qbs.targetOS.contains("windows")) + if (qbs.targetOS.contains("windows")) { console.info("is windows"); - else if (qbs.targetOS.contains("macos")) - console.info("is mac"); - else + } else if (qbs.targetOS.contains("darwin")) { + console.info("is darwin"); + if (qbs.targetOS.contains("macos")) + console.info("is mac"); + } else { console.info("is unix"); + } if (qbs.toolchain.contains("mingw")) console.info("is mingw"); diff --git a/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs b/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs index 2d37e85d6..1fa8f5e47 100644 --- a/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs +++ b/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs @@ -5,6 +5,12 @@ import qbs.TextFile Project { name: "p" CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "app" Depends { name: "installed-header" } Rule { diff --git a/tests/auto/blackbox/testdata/jsextensions-process/process.qbs b/tests/auto/blackbox/testdata/jsextensions-process/process.qbs index eba95d005..b634a8056 100644 --- a/tests/auto/blackbox/testdata/jsextensions-process/process.qbs +++ b/tests/auto/blackbox/testdata/jsextensions-process/process.qbs @@ -5,6 +5,12 @@ import qbs.TextFile Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } Depends { name: "cpp" } type: ["dummy"] name: "dummy" diff --git a/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs b/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs index 6cd334247..ec4ede648 100644 --- a/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs +++ b/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs @@ -1,4 +1,10 @@ CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } qbsSearchPaths: ".." Depends { name: "bisonhelper" } Depends { name: "lex_yacc" } diff --git a/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs b/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs index ec5b0b358..5749480cc 100644 --- a/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs +++ b/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs @@ -15,6 +15,12 @@ Project { } CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } Depends { name: "cpp" } Depends { name: "CoolPlugIn"; cpp.link: false } consoleApplication: true diff --git a/tests/auto/blackbox/testdata/localDeployment/localDeployment.qbs b/tests/auto/blackbox/testdata/localDeployment/localDeployment.qbs index 650f07104..856642689 100644 --- a/tests/auto/blackbox/testdata/localDeployment/localDeployment.qbs +++ b/tests/auto/blackbox/testdata/localDeployment/localDeployment.qbs @@ -1,5 +1,11 @@ Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } type: ["application"] consoleApplication: true name: "HelloWorld" diff --git a/tests/auto/blackbox/testdata/makefile-generator/app.qbs b/tests/auto/blackbox/testdata/makefile-generator/app.qbs index dfd67276e..2f53c4808 100644 --- a/tests/auto/blackbox/testdata/makefile-generator/app.qbs +++ b/tests/auto/blackbox/testdata/makefile-generator/app.qbs @@ -1,4 +1,10 @@ CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "the app" consoleApplication: true diff --git a/tests/auto/blackbox/testdata/minimumSystemVersion/macappstore.qbs b/tests/auto/blackbox/testdata/minimumSystemVersion/macappstore.qbs index 8440da779..8ae787b9a 100644 --- a/tests/auto/blackbox/testdata/minimumSystemVersion/macappstore.qbs +++ b/tests/auto/blackbox/testdata/minimumSystemVersion/macappstore.qbs @@ -2,7 +2,12 @@ // this only affects the value of __MAC_OS_X_VERSION_MIN_REQUIRED, // not the actual LC_VERSION_MIN_MACOSX command which is limited to two CppApplication { - condition: qbs.targetOS.contains("macos") + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && qbs.targetOS.contains("macos"); + } files: ["main.mm"] consoleApplication: true cpp.frameworks: "Foundation" diff --git a/tests/auto/blackbox/testdata/minimumSystemVersion/specific.qbs b/tests/auto/blackbox/testdata/minimumSystemVersion/specific.qbs index f6ecab418..8099d79b9 100644 --- a/tests/auto/blackbox/testdata/minimumSystemVersion/specific.qbs +++ b/tests/auto/blackbox/testdata/minimumSystemVersion/specific.qbs @@ -4,7 +4,12 @@ import qbs.Utilities // when the application is run its output should confirm // that the given values took effect CppApplication { - condition: qbs.targetOS.contains("windows") || qbs.targetOS.contains("macos") + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && qbs.targetOS.contains("windows") || qbs.targetOS.contains("macos"); + } files: [qbs.targetOS.contains("darwin") ? "main.mm" : "main.cpp"] consoleApplication: true diff --git a/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified-forced.qbs b/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified-forced.qbs index a5ea620fd..c0b70a0b2 100644 --- a/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified-forced.qbs +++ b/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified-forced.qbs @@ -3,6 +3,12 @@ import qbs.Utilities // no minimum versions are specified, and explicitly set to undefined in // case the profile has set it CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } files: [qbs.targetOS.contains("darwin") ? "main.mm" : "main.cpp"] consoleApplication: true cpp.minimumWindowsVersion: undefined diff --git a/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified.qbs b/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified.qbs index 0eeb2d547..a27ffcd28 100644 --- a/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified.qbs +++ b/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified.qbs @@ -2,6 +2,12 @@ import qbs.Utilities // no minimum versions are specified so the profile defaults will be used CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } files: [qbs.targetOS.contains("darwin") ? "main.mm" : "main.cpp"] consoleApplication: true diff --git a/tests/auto/blackbox/testdata/module-providers/module-providers.qbs b/tests/auto/blackbox/testdata/module-providers/module-providers.qbs index 7dc1d4c36..1ffa49038 100644 --- a/tests/auto/blackbox/testdata/module-providers/module-providers.qbs +++ b/tests/auto/blackbox/testdata/module-providers/module-providers.qbs @@ -1,4 +1,10 @@ Project { + property bool enabled: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } readonly property string beginning: "beginning" CppApplication { name: "app1" diff --git a/tests/auto/blackbox/testdata/nodejs/hello.qbs b/tests/auto/blackbox/testdata/nodejs/hello.qbs index c19e455db..d7c545922 100644 --- a/tests/auto/blackbox/testdata/nodejs/hello.qbs +++ b/tests/auto/blackbox/testdata/nodejs/hello.qbs @@ -1,4 +1,10 @@ NodeJSApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } nodejs.applicationFile: "hello.js" name: "hello" } diff --git a/tests/auto/blackbox/testdata/proper quoting/proper quoting.qbs b/tests/auto/blackbox/testdata/proper quoting/proper quoting.qbs index 184ee13e3..cf1fabf24 100644 --- a/tests/auto/blackbox/testdata/proper quoting/proper quoting.qbs +++ b/tests/auto/blackbox/testdata/proper quoting/proper quoting.qbs @@ -2,6 +2,12 @@ import qbs 1.0 Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } type: "application" consoleApplication: true name: "Hello World" diff --git a/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs b/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs index bbe4c7484..5e6ffc508 100644 --- a/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs +++ b/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs @@ -1,9 +1,14 @@ import qbs CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && hasProtobuf; + } name: "addressbook_cpp" consoleApplication: true - condition: hasProtobuf Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++11" diff --git a/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs b/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs index be68abfee..54433ea66 100644 --- a/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs +++ b/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs @@ -1,9 +1,14 @@ import qbs CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && hasProtobuf; + } name: "addressbook_objc" consoleApplication: true - condition: hasProtobuf Depends { name: "cpp" } Depends { name: "protobuf.objc"; required: false } diff --git a/tests/auto/blackbox/testdata/protobuf/import.qbs b/tests/auto/blackbox/testdata/protobuf/import.qbs index c51fd8f93..ef4e80c1b 100644 --- a/tests/auto/blackbox/testdata/protobuf/import.qbs +++ b/tests/auto/blackbox/testdata/protobuf/import.qbs @@ -1,9 +1,14 @@ import qbs CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && hasProtobuf; + } name: "app" consoleApplication: true - condition: hasProtobuf protobuf.cpp.importPaths: [sourceDirectory] diff --git a/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs b/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs index 2dfcbea5f..493632a0e 100644 --- a/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs +++ b/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs @@ -1,9 +1,14 @@ import qbs CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result && hasProtobuf; + } name: "app" consoleApplication: true - condition: hasProtobuf property path theImportDir protobuf.cpp.importPaths: (theImportDir ? [theImportDir] : []).concat([sourceDirectory]) diff --git a/tests/auto/blackbox/testdata/response-files/response-files.qbs b/tests/auto/blackbox/testdata/response-files/response-files.qbs index 1750ead3b..168cdf66a 100644 --- a/tests/auto/blackbox/testdata/response-files/response-files.qbs +++ b/tests/auto/blackbox/testdata/response-files/response-files.qbs @@ -8,6 +8,12 @@ Project { cpp.enableExceptions: true } Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "response-file-text" type: ["text"] Depends { name: "cpp" } diff --git a/tests/auto/blackbox/testdata/sanitizer/sanitizer.qbs b/tests/auto/blackbox/testdata/sanitizer/sanitizer.qbs index 7b5054316..e5db199dc 100644 --- a/tests/auto/blackbox/testdata/sanitizer/sanitizer.qbs +++ b/tests/auto/blackbox/testdata/sanitizer/sanitizer.qbs @@ -9,6 +9,10 @@ CppApplication { return false; if (qbs.toolchain.contains("mingw")) return false; + if (qbs.targetOS.contains("ios")) { + // thread sanitizer is not supported + return sanitizer !== "thread"; + } return true; } diff --git a/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs b/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs index 0b16d1984..48e70f260 100644 --- a/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs +++ b/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs @@ -10,6 +10,7 @@ Project { property stringList targetOS: qbs.targetOS configure: { console.info("is windows: " + (targetOS.contains("windows") ? "yes" : "no")); + console.info("is macos: " + (targetOS.contains("macos") ? "yes" : "no")); console.info("is darwin: " + (targetOS.contains("darwin") ? "yes" : "no")); } } diff --git a/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs b/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs index d2d47b767..5c5100b29 100644 --- a/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs +++ b/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs @@ -90,6 +90,12 @@ Project { } CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: "app" consoleApplication: true files: "main.cpp" diff --git a/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs b/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs index 2d3d64b00..63789a182 100644 --- a/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs +++ b/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs @@ -5,6 +5,12 @@ Project { property bool lazy: false Application { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } Depends { name: "cpp" } Depends { name: "functions"; diff --git a/tests/auto/blackbox/testdata/trackAddFile/after/trackAddFile.qbs b/tests/auto/blackbox/testdata/trackAddFile/after/trackAddFile.qbs index f4b9ba21f..113f44316 100644 --- a/tests/auto/blackbox/testdata/trackAddFile/after/trackAddFile.qbs +++ b/tests/auto/blackbox/testdata/trackAddFile/after/trackAddFile.qbs @@ -1,5 +1,11 @@ Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: 'someapp' type: 'application' consoleApplication: true diff --git a/tests/auto/blackbox/testdata/trackAddFile/before/trackAddFile.qbs b/tests/auto/blackbox/testdata/trackAddFile/before/trackAddFile.qbs index bb0ab7d44..74efdf8f7 100644 --- a/tests/auto/blackbox/testdata/trackAddFile/before/trackAddFile.qbs +++ b/tests/auto/blackbox/testdata/trackAddFile/before/trackAddFile.qbs @@ -1,5 +1,11 @@ Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: 'someapp' type: 'application' consoleApplication: true diff --git a/tests/auto/blackbox/testdata/trackFileTags/after/trackFileTags.qbs b/tests/auto/blackbox/testdata/trackFileTags/after/trackFileTags.qbs index 869ce238b..1d589978a 100644 --- a/tests/auto/blackbox/testdata/trackFileTags/after/trackFileTags.qbs +++ b/tests/auto/blackbox/testdata/trackFileTags/after/trackFileTags.qbs @@ -2,6 +2,12 @@ import qbs.TextFile Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: 'someapp' type: 'application' consoleApplication: true diff --git a/tests/auto/blackbox/testdata/trackFileTags/before/trackFileTags.qbs b/tests/auto/blackbox/testdata/trackFileTags/before/trackFileTags.qbs index ebe31bf26..4c9e77dd8 100644 --- a/tests/auto/blackbox/testdata/trackFileTags/before/trackFileTags.qbs +++ b/tests/auto/blackbox/testdata/trackFileTags/before/trackFileTags.qbs @@ -2,6 +2,12 @@ import qbs.TextFile Project { Product { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } name: 'someapp' type: 'application' consoleApplication: true diff --git a/tests/auto/blackbox/testdata/vcs/vcstest.qbs b/tests/auto/blackbox/testdata/vcs/vcstest.qbs index 5d359e2c7..dabe889b6 100644 --- a/tests/auto/blackbox/testdata/vcs/vcstest.qbs +++ b/tests/auto/blackbox/testdata/vcs/vcstest.qbs @@ -1,4 +1,10 @@ CppApplication { + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + return result; + } Depends { name: "vcs" } vcs.headerFileName: "my-repo-state.h" files: ["main.cpp"] diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 002b0ff24..8693aaa48 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -1134,9 +1134,13 @@ void TestBlackbox::dynamicLibraryInModule() QbsRunParameters libParams(QStringList({"-f", "thelibs.qbs", installRootSpec})); libParams.buildDirectory = "libbuild"; QCOMPARE(runQbs(libParams), 0); - QbsRunParameters appParams("run", QStringList({"-f", "theapp.qbs", installRootSpec})); + QbsRunParameters appParams("build", QStringList({"-f", "theapp.qbs", installRootSpec})); appParams.buildDirectory = "appbuild"; QCOMPARE(runQbs(appParams), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); + appParams.command = "run"; + QCOMPARE(runQbs(appParams), 0); QVERIFY2(m_qbsStdout.contains("Hello from thelib"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("Hello from theotherlib"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("thirdlib"), m_qbsStdout.constData()); @@ -1285,6 +1289,9 @@ void TestBlackbox::vcsGit() return m_qbsStdout.mid(startIndex + 2, endIndex - startIndex - 2); }; + QCOMPARE(runQbs({"resolve", {"-f", repoDir.path()}}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); // Run without git metadata. QbsRunParameters params("run", QStringList{"-f", repoDir.path()}); params.workingDir = repoDir.path() + "/.."; @@ -1373,6 +1380,8 @@ void TestBlackbox::vcsSubversion() failParams.command = "run"; failParams.expectFailure = true; const int retval = runQbs(failParams); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); if (m_qbsStderr.contains("svn too old")) QSKIP("svn too old"); QCOMPARE(retval, 0); @@ -1667,6 +1676,9 @@ void TestBlackbox::conditionalFileTagger() void TestBlackbox::configure() { QDir::setCurrent(testDataDir + "/configure"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); @@ -1855,6 +1867,9 @@ void TestBlackbox::separateDebugInfo() const bool isWindows = m_qbsStdout.contains("is windows: yes"); const bool isNotWindows = m_qbsStdout.contains("is windows: no"); QVERIFY(isWindows != isNotWindows); + const bool isMacos = m_qbsStdout.contains("is macos: yes"); + const bool isNotMacos = m_qbsStdout.contains("is macos: no"); + QVERIFY(isMacos != isNotMacos); const bool isDarwin = m_qbsStdout.contains("is darwin: yes"); const bool isNotDarwin = m_qbsStdout.contains("is darwin: no"); QVERIFY(isDarwin != isNotDarwin); @@ -1873,8 +1888,13 @@ void TestBlackbox::separateDebugInfo() .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(!QFile::exists(relativeProductBuildDir("app2") + "/app2.app.dSYM")); QVERIFY(!QFile::exists(relativeProductBuildDir("app3") + "/app3.app.dSYM")); - QVERIFY(regularFileExists(relativeProductBuildDir("app3") - + "/app3.app/Contents/MacOS/app3.dwarf")); + if (isMacos) { + QVERIFY(regularFileExists(relativeProductBuildDir("app3") + + "/app3.app/Contents/MacOS/app3.dwarf")); + } else { + QVERIFY(regularFileExists(relativeProductBuildDir("app3") + + "/app3.app/app3.dwarf")); + } QVERIFY(directoryExists(relativeProductBuildDir("app4") + "/app4.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("app4") + "/app4.dSYM/Contents/Info.plist")); @@ -1894,8 +1914,13 @@ void TestBlackbox::separateDebugInfo() .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(!QFile::exists(relativeProductBuildDir("foo2") + "/foo2.framework.dSYM")); QVERIFY(!QFile::exists(relativeProductBuildDir("foo3") + "/foo3.framework.dSYM")); - QVERIFY(regularFileExists(relativeProductBuildDir("foo3") - + "/foo3.framework/Versions/A/foo3.dwarf")); + if (isMacos) { + QVERIFY(regularFileExists(relativeProductBuildDir("foo3") + + "/foo3.framework/Versions/A/foo3.dwarf")); + } else { + QVERIFY(regularFileExists(relativeProductBuildDir("foo3") + + "/foo3.framework/foo3.dwarf")); + } QVERIFY(directoryExists(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM/Contents/Info.plist")); @@ -1915,8 +1940,13 @@ void TestBlackbox::separateDebugInfo() .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")); + if (isMacos) { + QVERIFY(regularFileExists(relativeProductBuildDir("bar3") + + "/bar3.bundle/Contents/MacOS/bar3.dwarf")); + } else { + QVERIFY(regularFileExists(relativeProductBuildDir("bar3") + + "/bar3.bundle/bar3.dwarf")); + } QVERIFY(directoryExists(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM/Contents/Info.plist")); @@ -1959,6 +1989,9 @@ void TestBlackbox::trackAddFile() QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/trackAddFile/work"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); @@ -2088,6 +2121,9 @@ void TestBlackbox::trackRemoveFile() ccp("before", "work"); ccp("after", "work"); QDir::setCurrent(testDataDir + "/trackAddFile/work"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); @@ -2132,6 +2168,9 @@ void TestBlackbox::trackAddFileTag() QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/trackFileTags/work"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); @@ -2156,6 +2195,9 @@ void TestBlackbox::trackRemoveFileTag() QDir().mkdir("work"); ccp("after", "work"); QDir::setCurrent(testDataDir + "/trackFileTags/work"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); @@ -2375,7 +2417,9 @@ void TestBlackbox::reproducibleBuild_data() void TestBlackbox::responseFiles() { QDir::setCurrent(testDataDir + "/response-files"); - QbsRunParameters params; + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "install"; params.arguments << "--install-root" << "installed"; QCOMPARE(runQbs(params), 0); @@ -2603,6 +2647,8 @@ void TestBlackbox::setupRunEnvironment() { QDir::setCurrent(testDataDir + "/setup-run-environment"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters failParams("run", QStringList({"--setup-run-env-config", "ignore-lib-dependencies"})); failParams.expectFailure = true; @@ -3828,6 +3874,9 @@ void TestBlackbox::exportsQbs() { QDir::setCurrent(testDataDir + "/exports-qbs"); + QCOMPARE(runQbs({"resolve", {"-f", "exports-qbs.qbs"}}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); // First we build exportable products and use them (as products) inside // the original project. QCOMPARE(runQbs(QStringList{"-f", "exports-qbs.qbs", "--command-echo-mode", "command-line"}), @@ -4041,10 +4090,11 @@ void TestBlackbox::installLocations() } QCOMPARE(runQbs(params), 0); const bool isWindows = m_qbsStdout.contains("is windows"); + const bool isDarwin = m_qbsStdout.contains("is darwin"); const bool isMac = m_qbsStdout.contains("is mac"); const bool isUnix = m_qbsStdout.contains("is unix"); const bool isMingw = m_qbsStdout.contains("is mingw"); - QVERIFY(isWindows || isMac || isUnix); + QVERIFY(isWindows || isDarwin || isUnix); QCOMPARE(runQbs(QbsRunParameters(QStringList("--clean-install-root"))), 0); struct BinaryInfo @@ -4060,38 +4110,40 @@ void TestBlackbox::installLocations() }; const BinaryInfo dll = { - isWindows ? "thelib.dll" : isMac ? "thelib" : "libthelib.so", - dllDir.isEmpty() ? (isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib") : dllDir, - isMac ? "thelib.framework" : "" + isWindows ? "thelib.dll" : isDarwin ? "thelib" : "libthelib.so", + dllDir.isEmpty() + ? (isDarwin ? "/Library/Frameworks" : (isWindows ? "/bin" : "/lib")) + : dllDir, + isDarwin ? "thelib.framework" : "" }; const BinaryInfo dllDsym = { isWindows ? (!isMingw ? "thelib.pdb" : "thelib.dll.debug") - : isMac ? "thelib.framework.dSYM" : "libthelib.so.debug", + : isDarwin ? "thelib.framework.dSYM" : "libthelib.so.debug", dsymDir.isEmpty() ? dll.installDir : dsymDir, {} }; const BinaryInfo plugin = { - isWindows ? "theplugin.dll" : isMac ? "theplugin" : "libtheplugin.so", + isWindows ? "theplugin.dll" : isDarwin ? "theplugin" : "libtheplugin.so", pluginDir.isEmpty() ? dll.installDir : pluginDir, - isMac ? "theplugin.bundle/Contents/MacOS" : "" + isDarwin ? (isMac ? "theplugin.bundle/Contents/MacOS" : "theplugin.bundle") : "" }; const BinaryInfo pluginDsym = { isWindows ? (!isMingw ? "theplugin.pdb" : "theplugin.dll.debug") - : isMac ? "theplugin.bundle.dSYM" : "libtheplugin.so.debug", + : isDarwin ? "theplugin.bundle.dSYM" : "libtheplugin.so.debug", dsymDir.isEmpty() ? plugin.installDir : dsymDir, {} }; const BinaryInfo app = { isWindows ? "theapp.exe" : "theapp", - binDir.isEmpty() ? (isMac ? "/Applications" : "/bin") : binDir, - isMac ? "theapp.app/Contents/MacOS" : "" + binDir.isEmpty() ? (isDarwin ? "/Applications" : "/bin") : binDir, + isDarwin ? (isMac ? "theapp.app/Contents/MacOS" : "theapp.app") : "" }; const BinaryInfo appDsym = { isWindows ? (!isMingw ? "theapp.pdb" : "theapp.exe.debug") - : isMac ? "theapp.app.dSYM" : "theapp.debug", + : isDarwin ? "theapp.app.dSYM" : "theapp.debug", dsymDir.isEmpty() ? app.installDir : dsymDir, {} }; @@ -4190,6 +4242,9 @@ void TestBlackbox::installable() void TestBlackbox::installableAsAuxiliaryInput() { QDir::setCurrent(testDataDir + "/installable-as-auxiliary-input"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("f-impl"), m_qbsStdout.constData()); } @@ -4423,6 +4478,9 @@ void TestBlackbox::jsExtensionsFileInfo() void TestBlackbox::jsExtensionsProcess() { QDir::setCurrent(testDataDir + "/jsextensions-process"); + QCOMPARE(runQbs({"resolve", {"-f", "process.qbs"}}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params(QStringList() << "-f" << "process.qbs"); QCOMPARE(runQbs(params), 0); QFile output("output.txt"); @@ -4548,6 +4606,9 @@ void TestBlackbox::symbolLinkMode() QDir::setCurrent(testDataDir + "/symbolLinkMode"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; const QStringList commonArgs{"-p", "driver", "--setup-run-env-config", @@ -4662,6 +4723,9 @@ void TestBlackbox::lexyacc() if (!lexYaccExist()) QSKIP("lex or yacc not present"); QDir::setCurrent(testDataDir + "/lexyacc/one-grammar"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(), 0); const QString parserBinary = relativeExecutableFilePath("one-grammar"); QProcess p; @@ -5576,6 +5640,8 @@ void TestBlackbox::properQuoting() { QDir::setCurrent(testDataDir + "/proper quoting"); QCOMPARE(runQbs(), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params(QStringLiteral("run"), QStringList() << "-q" << "-p" << "Hello World"); params.expectFailure = true; // Because the exit code is non-zero. QCOMPARE(runQbs(params), 156); @@ -5617,6 +5683,8 @@ void TestBlackbox::protobuf() rmDirR(relativeBuildDir()); QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile} << properties); QCOMPARE(runQbs(resolveParams), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); const bool withProtobuf = m_qbsStdout.contains("has protobuf: true"); const bool withoutProtobuf = m_qbsStdout.contains("has protobuf: false"); QVERIFY2(withProtobuf || withoutProtobuf, m_qbsStdout.constData()); @@ -6746,6 +6814,9 @@ void TestBlackbox::assembly() void TestBlackbox::autotestWithDependencies() { QDir::setCurrent(testDataDir + "/autotest-with-dependencies"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QStringList({"-p", "autotest-runner"})), 0); QVERIFY2(m_qbsStdout.contains("i am the test app") && m_qbsStdout.contains("i am the helper"), m_qbsStdout.constData()); @@ -6758,6 +6829,8 @@ void TestBlackbox::autotestTimeout() QDir::setCurrent(testDataDir + "/autotest-timeout"); QbsRunParameters resolveParameters("resolve", resolveParams); QCOMPARE(runQbs(resolveParameters), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters buildParameters(QStringList({"-p", "autotest-runner"})); buildParameters.expectFailure = expectFailure; if (expectFailure) { @@ -6802,6 +6875,8 @@ void TestBlackbox::autotests() if (!evilPropertySpec.isEmpty()) resolveParams.arguments << evilPropertySpec; QCOMPARE(runQbs(resolveParams), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters testParams(QStringList{"-p", "autotest-runner"}); if (!evilPropertySpec.isEmpty()) testParams.expectFailure = true; @@ -7036,12 +7111,16 @@ void TestBlackbox::enableRtti() void TestBlackbox::envMerging() { QDir::setCurrent(testDataDir + "/env-merging"); - QbsRunParameters params; + QbsRunParameters params("resolve"); QString pathVal = params.environment.value("PATH"); pathVal.prepend(HostOsInfo::pathListSeparator()).prepend("/opt/blackbox/bin"); const QString keyName = HostOsInfo::isWindowsHost() ? "pATh" : "PATH"; params.environment.insert(keyName, pathVal); QCOMPARE(runQbs(params), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); + params.command = "build"; + QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(QByteArray("PATH=/opt/tool/bin") + HostOsInfo::pathListSeparator().toLatin1()) && m_qbsStdout.contains(HostOsInfo::pathListSeparator().toLatin1() @@ -7242,6 +7321,8 @@ void TestBlackbox::nodejs() QSKIP("nodejs.packageManagerFilePath not set and automatic detection failed"); } + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(status, 0); QbsRunParameters params; @@ -7323,6 +7404,9 @@ void TestBlackbox::importsConflict() void TestBlackbox::includeLookup() { QDir::setCurrent(testDataDir + "/includeLookup"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); @@ -7487,6 +7571,9 @@ void TestBlackbox::loadableModule() { QDir::setCurrent(testDataDir + QLatin1String("/loadablemodule")); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); @@ -7500,6 +7587,10 @@ void TestBlackbox::localDeployment() QVERIFY(main.open(QIODevice::ReadOnly)); QByteArray content = main.readAll(); content.replace('\r', ""); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); + QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); @@ -7513,6 +7604,8 @@ void TestBlackbox::makefileGenerator() QCOMPARE(runQbs(params), 0); if (HostOsInfo::isWindowsHost()) return; + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QProcess make; make.setWorkingDirectory(QDir::currentPath() + '/' + relativeBuildDir()); const QString customInstallRoot = QDir::currentPath() + "/my-install-root"; @@ -7566,6 +7659,8 @@ void TestBlackbox::moduleProviders() // Resolving in dry-run mode must not leave any data behind. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 2); QVERIFY(!QFile::exists(relativeBuildDir())); @@ -7670,6 +7765,10 @@ void TestBlackbox::minimumSystemVersion() QFETCH(QString, file); QFETCH(QString, output); QbsRunParameters params({ "-f", file + ".qbs" }); + params.command = "resolve"; + QCOMPARE(runQbs(params), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); params.command = "run"; QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("Unsupported compiler")) @@ -7897,6 +7996,9 @@ void TestBlackbox::badInterpreter() QDir::setCurrent(testDataDir + QLatin1String("/badInterpreter")); QCOMPARE(runQbs(), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); + QbsRunParameters params("run"); params.expectFailure = true; @@ -7906,7 +8008,7 @@ void TestBlackbox::badInterpreter() params.arguments = QStringList() << "-p" << "script-interp-missing"; QCOMPARE(runQbs(params), 1); QString strerr = QString::fromLocal8Bit(m_qbsStderr); - QVERIFY(strerr.contains(reNoSuchFileOrDir)); + QVERIFY2(strerr.contains(reNoSuchFileOrDir), m_qbsStderr); params.arguments = QStringList() << "-p" << "script-interp-noexec"; QCOMPARE(runQbs(params), 1); @@ -7985,6 +8087,9 @@ void TestBlackbox::transitiveOptionalDependencies() void TestBlackbox::groupsInModules() { QDir::setCurrent(testDataDir + "/groups-in-modules"); + QCOMPARE(runQbs({"resolve"}), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compile rock.coal => rock.diamond")); @@ -8031,6 +8136,8 @@ void TestBlackbox::grpc() QVERIFY2(withGrpc || withoutGrpc, m_qbsStdout.constData()); if (withoutGrpc) QSKIP("grpc module not present"); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters runParams; QCOMPARE(runQbs(runParams), 0); @@ -8039,6 +8146,9 @@ void TestBlackbox::grpc() void TestBlackbox::hostOsProperties() { QDir::setCurrent(testDataDir + "/host-os-properties"); + QCOMPARE(runQbs(QStringLiteral("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QStringLiteral("run")), 0); QVERIFY2(m_qbsStdout.contains( ("HOST_ARCHITECTURE = " + HostOsInfo::hostOSArchitecture()).data()), diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp index 259517323..3623dc51b 100644 --- a/tests/auto/blackbox/tst_blackboxapple.cpp +++ b/tests/auto/blackbox/tst_blackboxapple.cpp @@ -137,76 +137,113 @@ void TestBlackboxApple::initTestCase() void TestBlackboxApple::appleMultiConfig() { const auto xcodeVersion = findXcodeVersion(); - const bool supportsX86 = xcodeVersion < qbs::Version(10); - QDir::setCurrent(testDataDir + "/apple-multiconfig"); QCOMPARE(runQbs(QbsRunParameters(QStringList{ "qbs.installPrefix:''", - QString("project.enableX86:") + (supportsX86 ? "true" : "false")})), 0); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/MacOS/singleapp").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/MacOS/singleapp_agg").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Resources").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/singlelib").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/Current").isDirSymLink()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/PkgInfo").isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" - "fatmultiappmultivariant").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" - "fatmultiappmultivariant_debug").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" - "fatmultiappmultivariant_profile").isExecutable()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/Info.plist") - .isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/PkgInfo") - .isRegularFile()); - - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isFileSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Resources").isDirSymLink()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_debug").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_profile").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources").isRegularDir()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources/Info.plist").isRegularFile()); - QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/Current").isDirSymLink()); - - for (const QString &variant : { "release", "debug", "profile" }) { - for (const QString &arch : { "x86_64" }) { - QProcess process; - process.setProgram("/usr/bin/arch"); - process.setArguments({ - "-arch", arch, - "-e", "DYLD_IMAGE_SUFFIX=_" + variant, - defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp" - }); - process.start(); - process.waitForFinished(); - QCOMPARE(process.exitCode(), 0); - const auto processStdout = process.readAllStandardOutput(); - QVERIFY2(processStdout.contains("Hello from " + variant.toUtf8() + " " + arch.toUtf8()), - processStdout.constData()); + QStringLiteral("project.xcodeVersion:") + xcodeVersion.toString()})), 0); + + if (m_qbsStdout.contains("isShallow: false")) { + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/MacOS/singleapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/MacOS/singleapp_agg").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Resources").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/singlelib").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/Current").isDirSymLink()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" + "fatmultiappmultivariant").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" + "fatmultiappmultivariant_debug").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" + "fatmultiappmultivariant_profile").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/Info.plist") + .isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/PkgInfo") + .isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Resources").isDirSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_debug").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_profile").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources").isRegularDir()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/Current").isDirSymLink()); + + for (const QString &variant : { "release", "debug", "profile" }) { + for (const QString &arch : { "x86_64" }) { + QProcess process; + process.setProgram("/usr/bin/arch"); + process.setArguments({ + "-arch", arch, + "-e", "DYLD_IMAGE_SUFFIX=_" + variant, + defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp" + }); + process.start(); + process.waitForFinished(); + QCOMPARE(process.exitCode(), 0); + const auto processStdout = process.readAllStandardOutput(); + QVERIFY2(processStdout.contains("Hello from " + variant.toUtf8() + " " + arch.toUtf8()), + processStdout.constData()); + } } + } else if (m_qbsStdout.contains("isShallow: true")) { + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/singleapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/singleapp_agg").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Info.plist").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/multiapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/fatmultiapp").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Info.plist").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/PkgInfo").isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/" + "fatmultiappmultivariant").isFileSymLink()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/" + "fatmultiappmultivariant_debug").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/" + "fatmultiappmultivariant_profile").isExecutable()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Info.plist") + .isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/PkgInfo") + .isRegularFile()); + + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib_debug").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib_profile").isRegularFile()); + QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Info.plist").isRegularFile()); + } else { + QVERIFY2(false, qPrintable(m_qbsStdout)); } } @@ -247,6 +284,9 @@ void TestBlackboxApple::assetCatalog() QCOMPARE(runQbs(params), 0); QVERIFY(!directoryExists(relativeBuildDir())); + if (m_qbsStdout.contains("Skip this test")) + QSKIP("Skip this test"); + params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << flattens << macosTarget; QCOMPARE(runQbs(params), 0); @@ -363,19 +403,10 @@ void TestBlackboxApple::bundleStructure() { QFETCH(QString, productName); QFETCH(QString, productTypeIdentifier); - QFETCH(bool, isShallow); QDir::setCurrent(testDataDir + "/bundle-structure"); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); params.arguments << "project.buildableProducts:" + productName; - if (isShallow) { - // Coerce shallow bundles - don't set bundle.isShallow directly because we want to test the - // automatic detection - const auto xcode5 = findXcodeVersion() >= qbs::Version(5); - params.arguments - << "modules.qbs.targetPlatform:ios" - << (xcode5 ? "qbs.architectures:arm64" : "qbs.architectures:armv7a"); - } if (productName == "ABadApple" || productName == "ABadThirdParty") params.expectFailure = true; @@ -392,7 +423,10 @@ void TestBlackboxApple::bundleStructure() QCOMPARE(status, 0); - if (!isShallow) { + if (m_qbsStdout.contains("bundle.isShallow: false")) { + // Test shallow bundles detection - bundles are not shallow only on macOS, so also check + // the qbs.targetOS property + QVERIFY2(m_qbsStdout.contains("qbs.targetOS: macos"), m_qbsStdout); if (productName == "A") { QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/Contents").isRegularDir()); @@ -486,7 +520,9 @@ void TestBlackboxApple::bundleStructure() QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile()); } - } else { + } else if (m_qbsStdout.contains("bundle.isShallow: true")) { + QVERIFY2(m_qbsStdout.contains("qbs.targetOS:"), m_qbsStdout); + QVERIFY2(!m_qbsStdout.contains("qbs.targetOS: macos"), m_qbsStdout); if (productName == "A") { QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/A.app/A").isRegularFile()); @@ -564,6 +600,8 @@ void TestBlackboxApple::bundleStructure() QVERIFY(QFileInfo2(defaultInstallRoot + "/G/ContentInfo.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/G/Contents/resource.txt").isRegularFile()); } + } else { + QVERIFY2(false, qPrintable(m_qbsStdout)); } } @@ -573,21 +611,15 @@ void TestBlackboxApple::bundleStructure_data() 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); + QTest::newRow("A") << "A" << "com.apple.product-type.application"; + QTest::newRow("ABadApple") << "ABadApple" << "com.apple.product-type.will.never.exist.ever.guaranteed"; + QTest::newRow("ABadThirdParty") << "ABadThirdParty" << "org.special.third.party.non.existent.product.type"; + QTest::newRow("B") << "B" << "com.apple.product-type.framework"; + QTest::newRow("C") << "C" << "com.apple.product-type.framework.static"; + QTest::newRow("D") << "D" << "com.apple.product-type.bundle"; + QTest::newRow("E") << "E" << "com.apple.product-type.app-extension"; + QTest::newRow("F") << "F" << "com.apple.product-type.xpc-service"; + QTest::newRow("G") << "G" << "com.apple.product-type.in-app-purchase-content"; } void TestBlackboxApple::deploymentTarget() @@ -731,16 +763,29 @@ void TestBlackboxApple::frameworkStructure() QbsRunParameters params; QCOMPARE(runQbs(params), 0); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Widget")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Headers/Widget.h")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/PrivateHeaders/WidgetPrivate.h")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/BaseResource")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/en.lproj/EnglishResource")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/Current")); - QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); - QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Resources")); + if (m_qbsStdout.contains("isShallow: false")) { + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Widget")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Headers/Widget.h")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/PrivateHeaders/WidgetPrivate.h")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/BaseResource")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/en.lproj/EnglishResource")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/Current")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Resources")); + } else if (m_qbsStdout.contains("isShallow: true")) { + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); + QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers/Widget.h")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders/WidgetPrivate.h")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/BaseResource")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/en.lproj/EnglishResource")); + QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); + } else { + QVERIFY2(false, qPrintable(m_qbsStdout)); + } params.command = "resolve"; params.arguments = QStringList() << "project.includeHeaders:false"; @@ -770,7 +815,15 @@ void TestBlackboxApple::iconsetApp() params.arguments = QStringList() << "-f" << "iconsetapp.qbs"; QCOMPARE(runQbs(params), 0); - QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + "/iconsetapp.app/Contents/Resources/white.icns")); + if (m_qbsStdout.contains("isShallow: false")) { + QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + + "/iconsetapp.app/Contents/Resources/white.icns")); + } else if (m_qbsStdout.contains("isShallow: true")) { + QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + + "/iconsetapp.app/white.icns")); + } else { + QVERIFY2(false, qPrintable(m_qbsStdout)); + } } void TestBlackboxApple::infoPlist() diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 68e344a9a..595a173a2 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -75,6 +75,9 @@ void TestBlackboxQt::addQObjectMacroToGeneratedCppFile() void TestBlackboxQt::autoQrc() { QDir::setCurrent(testDataDir + "/auto-qrc"); + QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app"})), 0); QVERIFY2(m_qbsStdout.simplified().contains("resource data: resource1 resource2"), m_qbsStdout.constData()); @@ -145,6 +148,9 @@ void TestBlackboxQt::dbusInterfaces() void TestBlackboxQt::forcedMoc() { QDir::setCurrent(testDataDir + "/forced-moc"); + QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStderr.contains("Hello from slot"), m_qbsStderr.constData()); } @@ -286,16 +292,23 @@ void TestBlackboxQt::mocSameFileName() void TestBlackboxQt::pkgconfig() { QDir::setCurrent(testDataDir + "/pkgconfig"); + QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); - if (m_qbsStdout.contains("Skip this test")) + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) QSKIP("pkgconfig or Qt not found"); } void TestBlackboxQt::pluginMetaData() { QDir::setCurrent(testDataDir + "/plugin-meta-data"); + QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); + QVERIFY2(runQbs(QbsRunParameters("run", QStringList{"-p", "app"})) == 0, m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("all ok!"), m_qbsStderr.constData()); @@ -460,6 +473,9 @@ void TestBlackboxQt::quickCompiler() void TestBlackboxQt::qtScxml() { QDir::setCurrent(testDataDir + "/qtscxml"); + QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("QtScxml not present")) QSKIP("QtScxml module not present"); @@ -539,6 +555,9 @@ void TestBlackboxQt::track_qobject_change() void TestBlackboxQt::track_qrc() { QDir::setCurrent(testDataDir + "/qrc"); + QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) + QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("rcc"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling test.cpp"), m_qbsStdout.constData()); |