summaryrefslogtreecommitdiff
path: root/mkspecs/features/testcase.prf
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-05-31 10:22:24 +1000
committerJoão Abecasis <joao.abecasis@nokia.com>2011-01-17 16:34:37 +0100
commite0bb13cdbcbbe772478c961efc5476c47e1b8eae (patch)
treea011bf43eeb6927241321609058661eb4851965a /mkspecs/features/testcase.prf
parent6aa5f3b94c6f94b85218f119fdb00e103b5ee442 (diff)
downloadqt4-tools-e0bb13cdbcbbe772478c961efc5476c47e1b8eae.tar.gz
Fix `make check' for debug-and-release on Windows.
(cherry picked from commit 012a777ecec0ca74cf95683f069cb79774b7093a)
Diffstat (limited to 'mkspecs/features/testcase.prf')
-rw-r--r--mkspecs/features/testcase.prf18
1 files changed, 16 insertions, 2 deletions
diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf
index db4f673510..2a56d7d719 100644
--- a/mkspecs/features/testcase.prf
+++ b/mkspecs/features/testcase.prf
@@ -6,8 +6,22 @@ check.path = .
# If the test ends up in a different directory, we should cd to that directory.
# Note that qmake modifies DESTDIR after this file is processed,
# therefore, testing DESTDIR for emptiness is not sufficient.
-!isEmpty(DESTDIR):!contains(DESTDIR,^\./?): check.commands = cd $(DESTDIR) &&
-contains(TARGET,.*/.*): check.commands = cd $(DESTDIR) &&
+# Also note that in debug-and-release mode we don't want to cd into the debug/release
+# directory (e.g. if the test goes to foo/release/tst_thing.exe, we want to do
+# cd foo && release/tst_thing.exe ).
+MUNGED_DESTDIR=$$DESTDIR
+MUNGED_TARGET=$$TARGET
+win32:debug_and_release {
+ contains(DESTDIR,^release$)|contains(DESTDIR,^debug$):MUNGED_DESTDIR=
+
+ # In debug-and-release mode, the first ../ in TARGET breaks out of the debug/release
+ # subdirectory. However, since make's working directory is already outside of the
+ # debug/release subdirectory, this first ../ should be ignored when deciding if
+ # we have to change directory before running the test.
+ MUNGED_TARGET=$$replace(MUNGED_TARGET,^\.\./,)
+}
+!isEmpty(MUNGED_DESTDIR):!contains(MUNGED_DESTDIR,^\./?):check.commands = cd $(DESTDIR) &&
+contains(MUNGED_TARGET,.*/.*):check.commands = cd $(DESTDIR) &&
# Allow for a custom test runner script
check.commands += $(TESTRUNNER)