diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs | 7 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs | 22 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/install-locations/install-locations.qbs | 12 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/install-locations/theplugin.cpp | 3 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 127 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxapple.cpp | 22 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 4 |
7 files changed, 143 insertions, 54 deletions
diff --git a/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs b/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs index fbab6d0b1..fa4c67b96 100644 --- a/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs +++ b/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs @@ -43,8 +43,11 @@ Project { } for (var i = 0; i < a.length; ++i) { - if (a[i] !== b[i]) { - throw msg; + var version1 = a[i].split('.'); + var version2 = b[i].split('.'); + for (var j = 0; j < version1.length; ++j) { + if (version1[j] !== version2[j]) + throw msg; } } } diff --git a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs index 991e4ddcb..208305c1f 100644 --- a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs +++ b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs @@ -33,18 +33,22 @@ Project { prepare: { var cmd = new Command(input.filePath); cmd.description = "running " + input.filePath; - var pathVar; - var pathValue; + + var envVars = {}; if (product.qbs.hostOS.contains("windows")) { - pathVar = "PATH"; - pathValue = FileInfo.toWindowsSeparators(input["Qt.core"].binPath); + envVars["PATH"] = FileInfo.toWindowsSeparators(input["Qt.core"].binPath); + } else if (product.qbs.hostOS.contains("macos")) { + envVars["DYLD_LIBRARY_PATH"] = input["Qt.core"].libPath; + envVars["DYLD_FRAMEWORK_PATH"] = input["Qt.core"].libPath; } else { - pathVar = "LD_LIBRARY_PATH"; - pathValue = input["Qt.core"].libPath; + envVars["LD_LIBRARY_PATH"] = input["Qt.core"].libPath; + } + for (var varName in envVars) { + var oldValue = Environment.getEnv(varName) || ""; + var newValue = envVars[varName] + product.qbs.pathListSeparator + oldValue; + cmd.environment.push(varName + '=' + newValue); } - var oldValue = Environment.getEnv(pathVar) || ""; - var newValue = pathValue + product.qbs.pathListSeparator + oldValue; - cmd.environment = [pathVar + '=' + newValue]; + return [cmd]; } } diff --git a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs index 8a97f74a1..4ad37c498 100644 --- a/tests/auto/blackbox/testdata/install-locations/install-locations.qbs +++ b/tests/auto/blackbox/testdata/install-locations/install-locations.qbs @@ -10,7 +10,9 @@ Project { CppApplication { name: "theapp" install: true + installDebugInformation: true files: "main.cpp" + cpp.separateDebugInformation: true Group { fileTagsFilter: "application" fileTags: "some-tag" @@ -20,7 +22,17 @@ Project { name: "thelib" install: true installImportLib: true + installDebugInformation: true Depends { name: "cpp" } + cpp.separateDebugInformation: true files: "thelib.cpp" } + LoadableModule { + name: "theplugin" + install: true + installDebugInformation: true + Depends { name: "cpp" } + cpp.separateDebugInformation: true + files: "theplugin.cpp" + } } diff --git a/tests/auto/blackbox/testdata/install-locations/theplugin.cpp b/tests/auto/blackbox/testdata/install-locations/theplugin.cpp new file mode 100644 index 000000000..ac1ede090 --- /dev/null +++ b/tests/auto/blackbox/testdata/install-locations/theplugin.cpp @@ -0,0 +1,3 @@ +#include "../dllexport.h" + +DLL_EXPORT void pluginFunc() {} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index ecb8bd1e9..2eaf3e3be 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -3546,26 +3546,30 @@ void TestBlackbox::emptyProfile() const SettingsPtr s = settings(); const Profile buildProfile(profileName(), s.get()); bool isMsvc = false; - const auto toolchainType = buildProfile.value(QStringLiteral("qbs.toolchainType")).toString(); + auto toolchainType = buildProfile.value(QStringLiteral("qbs.toolchainType")).toString(); QbsRunParameters params; params.profile = "none"; + + if (toolchainType.isEmpty()) { + const auto toolchain = buildProfile.value(QStringLiteral("qbs.toolchain")).toStringList(); + if (!toolchain.isEmpty()) + toolchainType = toolchain.first(); + } if (!toolchainType.isEmpty()) { params.arguments = QStringList{QStringLiteral("qbs.toolchainType:") + toolchainType}; isMsvc = toolchainType == "msvc" || toolchainType == "clang-cl"; - } else { - const auto toolchain = buildProfile.value(QStringLiteral("qbs.toolchain")).toStringList(); - if (!toolchain.isEmpty()) { - params.arguments = QStringList{QStringLiteral("qbs.toolchain:") - + toolchain.join(QLatin1Char(','))}; - isMsvc = toolchainType.contains("msvc"); - } } + if (!isMsvc) { - const auto tcPath - = buildProfile.value(QStringLiteral("cpp.toolchainInstallPath")).toString(); - if (!tcPath.isEmpty() && !qEnvironmentVariable("PATH") - .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts).contains(tcPath)) { - params.arguments << QStringLiteral("modules.cpp.toolchainInstallPath:") + tcPath; + const auto tcPath = + QDir::toNativeSeparators( + buildProfile.value(QStringLiteral("cpp.toolchainInstallPath")).toString()); + auto paths = params.environment.value(QStringLiteral("PATH")) + .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); + if (!tcPath.isEmpty() && !paths.contains(tcPath)) { + paths.prepend(tcPath); + params.environment.insert( + QStringLiteral("PATH"), paths.join(HostOsInfo::pathListSeparator())); } } QCOMPARE(runQbs(params), 0); @@ -4001,8 +4005,16 @@ void TestBlackbox::installLocations_data() QTest::addColumn<QString>("binDir"); QTest::addColumn<QString>("dllDir"); QTest::addColumn<QString>("libDir"); - QTest::newRow("explicit values") << QString("bindir") << QString("dlldir") << QString("libdir"); - QTest::newRow("default values") << QString() << QString() << QString(); + QTest::addColumn<QString>("pluginDir"); + QTest::addColumn<QString>("dsymDir"); + QTest::newRow("explicit values") + << QString("bindir") + << QString("dlldir") + << QString("libdir") + << QString("pluginDir") + << QString("dsymDir"); + QTest::newRow("default values") + << QString() << QString() << QString() << QString() << QString(); } void TestBlackbox::installLocations() @@ -4011,6 +4023,8 @@ void TestBlackbox::installLocations() QFETCH(QString, binDir); QFETCH(QString, dllDir); QFETCH(QString, libDir); + QFETCH(QString, pluginDir); + QFETCH(QString, dsymDir); QbsRunParameters params("resolve"); if (!binDir.isEmpty()) params.arguments.push_back("products.theapp.installDir:" + binDir); @@ -4018,35 +4032,88 @@ void TestBlackbox::installLocations() params.arguments.push_back("products.thelib.installDir:" + dllDir); if (!libDir.isEmpty()) params.arguments.push_back("products.thelib.importLibInstallDir:" + libDir); + if (!pluginDir.isEmpty()) + params.arguments.push_back("products.theplugin.installDir:" + pluginDir); + if (!dsymDir.isEmpty()) { + params.arguments.push_back("products.theapp.debugInformationInstallDir:" + dsymDir); + params.arguments.push_back("products.thelib.debugInformationInstallDir:" + dsymDir); + params.arguments.push_back("products.theplugin.debugInformationInstallDir:" + dsymDir); + } QCOMPARE(runQbs(params), 0); const bool isWindows = m_qbsStdout.contains("is windows"); const bool isMac = m_qbsStdout.contains("is mac"); const bool isUnix = m_qbsStdout.contains("is unix"); QVERIFY(isWindows || isMac || isUnix); QCOMPARE(runQbs(QbsRunParameters(QStringList("--clean-install-root"))), 0); - const QString dllFileName = isWindows ? "thelib.dll" : isMac ? "thelib" : "libthelib.so"; - const QString appFileName = isWindows ? "theapp.exe" : "theapp"; - if (binDir.isEmpty()) - binDir = isMac ? "/Applications" : "/bin"; - if (dllDir.isEmpty()) - dllDir = isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib"; - if (libDir.isEmpty()) - libDir = "/lib"; - if (isMac) { - binDir += "/theapp.app/Contents/MacOS"; - dllDir += "/thelib.framework"; - } + + struct BinaryInfo + { + QString fileName; + QString installDir; + QString subDir; + + QString absolutePath(const QString &prefix) const + { + return QDir::cleanPath(prefix + '/' + installDir + '/' + subDir + '/' + fileName); + } + }; + + const BinaryInfo dll = { + isWindows ? "thelib.dll" : isMac ? "thelib" : "libthelib.so", + dllDir.isEmpty() ? (isMac ? "/Library/Frameworks" : isWindows ? "/bin" : "/lib") : dllDir, + isMac ? "thelib.framework" : "" + }; + const BinaryInfo dllDsym = { + isWindows ? "thelib.pdb" : isMac ? "thelib.framework.dSYM" : "libthelib.so.debug", + dsymDir.isEmpty() ? dll.installDir : dsymDir, + {} + }; + const BinaryInfo plugin = { + isWindows ? "theplugin.dll" : isMac ? "theplugin" : "libtheplugin.so", + pluginDir.isEmpty() ? dll.installDir : pluginDir, + isMac ? "theplugin.bundle/Contents/MacOS" : "" + }; + const BinaryInfo pluginDsym = { + isWindows ? "theplugin.pdb" : isMac ? "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" : "" + }; + const BinaryInfo appDsym = { + isWindows ? "theapp.pdb" : isMac ? "theapp.app.dSYM" : "theapp.debug", + dsymDir.isEmpty() ? app.installDir : dsymDir, + {} + }; + const QString installRoot = QDir::currentPath() + "/default/install-root"; const QString installPrefix = isWindows ? QString() : "/usr/local"; const QString fullInstallPrefix = installRoot + '/' + installPrefix + '/'; - const QString appFilePath = fullInstallPrefix + binDir + '/' + appFileName; + const QString appFilePath = app.absolutePath(fullInstallPrefix); QVERIFY2(QFile::exists(appFilePath), qPrintable(appFilePath)); - const QString dllFilePath = fullInstallPrefix + dllDir + '/' + dllFileName; + const QString dllFilePath = dll.absolutePath(fullInstallPrefix); QVERIFY2(QFile::exists(dllFilePath), qPrintable(dllFilePath)); if (isWindows) { - const QString libFilePath = fullInstallPrefix + libDir + "/thelib.lib"; + const BinaryInfo lib = { + "thelib.lib", + libDir.isEmpty() ? "/lib" : libDir, + "" + }; + const QString libFilePath = lib.absolutePath(fullInstallPrefix); QVERIFY2(QFile::exists(libFilePath), qPrintable(libFilePath)); } + const QString pluginFilePath = plugin.absolutePath(fullInstallPrefix); + QVERIFY2(QFile::exists(pluginFilePath), qPrintable(pluginFilePath)); + + const QString appDsymFilePath = appDsym.absolutePath(fullInstallPrefix); + QVERIFY2(QFileInfo(appDsymFilePath).exists(), qPrintable(appDsymFilePath)); + const QString dllDsymFilePath = dllDsym.absolutePath(fullInstallPrefix); + QVERIFY2(QFileInfo(dllDsymFilePath).exists(), qPrintable(dllDsymFilePath)); + const QString pluginDsymFilePath = pluginDsym.absolutePath(fullInstallPrefix); + QVERIFY2(QFile::exists(pluginDsymFilePath), qPrintable(pluginDsymFilePath)); } void TestBlackbox::inputsFromDependencies() diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp index ff7afd274..259517323 100644 --- a/tests/auto/blackbox/tst_blackboxapple.cpp +++ b/tests/auto/blackbox/tst_blackboxapple.cpp @@ -653,47 +653,47 @@ void TestBlackboxApple::deploymentTarget_data() } QTest::newRow("macos x86_64") << "macosx" << macos << "x86_64" << "-triple x86_64-apple-macosx10.6" - << "-macosx_version_min 10.6"; + << "10.6"; if (xcodeVersion >= qbs::Version(6)) QTest::newRow("macos x86_64h") << "macosx" << macos << "x86_64h" << "-triple x86_64h-apple-macosx10.12" - << "-macosx_version_min 10.12"; + << "10.12"; QTest::newRow("ios armv7a") << "iphoneos" << ios << "armv7a" << "-triple thumbv7-apple-ios6.0" - << "-iphoneos_version_min 6.0"; + << "6.0"; QTest::newRow("ios armv7s") << "iphoneos" <<ios << "armv7s" << "-triple thumbv7s-apple-ios7.0" - << "-iphoneos_version_min 7.0"; + << "7.0"; if (xcodeVersion >= qbs::Version(5)) QTest::newRow("ios arm64") << "iphoneos" <<ios << "arm64" << "-triple arm64-apple-ios7.0" - << "-iphoneos_version_min 7.0"; + << "7.0"; QTest::newRow("ios-simulator x86") << "iphonesimulator" << ios_sim << "x86" << "-triple i386-apple-ios6.0" - << "-ios_simulator_version_min 6.0"; + << "6.0"; if (xcodeVersion >= qbs::Version(5)) QTest::newRow("ios-simulator x86_64") << "iphonesimulator" << ios_sim << "x86_64" << "-triple x86_64-apple-ios7.0" - << "-ios_simulator_version_min 7.0"; + << "7.0"; if (xcodeVersion >= qbs::Version(7)) { if (xcodeVersion >= qbs::Version(7, 1)) { QTest::newRow("tvos arm64") << "appletvos" << tvos << "arm64" << "-triple arm64-apple-tvos9.0" - << "-tvos_version_min 9.0"; + << "9.0"; QTest::newRow("tvos-simulator x86_64") << "appletvsimulator" << tvos_sim << "x86_64" << "-triple x86_64-apple-tvos9.0" - << "-tvos_simulator_version_min 9.0"; + << "9.0"; } QTest::newRow("watchos armv7k") << "watchos" << watchos << "armv7k" << "-triple thumbv7k-apple-watchos2.0" - << "-watchos_version_min 2.0"; + << "2.0"; QTest::newRow("watchos-simulator x86") << "watchsimulator" << watchos_sim << "x86" << "-triple i386-apple-watchos2.0" - << "-watchos_simulator_version_min 2.0"; + << "2.0"; } } diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 33d0ba1b8..68e344a9a 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -412,9 +412,9 @@ void TestBlackboxQt::qmlTypeRegistrar() QCOMPARE(m_qbsStdout.contains("running qmltyperegistrar"), enabled); QCOMPARE(m_qbsStdout.contains("compiling myapp_qmltyperegistrations.cpp"), enabled); const QString buildDir = relativeProductBuildDir("myapp"); - QCOMPARE(regularFileExists(buildDir + "/app.qmltypes"), enabled); + QCOMPARE(regularFileExists(buildDir + "/myapp.qmltypes"), enabled); QCOMPARE(regularFileExists(relativeBuildDir() + "/install-root/" + installDir - + "/app.qmltypes"), enabled && !installDir.isEmpty()); + + "/myapp.qmltypes"), enabled && !installDir.isEmpty()); } void TestBlackboxQt::qtKeywords() |