Skip to content

Commit e0bb13c

Browse files
Rohan McGovernJoão Abecasis
Rohan McGovern
authored and
João Abecasis
committed
Fix `make check' for debug-and-release on Windows.
(cherry picked from commit 012a777)
1 parent 6aa5f3b commit e0bb13c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

mkspecs/features/testcase.prf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ check.path = .
66
# If the test ends up in a different directory, we should cd to that directory.
77
# Note that qmake modifies DESTDIR after this file is processed,
88
# 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) &&
1125

1226
# Allow for a custom test runner script
1327
check.commands += $(TESTRUNNER)

0 commit comments

Comments
 (0)