aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-04-02 23:02:11 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2020-04-03 11:45:28 +0000
commitd1ad96d31b06f173e5bf494aad322a4790528e88 (patch)
tree58d35079c541e1821786dacf0bcb9735a0d26f92 /tests/auto
parentd34440c27a51fa0eb89ca94e927a33e13676df08 (diff)
Fix autodetecting mingw compiler in PATH
GccBinaryProbe failed to locate g++.exe since it tried to append ".exe" suffix which is already present in filename. Also, fix the emptyProfile() test by setting the qbs.toolchainType instead of read-only property "qbs.toolchain" which cannot be assigned from the command line. Also, prepend the original cpp.toolchainInstallPath value to the PATH variable to make sure Probe will find the desired compiler. Change-Id: I12341ee1cd4d8ea0cbcdf3781347bfc0a2780ad2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 97e2c1943..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);