TEMPLATE = aux load(am-config) # Add environment for non-installed builds. Do this first, so the # 'make' variable expansions don't end up in a batch file/script. QT_TOOL_NAME = appman-qmltestrunner !isEmpty(TEST_FILES): qtAddTargetEnv(COMMAND, QT) # If the test ends up in a different directory, we should cd to that directory. TESTRUN_CWD = $$DESTDIR debug_and_release:debug_and_release_target { # But in debug-and-release-target 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', not 'cd foo/release && tst_thing.exe'). TESTRUN_CWD ~= s/(release|debug)$// TEST_TARGET_DIR = $$relative_path($$absolute_path($$DESTDIR, $$OUT_PWD), $$absolute_path($$TESTRUN_CWD, $$OUT_PWD)) } # Allow for a custom test runner script COMMAND += $(TESTRUNNER) # Define how the appman should be run, single-process, multi-process, both isEmpty(MODE) { MODE = both CONFIG *= qmltest-mode-auto } # Determine the location of the testrunner prefix_build { AM_TESTRUNNER_DIR = $$BUILD_DIR/bin } else { !isEmpty(INSTALL_PREFIX) { AM_TESTRUNNER_DIR = $${INSTALL_PREFIX}/bin } else { AM_TESTRUNNER_DIR = $$[QT_INSTALL_BINS] } } # The check command COMMAND += $$AM_TESTRUNNER_DIR/appman-qmltestrunner -r --no-dlt-logging mac: COMMAND += --dbus=none multi-process: COMMAND += --start-session-dbus !multi-process: { !build_pass:!qmltest-mode-auto:message("am-qml-testcase: forcing MODE to single-process, because application-manager is built in single-process mode") MODE = single-process } # Add import dirs for(import, IMPORTS_DIR) { COMMAND += -I $$absolute_path($$import, $$_PRO_FILE_PWD_) } OTHER_FILES += $$IMPORTS_DIR # Read a config file for(config, AM_CONFIG) { COMMAND += -c $$absolute_path($$config, $$_PRO_FILE_PWD_) } OTHER_FILES += $$AM_CONFIG !isEmpty(TESTRUN_CWD):!contains(TESTRUN_CWD, ^\\./?): \ COMMAND = cd $$shell_path($$TESTRUN_CWD) && $$eval(COMMAND) QMAKE_EXTRA_TARGETS *= check # Execute a testrunner for every file for(file, TEST_FILES) { !equals(MODE, "single-process"):check.commands += $$COMMAND $$absolute_path($$file, $$_PRO_FILE_PWD_) --force-multi-process -- $(TESTARGS) && !equals(MODE, "multi-process"):check.commands += $$COMMAND $$absolute_path($$file, $$_PRO_FILE_PWD_) --force-single-process -- $(TESTARGS) && } check.commands += true; OTHER_FILES += $$TEST_FILES # Copy assets to build folder for (d , DIRECTORIES) { win32: do_copydata.commands += $(COPY_DIR) $$shell_path($$_PRO_FILE_PWD_/$${d}) $$shell_path($$OUT_PWD/$${d}) $$escape_expand(\n\t) else: do_copydata.commands += $(COPY_DIR) $$shell_path($$_PRO_FILE_PWD_/$${d}) $$shell_path($$OUT_PWD) $$escape_expand(\n\t) } for (f , FILES) { do_copydata.commands += $(COPY) $$shell_path($$_PRO_FILE_PWD_/$${f}) $$shell_path($$OUT_PWD/$${f}) $$escape_expand(\n\t) } !equals(_PRO_FILE_PWD_, $$OUT_PWD) { check.depends = do_copydata QMAKE_EXTRA_TARGETS += do_copydata }