##// END OF EJS Templates
Updated meson build files and force plugin unload when closing app...
jeandet -
r72:a0c89a70c83c
parent child
Show More
@@ -1,41 +1,42
1 #ifndef SCIQLOP_PLUGINMANAGER_H
1 #ifndef SCIQLOP_PLUGINMANAGER_H
2 #define SCIQLOP_PLUGINMANAGER_H
2 #define SCIQLOP_PLUGINMANAGER_H
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Common/spimpl.h>
6 #include <Common/spimpl.h>
7
7
8 #include <QLoggingCategory>
8 #include <QLoggingCategory>
9
9
10 class QDir;
10 class QDir;
11
11
12 Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager)
12 Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager)
13
13
14 /**
14 /**
15 * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop.
15 * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop.
16 */
16 */
17 class SCIQLOP_CORE_EXPORT PluginManager {
17 class SCIQLOP_CORE_EXPORT PluginManager {
18 public:
18 public:
19 explicit PluginManager();
19 explicit PluginManager();
20 ~PluginManager();
20
21
21 /**
22 /**
22 * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in
23 * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in
23 * parameter
24 * parameter
24 * @param pluginDir the directory containing the plugins
25 * @param pluginDir the directory containing the plugins
25 */
26 */
26 void loadPlugins(const QDir &pluginDir);
27 void loadPlugins(const QDir &pluginDir);
27
28
28 /**
29 /**
29 * Loads static plugins into SciQlop. SciQLOP supports statically linked plugins.
30 * Loads static plugins into SciQlop. SciQLOP supports statically linked plugins.
30 */
31 */
31 void loadStaticPlugins();
32 void loadStaticPlugins();
32
33
33 /// @returns the number of plugins loaded
34 /// @returns the number of plugins loaded
34 int nbPluginsLoaded() const noexcept;
35 int nbPluginsLoaded() const noexcept;
35
36
36 private:
37 private:
37 struct PluginManagerPrivate;
38 struct PluginManagerPrivate;
38 spimpl::unique_impl_ptr<PluginManagerPrivate> impl;
39 spimpl::unique_impl_ptr<PluginManagerPrivate> impl;
39 };
40 };
40
41
41 #endif // SCIQLOP_PLUGINMANAGER_H
42 #endif // SCIQLOP_PLUGINMANAGER_H
@@ -1,122 +1,104
1
1
2 catalogicpp_dep = dependency('catalogicpp', required : true, fallback:['catalogicpp','catalogicpp_dep'])
2 catalogicpp_dep = dependency('catalogicpp', required : true, fallback:['catalogicpp','catalogicpp_dep'])
3 pybind11_dep = dependency('pybind11', required : true, fallback:['pybind11','pybind11_dep'])
3 pybind11_dep = dependency('pybind11', required : true, fallback:['pybind11','pybind11_dep'])
4
4 timeseries_dep = dependency('TimeSeries', required : true, fallback:['TimeSeries','time_series_dep'])
5
5
6 core_moc_headers = [
6 core_moc_headers = [
7 './include/Common/containers.h',
7 './include/Common/containers.h',
8 './include/Common/StringUtils.h',
8 './include/Common/StringUtils.h',
9 './include/Common/Numeric.h',
9 './include/Common/Numeric.h',
10 './include/Common/spimpl.h',
10 './include/Common/spimpl.h',
11 './include/Common/DateUtils.h',
11 './include/Common/DateUtils.h',
12 './include/Common/MimeTypesDef.h',
12 './include/Common/MimeTypesDef.h',
13 './include/Common/SignalWaiter.h',
13 './include/Common/SignalWaiter.h',
14 './include/Common/deprecate.h',
14 './include/Common/deprecate.h',
15 './include/Common/debug.h',
15 './include/Common/debug.h',
16 './include/Common/MetaTypes.h',
16 './include/Common/MetaTypes.h',
17 './include/Common/cpp_utils.h',
17 './include/Common/cpp_utils.h',
18 './include/Common/SortUtils.h',
18 './include/Common/SortUtils.h',
19 './include/Data/DataSeries.h',
20 './include/Data/DataSeriesIterator.h',
21 './include/Data/DateTimeRangeHelper.h',
19 './include/Data/DateTimeRangeHelper.h',
22 './include/Data/SpectrogramSeries.h',
20 './include/Data/ScalarTimeSerie.h',
23 './include/Data/DateTimeRange.h',
21 './include/Data/DateTimeRange.h',
24 './include/Data/VectorSeries.h',
25 './include/Data/DataProviderParameters.h',
22 './include/Data/DataProviderParameters.h',
26 './include/Data/ArrayData.h',
23 './include/Data/VectorTimeSerie.h',
27 './include/Data/Unit.h',
28 './include/Data/ScalarSeries.h',
29 './include/Data/SqpIterator.h',
24 './include/Data/SqpIterator.h',
30 './include/Data/IDataProvider.h',
25 './include/Data/IDataProvider.h',
31 './include/Data/DataSeriesUtils.h',
26 './include/Data/SpectrogramTimeSerie.h',
32 './include/Data/OptionalAxis.h',
33 './include/Data/IDataSeries.h',
34 './include/Data/DataSeriesType.h',
27 './include/Data/DataSeriesType.h',
35 './include/Data/ArrayDataIterator.h',
36 './include/Data/DataSeriesMergeHelper.h',
37 './include/CoreGlobal.h',
28 './include/CoreGlobal.h',
38 './include/Network/NetworkController.h',
29 './include/Network/NetworkController.h',
39 './include/Network/Response.h',
30 './include/Network/Response.h',
40 './include/Network/Downloader.h',
31 './include/Network/Downloader.h',
41 './include/Settings/SqpSettingsDefs.h',
32 './include/Settings/SqpSettingsDefs.h',
42 './include/Settings/ISqpSettingsBindable.h',
33 './include/Settings/ISqpSettingsBindable.h',
43 './include/DataSource/DataSourceController.h',
34 './include/DataSource/DataSourceController.h',
44 './include/DataSource/DataSourceItem.h',
35 './include/DataSource/DataSourceItem.h',
45 './include/DataSource/DataSourceItemAction.h',
36 './include/DataSource/DataSourceItemAction.h',
46 './include/DataSource/DataSourceItemMergeHelper.h',
37 './include/DataSource/DataSourceItemMergeHelper.h',
47 './include/Time/TimeController.h',
38 './include/Time/TimeController.h',
48 './include/PluginManager/PluginManager.h',
39 './include/PluginManager/PluginManager.h',
49 './include/Version.h',
40 './include/Version.h',
50 './include/Catalogue/CatalogueController.h',
41 './include/Catalogue/CatalogueController.h',
51 './include/Plugin/IPlugin.h',
42 './include/Plugin/IPlugin.h',
52 './include/Variable/VariableModel2.h',
43 './include/Variable/VariableModel2.h',
53 './include/Variable/Variable.h',
54 './include/Variable/VariableCacheStrategy.h',
55 './include/Variable/VariableController2.h',
44 './include/Variable/VariableController2.h',
56 './include/Variable/VariableCacheStrategyFactory.h',
45 './include/Variable/Variable2.h',
57 './include/Variable/VariableSynchronizationGroup2.h',
46 './include/Variable/VariableSynchronizationGroup2.h',
58 './include/Variable/ProportionalCacheStrategy.h',
59 './include/Variable/private/VCTransaction.h',
47 './include/Variable/private/VCTransaction.h',
60 './include/Variable/SingleThresholdCacheStrategy.h',
48 './include/Visualization/VisualizationController.h']
61 './include/Visualization/VisualizationController.h'
62 ]
63
49
64
50
65 core_moc_sources = ['src/Network/Downloader.cpp']
51 core_moc_sources = ['src/Network/Downloader.cpp']
66
52
67
53
68 core_moc_files = qt5.preprocess(moc_headers : core_moc_headers, moc_sources: core_moc_sources)
54 core_moc_files = qt5.preprocess(moc_headers : core_moc_headers, moc_sources: core_moc_sources)
69
55
70 core_sources = [
56 core_sources = [
71 './src/Common/MimeTypesDef.cpp',
57 './src/Common/MimeTypesDef.cpp',
72 './src/Common/SignalWaiter.cpp',
58 './src/Common/SignalWaiter.cpp',
73 './src/Common/DateUtils.cpp',
59 './src/Common/DateUtils.cpp',
74 './src/Common/StringUtils.cpp',
60 './src/Common/StringUtils.cpp',
75 './src/Data/VectorSeries.cpp',
76 './src/Data/ScalarSeries.cpp',
77 './src/Data/OptionalAxis.cpp',
78 './src/Data/DataSeriesIterator.cpp',
79 './src/Data/SpectrogramSeries.cpp',
80 './src/Data/ArrayDataIterator.cpp',
81 './src/Data/DataSeriesUtils.cpp',
82 './src/Network/Downloader.cpp',
61 './src/Network/Downloader.cpp',
83 './src/Network/NetworkController.cpp',
62 './src/Network/NetworkController.cpp',
84 './src/Settings/SqpSettingsDefs.cpp',
63 './src/Settings/SqpSettingsDefs.cpp',
85 './src/DataSource/DataSourceItemAction.cpp',
64 './src/DataSource/DataSourceItemAction.cpp',
86 './src/DataSource/DataSourceItemMergeHelper.cpp',
65 './src/DataSource/DataSourceItemMergeHelper.cpp',
87 './src/DataSource/DataSourceItem.cpp',
66 './src/DataSource/DataSourceItem.cpp',
88 './src/DataSource/DataSourceController.cpp',
67 './src/DataSource/DataSourceController.cpp',
89 './src/Time/TimeController.cpp',
68 './src/Time/TimeController.cpp',
90 './src/PluginManager/PluginManager.cpp',
69 './src/PluginManager/PluginManager.cpp',
91 './src/pybind11_wrappers/CatalogWrappers.cpp',
92 #'./src/pybind11_wrappers/QtWrappers.cpp',
93 #'./src/pybind11_wrappers/CoreWrappers.cpp',
94 './src/Version.cpp',
70 './src/Version.cpp',
95 './src/Catalogue/CatalogueController.cpp',
71 './src/Catalogue/CatalogueController.cpp',
96 './src/Variable/Variable.cpp',
97 './src/Variable/VariableSynchronizationGroup2.cpp',
72 './src/Variable/VariableSynchronizationGroup2.cpp',
73 './src/Variable/Variable2.cpp',
98 './src/Variable/VariableController2.cpp',
74 './src/Variable/VariableController2.cpp',
99 './src/Variable/VariableModel2.cpp',
75 './src/Variable/VariableModel2.cpp',
100 './src/Visualization/VisualizationController.cpp']
76 './src/Visualization/VisualizationController.cpp']
101
77
102
78
103 core_inc = include_directories(['include', 'include/Plugin'])
79 core_inc = include_directories(['include', 'include/Plugin'])
104
80
105 sciqlop_core_lib = library('sciqlopcore',
81 sciqlop_core_lib = library('sciqlopcore',
106 core_sources,
82 core_sources,
107 core_moc_files,
83 core_moc_files,
108 cpp_args : '-DCORE_LIB',
84 cpp_args : '-DCORE_LIB',
109 include_directories : core_inc,
85 include_directories : core_inc,
110 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep],
86 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep, timeseries_dep],
111 install : true
87 install : true
112 )
88 )
113
89
114
90
115 sciqlop_core = declare_dependency(link_with : sciqlop_core_lib,
91 sciqlop_core = declare_dependency(link_with : sciqlop_core_lib,
116 include_directories : core_inc,
92 include_directories : core_inc,
117 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep])
93 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep, timeseries_dep])
118
94
119
95
96 [
97 './src/pybind11_wrappers/CatalogWrappers.cpp',
98 './src/pybind11_wrappers/QtWrappers.cpp',
99 './src/pybind11_wrappers/CoreWrappers.cpp'
100 ]
101
120
102
121 subdir('tests')
103 subdir('tests')
122
104
@@ -1,137 +1,154
1 #include <PluginManager/PluginManager.h>
1 #include <PluginManager/PluginManager.h>
2
2
3 #include <Plugin/IPlugin.h>
3 #include <Plugin/IPlugin.h>
4
4
5 #include <QDir>
5 #include <QDir>
6 #include <QLibrary>
6 #include <QLibrary>
7 #include <QPluginLoader>
7 #include <QPluginLoader>
8
8
9 Q_LOGGING_CATEGORY(LOG_PluginManager, "PluginManager")
9 Q_LOGGING_CATEGORY(LOG_PluginManager, "PluginManager")
10
10
11 namespace {
11 namespace {
12
12
13 /// Key for retrieving metadata of the plugin
13 /// Key for retrieving metadata of the plugin
14 const auto PLUGIN_METADATA_KEY = QStringLiteral("MetaData");
14 const auto PLUGIN_METADATA_KEY = QStringLiteral("MetaData");
15
15
16 /// Key for retrieving the name of the plugin in its metadata
16 /// Key for retrieving the name of the plugin in its metadata
17 const auto PLUGIN_NAME_KEY = QStringLiteral("name");
17 const auto PLUGIN_NAME_KEY = QStringLiteral("name");
18
18
19 /// Helper to state the plugin loading operation
19 /// Helper to state the plugin loading operation
20 struct LoadPluginState {
20 struct LoadPluginState {
21 explicit LoadPluginState(const QString &pluginPath)
21 explicit LoadPluginState(const QString &pluginPath)
22 : m_PluginPath{pluginPath}, m_Valid{true}, m_ErrorMessage{}
22 : m_PluginPath{pluginPath}, m_Valid{true}, m_ErrorMessage{}
23 {
23 {
24 }
24 }
25
25
26 void log() const
26 void log() const
27 {
27 {
28 if (m_Valid) {
28 if (m_Valid) {
29 qCDebug(LOG_PluginManager())
29 qCDebug(LOG_PluginManager())
30 << QObject::tr("File '%1' has been loaded as a plugin").arg(m_PluginPath);
30 << QObject::tr("File '%1' has been loaded as a plugin").arg(m_PluginPath);
31 }
31 }
32 else {
32 else {
33 qCWarning(LOG_PluginManager())
33 qCWarning(LOG_PluginManager())
34 << QObject::tr("File '%1' can't be loaded as a plugin: %2")
34 << QObject::tr("File '%1' can't be loaded as a plugin: %2")
35 .arg(m_PluginPath)
35 .arg(m_PluginPath)
36 .arg(m_ErrorMessage);
36 .arg(m_ErrorMessage);
37 }
37 }
38 }
38 }
39
39
40 void setError(const QString &errorMessage)
40 void setError(const QString &errorMessage)
41 {
41 {
42 m_Valid = false;
42 m_Valid = false;
43 m_ErrorMessage = errorMessage;
43 m_ErrorMessage = errorMessage;
44 }
44 }
45
45
46 QString m_PluginPath;
46 QString m_PluginPath;
47 bool m_Valid;
47 bool m_Valid;
48 QString m_ErrorMessage;
48 QString m_ErrorMessage;
49 };
49 };
50
50
51 } // namespace
51 } // namespace
52
52
53 struct PluginManager::PluginManagerPrivate {
53 struct PluginManager::PluginManagerPrivate {
54 /**
54 /**
55 * Loads a single plugin into SciQlop. The method has no effect if the plugin is malformed (e.g.
55 * Loads a single plugin into SciQlop. The method has no effect if the plugin is malformed (e.g.
56 * wrong library type, missing metadata, etc.)
56 * wrong library type, missing metadata, etc.)
57 * @param pluginPath the path to the plugin library.
57 * @param pluginPath the path to the plugin library.
58 */
58 */
59 void loadPlugin(const QString &pluginPath)
59 void loadPlugin(const QString &pluginPath)
60 {
60 {
61 qCDebug(LOG_PluginManager())
61 qCDebug(LOG_PluginManager())
62 << QObject::tr("Attempting to load file '%1' as a plugin").arg(pluginPath);
62 << QObject::tr("Attempting to load file '%1' as a plugin").arg(pluginPath);
63
63
64 LoadPluginState loadState{pluginPath};
64 LoadPluginState loadState{pluginPath};
65
65
66 if (QLibrary::isLibrary(pluginPath)) {
66 if (QLibrary::isLibrary(pluginPath)) {
67 QPluginLoader pluginLoader{pluginPath};
67 QPluginLoader pluginLoader{pluginPath};
68
68
69 // Retrieving the plugin name to check if it can be loaded (i.e. no plugin with the same
69 // Retrieving the plugin name to check if it can be loaded (i.e. no plugin with the same
70 // name has been registered yet)
70 // name has been registered yet)
71 auto metadata = pluginLoader.metaData().value(PLUGIN_METADATA_KEY).toObject();
71 auto metadata = pluginLoader.metaData().value(PLUGIN_METADATA_KEY).toObject();
72 auto pluginName = metadata.value(PLUGIN_NAME_KEY).toString();
72 auto pluginName = metadata.value(PLUGIN_NAME_KEY).toString();
73
73
74 if (pluginName.isEmpty()) {
74 if (pluginName.isEmpty()) {
75 loadState.setError(QObject::tr("empty file name"));
75 loadState.setError(QObject::tr("empty file name"));
76 }
76 }
77 else if (m_RegisteredPlugins.contains(pluginName)) {
77 else if (m_RegisteredPlugins.contains(pluginName)) {
78 loadState.setError(QObject::tr("name '%1' already registered").arg(pluginName));
78 loadState.setError(QObject::tr("name '%1' already registered").arg(pluginName));
79 }
79 }
80 else {
80 else {
81 if (auto pluginInstance = qobject_cast<IPlugin *>(pluginLoader.instance())) {
81 if (auto plugin = pluginLoader.instance()) {
82 pluginInstance->initialize();
82 qobject_cast<IPlugin *>(plugin)->initialize();
83 m_RegisteredPlugins.insert(pluginName, pluginPath);
83 m_RegisteredPlugins.insert(pluginName, pluginPath);
84 m_LoadedPlugins.insert(pluginName, plugin);
84 }
85 }
85 else {
86 else {
86 loadState.setError(QObject::tr("the file is not a Sciqlop plugin"));
87 loadState.setError(QObject::tr("the file is not a Sciqlop plugin"));
87 }
88 }
88 }
89 }
89 }
90 }
90 else {
91 else {
91 loadState.setError(QObject::tr("the file is not a library"));
92 loadState.setError(QObject::tr("the file is not a library"));
92 }
93 }
93
94
94 // Log loading result
95 // Log loading result
95 loadState.log();
96 loadState.log();
96 }
97 }
97
98
98 void loadStaticPlugins()
99 void loadStaticPlugins()
99 {
100 {
100 for (QObject *plugin : QPluginLoader::staticInstances()) {
101 for (QObject *plugin : QPluginLoader::staticInstances()) {
101 qobject_cast<IPlugin *>(plugin)->initialize();
102 qobject_cast<IPlugin *>(plugin)->initialize();
102 m_RegisteredPlugins.insert(plugin->metaObject()->className(), "StaticPlugin");
103 m_RegisteredPlugins.insert(plugin->metaObject()->className(), "StaticPlugin");
104 m_LoadedPlugins.insert(plugin->metaObject()->className(), plugin);
103 }
105 }
104 }
106 }
107 void clearAllPlugins()
108 {
109 for(auto plugin:m_LoadedPlugins)
110 {
111 delete plugin;
112 }
113 m_LoadedPlugins.clear();
114 m_RegisteredPlugins.clear();
115 }
105
116
106 /// Registered plugins (key: plugin name, value: plugin path)
117 /// Registered plugins (key: plugin name, value: plugin path)
107 QHash<QString, QString> m_RegisteredPlugins;
118 QHash<QString, QString> m_RegisteredPlugins;
119 QHash<QString,QObject*> m_LoadedPlugins;
108 };
120 };
109
121
110 PluginManager::PluginManager() : impl{spimpl::make_unique_impl<PluginManagerPrivate>()}
122 PluginManager::PluginManager() : impl{spimpl::make_unique_impl<PluginManagerPrivate>()}
111 {
123 {
112 }
124 }
113
125
126 PluginManager::~PluginManager()
127 {
128 impl->clearAllPlugins();
129 }
130
114 void PluginManager::loadPlugins(const QDir &pluginDir)
131 void PluginManager::loadPlugins(const QDir &pluginDir)
115 {
132 {
116 // Load plugins
133 // Load plugins
117 auto pluginInfoList
134 auto pluginInfoList
118 = pluginDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
135 = pluginDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
119 for (auto entryInfo : qAsConst(pluginInfoList)) {
136 for (auto entryInfo : qAsConst(pluginInfoList)) {
120 if (entryInfo.isDir()) {
137 if (entryInfo.isDir()) {
121 this->loadPlugins(QDir{entryInfo.absoluteFilePath()});
138 this->loadPlugins(QDir{entryInfo.absoluteFilePath()});
122 }
139 }
123 else if (QLibrary::isLibrary(entryInfo.absoluteFilePath())) {
140 else if (QLibrary::isLibrary(entryInfo.absoluteFilePath())) {
124 impl->loadPlugin(entryInfo.absoluteFilePath());
141 impl->loadPlugin(entryInfo.absoluteFilePath());
125 }
142 }
126 }
143 }
127 }
144 }
128
145
129 void PluginManager::loadStaticPlugins()
146 void PluginManager::loadStaticPlugins()
130 {
147 {
131 impl->loadStaticPlugins();
148 impl->loadStaticPlugins();
132 }
149 }
133
150
134 int PluginManager::nbPluginsLoaded() const noexcept
151 int PluginManager::nbPluginsLoaded() const noexcept
135 {
152 {
136 return impl->m_RegisteredPlugins.size();
153 return impl->m_RegisteredPlugins.size();
137 }
154 }
@@ -1,135 +1,83
1 TestUtils = library('TestUtils', 'TestUtils/TestProviders.h', 'TestUtils/TestProviders.cpp',
1 TestUtils = library('TestUtils', 'TestUtils/TestProviders.h', 'TestUtils/TestProviders.cpp',
2 dependencies : [sciqlop_core, qt5test]
2 dependencies : [sciqlop_core, qt5test]
3 )
3 )
4
4
5
5
6 TestUtils_dep = declare_dependency(link_with : TestUtils,
6 TestUtils_dep = declare_dependency(link_with : TestUtils,
7 dependencies : [sciqlop_core, qt5test])
7 dependencies : [sciqlop_core, qt5test])
8
8
9
9
10 DataSeriesTestsUtils = library('DataSeriesTestsUtils', 'Data/DataSeriesBuilders.h', 'Data/DataSeriesBuilders.cpp',
11 'Data/DataSeriesTestsUtils.h',
12 'Data/DataSeriesTestsUtils.cpp',
13 dependencies : [sciqlop_core, qt5test]
14 )
15
16
17 DataSeriesTestsUtils_dep = declare_dependency(link_with : DataSeriesTestsUtils,
18 dependencies : [sciqlop_core, qt5test])
19
20
21
10
22 tests = [
11 tests = [
23 {
12 {
24 'name':'TestStringUtils',
13 'name':'TestStringUtils',
25 'sources': ['Common/TestStringUtils.cpp'],
14 'sources': ['Common/TestStringUtils.cpp'],
26 'deps': [sciqlop_core, qt5test]
15 'deps': [sciqlop_core, qt5test]
27 },
16 },
28 {
17 {
29 'name':'TestContainers',
18 'name':'TestContainers',
30 'sources': ['Common/TestContainers.cpp'],
19 'sources': ['Common/TestContainers.cpp'],
31 'deps': [sciqlop_core, qt5test]
20 'deps': [sciqlop_core, qt5test]
32 },
21 },
33 {
22 {
34 'name':'TestSyncGroup',
23 'name':'TestSyncGroup',
35 'sources': ['Variable/TestSyncGroup.cpp'],
24 'sources': ['Variable/TestSyncGroup.cpp'],
36 'deps': [sciqlop_core, qt5test]
25 'deps': [sciqlop_core, qt5test]
37 },
26 },
38 {
27 {
39 'name':'TestDateTimeRange',
28 'name':'TestDateTimeRange',
40 'sources': ['Data/TestDateTimeRange.cpp'],
29 'sources': ['Data/TestDateTimeRange.cpp'],
41 'deps': [sciqlop_core, qt5test]
30 'deps': [sciqlop_core, qt5test]
42 },
31 },
43 {
32 {
44 'name':'TestDataSeriesUtils',
45 'sources': ['Data/TestDataSeriesUtils.cpp'],
46 'deps': [sciqlop_core, qt5test]
47 },
48 {
49 'name':'TestOptionalAxis',
50 'sources': ['Data/TestOptionalAxis.cpp'],
51 'deps': [sciqlop_core, qt5test]
52 },
53 {
54 'name':'TestSpectrogramSeries',
55 'sources': [
56 'Data/TestSpectrogramSeries.cpp',
57 ],
58 'deps': [sciqlop_core, qt5test, DataSeriesTestsUtils_dep]
59 },
60 {
61 'name':'TestOneDimArrayData',
62 'sources': ['Data/TestOneDimArrayData.cpp'],
63 'deps': [sciqlop_core, qt5test]
64 },
65 {
66 'name':'TestScalarSeries',
67 'sources': [
68 'Data/TestScalarSeries.cpp',
69 ],
70 'deps': [sciqlop_core, qt5test, DataSeriesTestsUtils_dep]
71 },
72 {
73 'name':'TestTwoDimArrayData',
74 'sources': ['Data/TestTwoDimArrayData.cpp'],
75 'deps': [sciqlop_core, qt5test]
76 },
77 {
78 'name':'TestVectorSeries',
79 'sources': [
80 'Data/TestVectorSeries.cpp',
81 ],
82 'deps': [sciqlop_core, qt5test, DataSeriesTestsUtils_dep]
83 },
84 {
85 'name':'TestDataSourceController',
33 'name':'TestDataSourceController',
86 'sources': [
34 'sources': [
87 'DataSource/TestDataSourceController.cpp',
35 'DataSource/TestDataSourceController.cpp',
88 'DataSource/DataSourceItemBuilder.cpp'
36 'DataSource/DataSourceItemBuilder.cpp'
89 ],
37 ],
90 'deps': [sciqlop_core, qt5test]
38 'deps': [sciqlop_core, qt5test]
91 },
39 },
92 {
40 {
93 'name':'TestDataSourceItem',
41 'name':'TestDataSourceItem',
94 'sources': [
42 'sources': [
95 'DataSource/TestDataSourceItem.cpp',
43 'DataSource/TestDataSourceItem.cpp',
96 'DataSource/DataSourceItemBuilder.cpp'
44 'DataSource/DataSourceItemBuilder.cpp'
97 ],
45 ],
98 'deps': [sciqlop_core, qt5test]
46 'deps': [sciqlop_core, qt5test]
99 },
47 },
100 {
48 {
101 'name':'TestVariable',
49 'name':'TestVariable',
102 'sources': ['Variable/TestVariable.cpp'],
50 'sources': ['Variable/TestVariable.cpp'],
103 'deps': [sciqlop_core, qt5test]
51 'deps': [sciqlop_core, qt5test]
104 },
52 },
105 {
53 {
106 'name':'TestDownloader',
54 'name':'TestDownloader',
107 'sources': ['Network/TestDownloader.cpp'],
55 'sources': ['Network/TestDownloader.cpp'],
108 'deps': [sciqlop_core, qt5test, qt5Concurrent]
56 'deps': [sciqlop_core, qt5test, qt5Concurrent]
109 },
57 },
110 {
58 {
111 'name':'TestVariableController2',
59 'name':'TestVariableController2',
112 'sources': ['Variable/TestVariableController2.cpp'],
60 'sources': ['Variable/TestVariableController2.cpp'],
113 'deps': [sciqlop_core, qt5test, qt5Concurrent, TestUtils_dep]
61 'deps': [sciqlop_core, qt5test, qt5Concurrent, TestUtils_dep]
114 },
62 },
115 {
63 {
116 'name':'TestVariableController2Async',
64 'name':'TestVariableController2Async',
117 'sources': ['Variable/TestVariableController2Async.cpp'],
65 'sources': ['Variable/TestVariableController2Async.cpp'],
118 'deps': [sciqlop_core, qt5test, qt5Concurrent, TestUtils_dep]
66 'deps': [sciqlop_core, qt5test, qt5Concurrent, TestUtils_dep]
119 },
67 },
120 {
68 {
121 'name':'TestVariableController2WithSync',
69 'name':'TestVariableController2WithSync',
122 'sources': ['Variable/TestVariableController2WithSync.cpp'],
70 'sources': ['Variable/TestVariableController2WithSync.cpp'],
123 'deps': [sciqlop_core, qt5test, qt5Concurrent, TestUtils_dep]
71 'deps': [sciqlop_core, qt5test, qt5Concurrent, TestUtils_dep]
124 }
72 }
125 ]
73 ]
126
74
127 foreach unit_test : tests
75 foreach unit_test : tests
128 test_moc_files = qt5.preprocess(moc_sources : unit_test['sources'])
76 test_moc_files = qt5.preprocess(moc_sources : unit_test['sources'])
129 test_exe = executable(unit_test['name'],unit_test['sources'] , test_moc_files,
77 test_exe = executable(unit_test['name'],unit_test['sources'] , test_moc_files,
130 dependencies : unit_test['deps'],
78 dependencies : unit_test['deps'],
131 cpp_args : ['-DCORE_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/../tests-resources"']
79 cpp_args : ['-DCORE_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/../tests-resources"']
132 )
80 )
133 test('Test-' + unit_test['name'], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test['name'])])
81 test('Test-' + unit_test['name'], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test['name'])])
134 endforeach
82 endforeach
135
83
General Comments 0
You need to be logged in to leave comments. Login now