summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/qmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2019-07-31 13:53:24 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2019-08-09 10:29:28 +0200
commite75aed1a96e626f079af307c5604ddf9054ecafc (patch)
treea39e42082e91f3b6f356299228cacea0e96e3a1e /tests/auto/tools/qmake
parent38cfd3a8cbc93001e7e9707640694aba275a370b (diff)
Warn about conflicting DESTDIR/TARGET combination in debug_and_release
If a project has DESTDIR and TARGET set to fixed values, then the target paths conflict when doing debug_and_release builds. With this change we're detecting this situation and yield a warning. Fixes: QTBUG-2736 Change-Id: Ib163db3463322792ab9fa5b997285ac9fc9819ab Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'tests/auto/tools/qmake')
-rw-r--r--tests/auto/tools/qmake/testdata/conflicting_targets/conflicting_targets.pro5
-rw-r--r--tests/auto/tools/qmake/testdata/conflicting_targets/main.cpp4
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp15
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/tools/qmake/testdata/conflicting_targets/conflicting_targets.pro b/tests/auto/tools/qmake/testdata/conflicting_targets/conflicting_targets.pro
new file mode 100644
index 0000000000..c3e8034e35
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/conflicting_targets/conflicting_targets.pro
@@ -0,0 +1,5 @@
+TEMPLATE = app
+CONFIG += debug_and_release
+TARGET = bah
+DESTDIR = shu
+SOURCES += main.cpp
diff --git a/tests/auto/tools/qmake/testdata/conflicting_targets/main.cpp b/tests/auto/tools/qmake/testdata/conflicting_targets/main.cpp
new file mode 100644
index 0000000000..39de28135a
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/conflicting_targets/main.cpp
@@ -0,0 +1,4 @@
+int main(int, char **)
+{
+ return 0;
+}
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index 1df31904d6..cda4c500e1 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -33,6 +33,7 @@
#include <QDir>
#include <QDirIterator>
#include <QObject>
+#include <QRegularExpression>
#include <QStandardPaths>
#include <QTemporaryDir>
@@ -82,6 +83,7 @@ private slots:
void project();
void proFileCache();
void resources();
+ void conflictingTargets();
private:
TestCompiler test_compiler;
@@ -621,5 +623,18 @@ void tst_qmake::resources()
QVERIFY(test_compiler.make(workDir));
}
+void tst_qmake::conflictingTargets()
+{
+ QString workDir = base_path + "/testdata/conflicting_targets";
+ QVERIFY(test_compiler.qmake(workDir, "conflicting_targets"));
+ const QRegularExpression rex("Targets of builds '([^']+)' and '([^']+)' conflict");
+ auto match = rex.match(test_compiler.commandOutput());
+ QVERIFY(match.hasMatch());
+ QStringList builds = { match.captured(1), match.captured(2) };
+ std::sort(builds.begin(), builds.end());
+ const QStringList expectedBuilds{"Debug", "Release"};
+ QCOMPARE(builds, expectedBuilds);
+}
+
QTEST_MAIN(tst_qmake)
#include "tst_qmake.moc"