From 012a777ecec0ca74cf95683f069cb79774b7093a Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 31 May 2010 10:22:24 +1000 Subject: Fix `make check' for debug-and-release on Windows. --- mkspecs/features/testcase.prf | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index db4f673..2a56d7d 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) -- cgit v0.12