mkspecs/features/qttest_p4.prf
changeset 7 f7bc934e204c
parent 0 1918ee327afb
--- a/mkspecs/features/qttest_p4.prf	Tue Feb 02 00:43:10 2010 +0200
+++ b/mkspecs/features/qttest_p4.prf	Wed Mar 31 11:06:36 2010 +0300
@@ -13,23 +13,39 @@
 # prefix test binary with tst_
 !contains(TARGET, ^tst_.*):TARGET = $$join(TARGET,,"tst_")
 
-########################################################################
-# Use install rule to run test application.
-# This lets you do 'make install' on a test to both build and run it,
-# and lets you easily build and run all tests from the parent directory.
-# ----------------------------------------------------------------------
+
+check.files                =
+check.path                 = .
+!isEmpty(DESTDIR): check.commands = cd ./$(DESTDIR) &&
+macx:      check.commands += ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET)
+else:unix: check.commands += ./$(QMAKE_TARGET)
+else:win32: {
+    CONFIG(debug, debug|release):check.commands += $(DESTDIR_TARGET)
+    else:check.commands += $(DESTDIR_TARGET)
+}
+embedded:  check.commands += -qws
+QMAKE_EXTRA_TARGETS += check
 
-runme.files                =
-runme.path                 = .
-!isEmpty(DESTDIR): runme.commands = cd ./$(DESTDIR) &&
-macx:      runme.commands += ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET)
-else:unix: runme.commands += ./$(QMAKE_TARGET)
-else:win32: {
-    CONFIG(debug, debug|release):runme.commands += debug\\$(QMAKE_TARGET)
-    else:runme.commands += release\\$(QMAKE_TARGET)
+!debug_and_release|build_pass {
+    check.depends = first
+} else {
+    check.CONFIG = recursive
+    # In debug and release mode, only run the test once.
+    # Run debug if available, release otherwise.
+    debug_and_release {
+        check.target = dummy_check
+        check.recurse_target = check
+        debug {
+            real_check.depends = debug-check
+            real_check.target = check
+            QMAKE_EXTRA_TARGETS += real_check
+        } else {
+            real_check.depends = release-check
+            real_check.target = check
+            QMAKE_EXTRA_TARGETS += real_check
+        }
+    }
 }
-embedded:  runme.commands += -qws
-INSTALLS += runme
 
-
-########################################################################
+target.path += $$[QT_INSTALL_PREFIX]/tests/qt4
+INSTALLS += target