mkspecs/features/testcase.prf
changeset 33 3e2da88830cd
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
       
     1 !contains(TEMPLATE,subdirs) {
       
     2 
       
     3 check.files                =
       
     4 check.path                 = .
       
     5 
       
     6 # If the test ends up in a different directory, we should cd to that directory.
       
     7 # Note that qmake modifies DESTDIR after this file is processed,
       
     8 # therefore, testing DESTDIR for emptiness is not sufficient.
       
     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) &&
       
    25 
       
    26 # Allow for a custom test runner script
       
    27 check.commands += $(TESTRUNNER)
       
    28 
       
    29 macx {
       
    30     app_bundle: check.commands += ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET)
       
    31     else:       check.commands += ./$(QMAKE_TARGET)
       
    32 }
       
    33 else:unix:      check.commands += ./$(QMAKE_TARGET)
       
    34 else:           check.commands += $(DESTDIR_TARGET)
       
    35 
       
    36 # For Qt/Embedded, run every test app as a QWS server
       
    37 embedded:       check.commands += -qws
       
    38 
       
    39 # Allow for custom arguments to tests
       
    40 check.commands += $(TESTARGS)
       
    41 QMAKE_EXTRA_TARGETS *= check
       
    42 
       
    43 !debug_and_release|build_pass {
       
    44     check.depends = first
       
    45 } else {
       
    46     check.CONFIG = recursive
       
    47     # In debug and release mode, only run the test once.
       
    48     # Run debug if available, release otherwise.
       
    49     debug_and_release {
       
    50         check.target = dummy_check
       
    51         check.recurse_target = check
       
    52         debug {
       
    53             real_check.depends = debug-check
       
    54             real_check.target = check
       
    55             QMAKE_EXTRA_TARGETS += real_check
       
    56         } else {
       
    57             real_check.depends = release-check
       
    58             real_check.target = check
       
    59             QMAKE_EXTRA_TARGETS += real_check
       
    60         }
       
    61     }
       
    62 }
       
    63 
       
    64 }
       
    65