From 92c694cd35c42dfde1e2d8d253fbdf8f5f3b6423 Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Thu, 2 Aug 2018 00:53:10 +0200 Subject: [PATCH] added advanced testruns via make --- qtmvvm.pro | 8 +++ src/src.pro | 1 + tests/auto/auto.pro | 4 ++ tests/auto/mvvmcore/binding/binding.pro | 4 +- tests/auto/mvvmcore/coreapp/coreapp.pro | 16 +++--- tests/auto/mvvmcore/coreapp/tst_coreapp.cpp | 2 +- tests/auto/mvvmcore/mvvmcore.pro | 3 + .../qsettingsaccessor/qsettingsaccessor.pro | 2 + .../serviceregistry/serviceregistry.pro | 2 + .../serviceregistrytestplugin.pro | 2 + .../settingsconfigloader.pro | 16 +++--- .../settingsgenerator/settingsgenerator.pro | 2 + .../datasyncsettingsaccessor.pro | 2 + .../mvvmdatasynccore/mvvmdatasynccore.pro | 3 + tests/auto/qml/qml.pro | 3 + tests/auto/qml/qmlmvvmcore/qmlmvvmcore.pro | 2 + .../qmlsettingsgenerator.pro | 2 + tests/auto/testrun.pri | 55 +++++++++++++++++++ tests/tests.pro | 3 + tools/tools.pro | 1 + 20 files changed, 117 insertions(+), 16 deletions(-) create mode 100644 tests/auto/testrun.pri diff --git a/qtmvvm.pro b/qtmvvm.pro index 13589e3..deb8d67 100644 --- a/qtmvvm.pro +++ b/qtmvvm.pro @@ -14,5 +14,13 @@ lrelease.recurse_target = lrelease lrelease.recurse += sub_src QMAKE_EXTRA_TARGETS += lrelease +runtests.target = run-tests +runtests.CONFIG = recursive +runtests.recurse_target = run-tests +runtests.recurse += sub_tests sub_src sub_tools +sub_runtest.target = sub-tests-runtests +sub_runtest.depends += sub-tests +QMAKE_EXTRA_TARGETS += sub_runtest runtests + DISTFILES += .qmake.conf \ sync.profile diff --git a/src/src.pro b/src/src.pro index 23361e3..a505769 100644 --- a/src/src.pro +++ b/src/src.pro @@ -24,3 +24,4 @@ imports.CONFIG += no_lrelease_target prepareRecursiveTarget(lrelease) QMAKE_EXTRA_TARGETS += lrelease +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 746b4e6..acca0f5 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -8,3 +8,7 @@ qtHaveModule(datasync) { SUBDIRS += \ mvvmdatasynccore } + +cmake.CONFIG += no_run-tests_target +prepareRecursiveTarget(run-tests) +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tests/auto/mvvmcore/binding/binding.pro b/tests/auto/mvvmcore/binding/binding.pro index 37b1f04..f94fa2f 100644 --- a/tests/auto/mvvmcore/binding/binding.pro +++ b/tests/auto/mvvmcore/binding/binding.pro @@ -8,4 +8,6 @@ CONFIG -= app_bundle TARGET = tst_binding SOURCES += \ - tst_binding.cpp + tst_binding.cpp + +include(../../testrun.pri) diff --git a/tests/auto/mvvmcore/coreapp/coreapp.pro b/tests/auto/mvvmcore/coreapp/coreapp.pro index db8b516..e5831a4 100644 --- a/tests/auto/mvvmcore/coreapp/coreapp.pro +++ b/tests/auto/mvvmcore/coreapp/coreapp.pro @@ -8,12 +8,14 @@ CONFIG -= app_bundle TARGET = tst_coreapp SOURCES += \ - tst_coreapp.cpp \ - testapp.cpp \ - testpresenter.cpp \ - testviewmodel.cpp + tst_coreapp.cpp \ + testapp.cpp \ + testpresenter.cpp \ + testviewmodel.cpp HEADERS += \ - testapp.h \ - testpresenter.h \ - testviewmodel.h + testapp.h \ + testpresenter.h \ + testviewmodel.h + +include(../../testrun.pri) diff --git a/tests/auto/mvvmcore/coreapp/tst_coreapp.cpp b/tests/auto/mvvmcore/coreapp/tst_coreapp.cpp index d43adff..680d628 100644 --- a/tests/auto/mvvmcore/coreapp/tst_coreapp.cpp +++ b/tests/auto/mvvmcore/coreapp/tst_coreapp.cpp @@ -512,7 +512,7 @@ void CoreAppTest::testPresentMessage_data() emit msgUnblock(true); }); }} << MessageConfig{MessageConfig::TypeMessageBox, MessageConfig::SubTypeAbout} - .setTitle(QStringLiteral("%1 — Version %2") + .setTitle(tr("%1 — Version %2") .arg(QGuiApplication::applicationDisplayName(), QCoreApplication::applicationVersion())) .setViewProperty(QStringLiteral("addQtVersion"), true) << static_cast(MessageConfig::Ok) diff --git a/tests/auto/mvvmcore/mvvmcore.pro b/tests/auto/mvvmcore/mvvmcore.pro index fed37c2..c422c28 100644 --- a/tests/auto/mvvmcore/mvvmcore.pro +++ b/tests/auto/mvvmcore/mvvmcore.pro @@ -16,3 +16,6 @@ equals(MSVC_VER, 14.0) { settingsgenerator \ settingsconfigloader } + +prepareRecursiveTarget(run-tests) +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tests/auto/mvvmcore/qsettingsaccessor/qsettingsaccessor.pro b/tests/auto/mvvmcore/qsettingsaccessor/qsettingsaccessor.pro index c6c5257..e8de176 100644 --- a/tests/auto/mvvmcore/qsettingsaccessor/qsettingsaccessor.pro +++ b/tests/auto/mvvmcore/qsettingsaccessor/qsettingsaccessor.pro @@ -12,3 +12,5 @@ HEADERS += \ SOURCES += \ tst_qsettingsaccessor.cpp + +include(../../testrun.pri) diff --git a/tests/auto/mvvmcore/serviceregistry/serviceregistry.pro b/tests/auto/mvvmcore/serviceregistry/serviceregistry.pro index df58df2..b55cdc0 100644 --- a/tests/auto/mvvmcore/serviceregistry/serviceregistry.pro +++ b/tests/auto/mvvmcore/serviceregistry/serviceregistry.pro @@ -20,3 +20,5 @@ SOURCES += \ load(qt_build_paths) DEFINES += PLUGIN_TESTDIR=\\\"$$MODULE_BASE_OUTDIR/tests/plugins\\\" + +include(../../testrun.pri) diff --git a/tests/auto/mvvmcore/serviceregistrytestplugin/serviceregistrytestplugin.pro b/tests/auto/mvvmcore/serviceregistrytestplugin/serviceregistrytestplugin.pro index 7439a69..74c6b3e 100644 --- a/tests/auto/mvvmcore/serviceregistrytestplugin/serviceregistrytestplugin.pro +++ b/tests/auto/mvvmcore/serviceregistrytestplugin/serviceregistrytestplugin.pro @@ -16,3 +16,5 @@ SOURCES += \ testplugin.cpp DISTFILES += serviceregistrytestplugin.json + +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tests/auto/mvvmcore/settingsconfigloader/settingsconfigloader.pro b/tests/auto/mvvmcore/settingsconfigloader/settingsconfigloader.pro index de0d45e..185e049 100644 --- a/tests/auto/mvvmcore/settingsconfigloader/settingsconfigloader.pro +++ b/tests/auto/mvvmcore/settingsconfigloader/settingsconfigloader.pro @@ -27,10 +27,12 @@ DISTFILES += \ sectionDocument.xml \ categoryDocument.xml \ selectorDocument.xml \ - includeDocument.xml \ - includeDocument_category.xml \ - includeDocument_section.xml \ - includeDocument_group.xml \ - includeDocument_entry.xml \ - includeDocument_filtered.xml \ - invalidDocument.xml + includeDocument.xml \ + includeDocument_category.xml \ + includeDocument_section.xml \ + includeDocument_group.xml \ + includeDocument_entry.xml \ + includeDocument_filtered.xml \ + invalidDocument.xml + +include(../../testrun.pri) diff --git a/tests/auto/mvvmcore/settingsgenerator/settingsgenerator.pro b/tests/auto/mvvmcore/settingsgenerator/settingsgenerator.pro index 57869f9..6b698fe 100644 --- a/tests/auto/mvvmcore/settingsgenerator/settingsgenerator.pro +++ b/tests/auto/mvvmcore/settingsgenerator/settingsgenerator.pro @@ -26,3 +26,5 @@ DISTFILES += \ import_config.xml TRANSLATIONS += test_de.ts + +include(../../testrun.pri) diff --git a/tests/auto/mvvmdatasynccore/datasyncsettingsaccessor/datasyncsettingsaccessor.pro b/tests/auto/mvvmdatasynccore/datasyncsettingsaccessor/datasyncsettingsaccessor.pro index 7b622b8..8eb13b0 100644 --- a/tests/auto/mvvmdatasynccore/datasyncsettingsaccessor/datasyncsettingsaccessor.pro +++ b/tests/auto/mvvmdatasynccore/datasyncsettingsaccessor/datasyncsettingsaccessor.pro @@ -12,3 +12,5 @@ HEADERS += \ SOURCES += \ tst_datasyncsettingsaccessor.cpp + +include(../../testrun.pri) diff --git a/tests/auto/mvvmdatasynccore/mvvmdatasynccore.pro b/tests/auto/mvvmdatasynccore/mvvmdatasynccore.pro index d480243..28358f0 100644 --- a/tests/auto/mvvmdatasynccore/mvvmdatasynccore.pro +++ b/tests/auto/mvvmdatasynccore/mvvmdatasynccore.pro @@ -2,3 +2,6 @@ TEMPLATE = subdirs SUBDIRS += \ datasyncsettingsaccessor + +prepareRecursiveTarget(run-tests) +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index f9516e3..229d772 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -5,3 +5,6 @@ SUBDIRS += \ qmlmvvmcore equals(MSVC_VER, 14.0): SUBDIRS -= qmlsettingsgenerator + +prepareRecursiveTarget(run-tests) +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tests/auto/qml/qmlmvvmcore/qmlmvvmcore.pro b/tests/auto/qml/qmlmvvmcore/qmlmvvmcore.pro index 739f4a3..c4210d7 100644 --- a/tests/auto/qml/qmlmvvmcore/qmlmvvmcore.pro +++ b/tests/auto/qml/qmlmvvmcore/qmlmvvmcore.pro @@ -14,3 +14,5 @@ DISTFILES += \ importFiles.path = . DEPLOYMENT += importFiles + +include(../../testrun.pri) diff --git a/tests/auto/qml/qmlsettingsgenerator/qmlsettingsgenerator.pro b/tests/auto/qml/qmlsettingsgenerator/qmlsettingsgenerator.pro index 465ec26..286925d 100644 --- a/tests/auto/qml/qmlsettingsgenerator/qmlsettingsgenerator.pro +++ b/tests/auto/qml/qmlsettingsgenerator/qmlsettingsgenerator.pro @@ -23,3 +23,5 @@ DISTFILES += \ importFiles.path = . DEPLOYMENT += importFiles + +include(../../testrun.pri) diff --git a/tests/auto/testrun.pri b/tests/auto/testrun.pri new file mode 100644 index 0000000..fb97f66 --- /dev/null +++ b/tests/auto/testrun.pri @@ -0,0 +1,55 @@ +linux { + runtarget_env_bin.target = run-tests + runtarget_env_bin.depends = export PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/bin/:$$[QT_INSTALL_BINS]:$(PATH)" + runtarget_env_lib.target = run-tests + runtarget_env_lib.depends = export LD_LIBRARY_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$$[QT_INSTALL_LIBS]:$(LD_LIBRARY_PATH)" + runtarget_env_plugins.target = run-tests + runtarget_env_plugins.depends = export QT_PLUGIN_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/plugins/:$(QT_PLUGIN_PATH)" + runtarget_env_qml.target = run-tests + runtarget_env_qml.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/:$(QML2_IMPORT_PATH)" + runtarget_env_qpa.target = run-tests + runtarget_env_qpa.depends += export QT_QPA_PLATFORM := "minimal" + QMAKE_EXTRA_TARGETS += \ + runtarget_env_bin \ + runtarget_env_lib \ + runtarget_env_plugins \ + runtarget_env_qml\ + runtarget_env_qpa +} else:mac { + runtarget_env_bin.target = run-tests + runtarget_env_bin.depends = export PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/bin/:$$[QT_INSTALL_BINS]:$(PATH)" + runtarget_env_lib.target = run-tests + runtarget_env_lib.depends = export DYLD_LIBRARY_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$$[QT_INSTALL_LIBS]:$(DYLD_LIBRARY_PATH)" + runtarget_env_framework.target = run-tests + runtarget_env_framework.depends = export DYLD_FRAMEWORK_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$$[QT_INSTALL_LIBS]:$(DYLD_FRAMEWORK_PATH)" + runtarget_env_plugins.target = run-tests + runtarget_env_plugins.depends = export QT_PLUGIN_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/plugins/:$(QT_PLUGIN_PATH)" + runtarget_env_qml.target = run-tests + runtarget_env_qml.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/:$(QML2_IMPORT_PATH)" + QMAKE_EXTRA_TARGETS += \ + runtarget_env_bin \ + runtarget_env_lib \ + runtarget_env_framework \ + runtarget_env_plugins \ + runtarget_env_qml +} else:win32 { + runtarget_env_bin.target = run-tests + runtarget_env_bin.depends = export PATH := "$$shadowed($$dirname(_QMAKE_CONF_))\bin\;$$shell_path($$[QT_INSTALL_BINS]);$(PATH)" + runtarget_env_plugins.target = run-tests + runtarget_env_plugins.depends = export QT_PLUGIN_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/plugins/;$(QT_PLUGIN_PATH)" + runtarget_env_qml.target = run-tests + runtarget_env_qml.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/;$(QML2_IMPORT_PATH)" + runtarget_env_qpa.target = run-tests + runtarget_env_qpa.depends += export QT_QPA_PLATFORM := "minimal" + QMAKE_EXTRA_TARGETS += \ + runtarget_env_bin \ + runtarget_env_plugins \ + runtarget_env_qml\ + runtarget_env_qpa +} + +runtarget.target = run-tests +runtarget.depends += $(TARGET) +win32: runtarget.commands = .\$(TARGET) +else: runtarget.commands = ./$(TARGET) +QMAKE_EXTRA_TARGETS += runtarget diff --git a/tests/tests.pro b/tests/tests.pro index dfc1ea0..bc24a38 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -3,3 +3,6 @@ TEMPLATE = subdirs CONFIG += no_docs_target SUBDIRS += auto + +prepareRecursiveTarget(run-tests) +QMAKE_EXTRA_TARGETS += run-tests diff --git a/tools/tools.pro b/tools/tools.pro index a5c9f22..d009736 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -7,3 +7,4 @@ settingsgenerator.CONFIG += no_lrelease_target prepareRecursiveTarget(lrelease) QMAKE_EXTRA_TARGETS += lrelease +QMAKE_EXTRA_TARGETS += run-tests