@@ -6,8 +6,22 @@ check.path = .
6
6
# If the test ends up in a different directory, we should cd to that directory.
7
7
# Note that qmake modifies DESTDIR after this file is processed,
8
8
# therefore, testing DESTDIR for emptiness is not sufficient.
9
- !isEmpty(DESTDIR):!contains(DESTDIR,^\./?): check.commands = cd $(DESTDIR) &&
10
- contains(TARGET,.*/.*): check.commands = cd $(DESTDIR) &&
9
+ # Also note that in debug-and-release mode we don't want to cd into the debug/release
10
+ # directory (e.g. if the test goes to foo/release/tst_thing.exe, we want to do
11
+ # cd foo && release/tst_thing.exe ).
12
+ MUNGED_DESTDIR=$$DESTDIR
13
+ MUNGED_TARGET=$$TARGET
14
+ win32:debug_and_release {
15
+ contains(DESTDIR,^release$)|contains(DESTDIR,^debug$):MUNGED_DESTDIR=
16
+
17
+ # In debug-and-release mode, the first ../ in TARGET breaks out of the debug/release
18
+ # subdirectory. However, since make's working directory is already outside of the
19
+ # debug/release subdirectory, this first ../ should be ignored when deciding if
20
+ # we have to change directory before running the test.
21
+ MUNGED_TARGET=$$replace(MUNGED_TARGET,^\.\./,)
22
+ }
23
+ !isEmpty(MUNGED_DESTDIR):!contains(MUNGED_DESTDIR,^\./?):check.commands = cd $(DESTDIR) &&
24
+ contains(MUNGED_TARGET,.*/.*):check.commands = cd $(DESTDIR) &&
11
25
12
26
# Allow for a custom test runner script
13
27
check.commands += $(TESTRUNNER)
0 commit comments