Skip to content

Commit 3a2da60

Browse files
Fix false positive memleak detection and extend CI (#12)
1 parent 63c0ffc commit 3a2da60

File tree

8 files changed

+85
-46
lines changed

8 files changed

+85
-46
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Build and Test
22

33
on:
4+
workflow_dispatch:
5+
inputs:
6+
opendaq_ref:
7+
description: "openDAQ SDK commit, branch or tag"
8+
required: false
9+
default: ""
410
pull_request:
511
types: [opened, reopened, synchronize, ready_for_review]
612

@@ -12,8 +18,16 @@ jobs:
1218
include:
1319
- os: ubuntu-latest
1420
generator: Ninja
21+
build_type: Debug
1522
- os: windows-latest
1623
generator: "Visual Studio 17 2022"
24+
build_type: Debug
25+
- os: ubuntu-latest
26+
generator: Ninja
27+
build_type: Release
28+
- os: windows-latest
29+
generator: "Visual Studio 17 2022"
30+
build_type: Release
1731

1832
runs-on: ${{ matrix.os }}
1933

@@ -28,11 +42,15 @@ jobs:
2842
with:
2943
ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }}
3044

45+
- name: Overwrite opendaq_ref
46+
if: ${{ github.event.inputs.opendaq_ref != '' }}
47+
run: echo "${{ github.event.inputs.opendaq_ref }}" > opendaq_ref
48+
3149
- name: Configure project with CMake
32-
run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_MQTT_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
50+
run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_MQTT_ENABLE_TESTS=ON -DDAQMODULES_MQTT_DEBUG_WARNINGS_AS_ERRORS=ON -DOPENDAQ_DEBUG_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}"
3351

3452
- name: Build project with CMake
35-
run: cmake --build build/output --config Debug
53+
run: cmake --build build/output --config "${{ matrix.build_type }}"
3654

3755
- name: Install and run mosquitto Linux
3856
if: matrix.os == 'ubuntu-latest'
@@ -41,17 +59,25 @@ jobs:
4159
4260
- name: Run project tests with CMake
4361
if: matrix.os == 'ubuntu-latest'
44-
run: ctest --test-dir build/output --output-on-failure -C Debug
45-
62+
run: ctest --test-dir build/output --output-on-failure -C "${{ matrix.build_type }}"
63+
4664
install-build-and-test:
4765
strategy:
4866
fail-fast: false
4967
matrix:
5068
include:
5169
- os: ubuntu-latest
5270
generator: Ninja
71+
build_type: Debug
5372
- os: windows-latest
5473
generator: "Visual Studio 17 2022"
74+
build_type: Debug
75+
- os: ubuntu-latest
76+
generator: Ninja
77+
build_type: Release
78+
- os: windows-latest
79+
generator: "Visual Studio 17 2022"
80+
build_type: Release
5581

5682
runs-on: ${{ matrix.os }}
5783
env:
@@ -69,6 +95,11 @@ jobs:
6995
ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }}
7096
path: module
7197

98+
- name: Overwrite opendaq_ref
99+
if: ${{ github.event.inputs.opendaq_ref != '' }}
100+
working-directory: module
101+
run: echo "${{ github.event.inputs.opendaq_ref }}" > opendaq_ref
102+
72103
- name: Read openDAQ version
73104
shell: bash
74105
working-directory: module
@@ -86,28 +117,28 @@ jobs:
86117
- name: Configure, build and install openDAQ
87118
working-directory: opendaq
88119
run: |
89-
cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_PREFIX }}"
90-
cmake --build build/output --config Release
91-
cmake --install build/output --config Release
120+
cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_PREFIX }}"
121+
cmake --build build/output --config "${{ matrix.build_type }}"
122+
cmake --install build/output --config "${{ matrix.build_type }}"
92123
93124
- name: Add DLL path (Windows only)
94125
if: matrix.os == 'windows-latest'
95126
run: echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH
96127

97128
- name: Configure project with CMake
98129
working-directory: module
99-
run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_MQTT_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/"
130+
run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_MQTT_ENABLE_TESTS=ON -DDAQMODULES_MQTT_DEBUG_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/"
100131

101132
- name: Build project with CMake
102133
working-directory: module
103-
run: cmake --build build/output --config Release
134+
run: cmake --build build/output --config "${{ matrix.build_type }}"
104135

105136
- name: Install and run mosquitto Linux
106137
if: matrix.os == 'ubuntu-latest'
107138
run: |
108139
sudo apt-get install -y --no-install-recommends mosquitto
109-
140+
110141
- name: Run project tests with CMake
111142
if: matrix.os == 'ubuntu-latest'
112143
working-directory: module
113-
run: ctest --test-dir build/output --output-on-failure -C Release
144+
run: ctest --test-dir build/output --output-on-failure -C "${{ matrix.build_type }}"

modules/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
cmake_minimum_required(VERSION 3.25)
22
opendaq_set_cmake_folder_context(TARGET_FOLDER_NAME)
33

4+
if (MSVC)
5+
add_compile_options(/wd4100)
6+
endif()
7+
48
add_subdirectory(mqtt_streaming_module)

modules/mqtt_streaming_module/include/mqtt_streaming_module/atomic_signal_atomic_sample_handler.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <opendaq/function_block_ptr.h>
2020
#include <mqtt_streaming_module/handler_base.h>
21+
#include <set>
2122

2223
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2324

@@ -41,6 +42,18 @@ class AtomicSignalAtomicSampleHandler : public HandlerBase
4142
MqttDataSample processDataPacket(SignalContext& signalContext, const DataPacketPtr& dataPacket, size_t offset);
4243
std::string toString(const std::string valueFieldName, daq::DataPacketPtr packet, size_t offset);
4344
std::string buildTopicName(const SignalContext& signalContext);
45+
46+
47+
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
48+
SampleType::Float32,
49+
SampleType::UInt8,
50+
SampleType::Int8,
51+
SampleType::UInt16,
52+
SampleType::Int16,
53+
SampleType::UInt32,
54+
SampleType::Int32,
55+
SampleType::UInt64,
56+
SampleType::Int64};
4457
};
4558

4659
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

modules/mqtt_streaming_module/include/mqtt_streaming_module/group_signal_shared_ts_handler.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <opendaq/function_block_ptr.h>
2020
#include <mqtt_streaming_module/handler_base.h>
2121
#include <opendaq/multi_reader_ptr.h>
22+
#include <set>
2223

2324
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2425

@@ -70,6 +71,18 @@ class GroupSignalSharedTsHandler : public HandlerBase
7071
static std::string messageFromFields(const std::vector<std::string>& fields);
7172
static TimestampTickStruct domainToTs(const MultiReaderStatusPtr status);
7273
bool processEvents(const daq::MultiReaderStatusPtr& status); // true if descriptor changed or invalid reader
74+
75+
76+
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
77+
SampleType::Float32,
78+
SampleType::UInt8,
79+
SampleType::Int8,
80+
SampleType::UInt16,
81+
SampleType::Int16,
82+
SampleType::UInt32,
83+
SampleType::Int32,
84+
SampleType::UInt64,
85+
SampleType::Int64};
7386
};
7487

7588
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

modules/mqtt_streaming_module/include/mqtt_streaming_module/signal_arr_atomic_sample_handler.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <opendaq/function_block_ptr.h>
2020
#include <mqtt_streaming_module/handler_base.h>
2121
#include <opendaq/multi_reader_ptr.h>
22+
#include <set>
2223

2324
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2425

@@ -39,6 +40,18 @@ class SignalArrayAtomicSampleHandler : public HandlerBase
3940
std::string toString(const std::string valueFieldName, daq::DataPacketPtr packet);
4041
std::string buildTopicName();
4142
static std::string messageFromArray(const std::vector<std::string>& array);
43+
44+
45+
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
46+
SampleType::Float32,
47+
SampleType::UInt8,
48+
SampleType::Int8,
49+
SampleType::UInt16,
50+
SampleType::Int16,
51+
SampleType::UInt32,
52+
SampleType::Int32,
53+
SampleType::UInt64,
54+
SampleType::Int64};
4255
};
4356

4457
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

modules/mqtt_streaming_module/src/atomic_signal_atomic_sample_handler.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <opendaq/event_packet_params.h>
55
#include <opendaq/event_packet_ptr.h>
66
#include <opendaq/sample_type_traits.h>
7-
#include <set>
87

98
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
109

@@ -26,16 +25,6 @@ MqttData AtomicSignalAtomicSampleHandler::processSignalContexts(std::vector<Sign
2625

2726
ProcedureStatus AtomicSignalAtomicSampleHandler::validateSignalContexts(const std::vector<SignalContext>& signalContexts) const
2827
{
29-
static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
30-
SampleType::Float32,
31-
SampleType::UInt8,
32-
SampleType::Int8,
33-
SampleType::UInt16,
34-
SampleType::Int16,
35-
SampleType::UInt32,
36-
SampleType::Int32,
37-
SampleType::UInt64,
38-
SampleType::Int64};
3928
ProcedureStatus status{true, {}};
4029
for (const auto& sigCtx : signalContexts)
4130
{

modules/mqtt_streaming_module/src/group_signal_shared_ts_handler.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <opendaq/reader_utils.h>
88
#include <opendaq/sample_type_traits.h>
99
#include <optional>
10-
#include <set>
1110

1211
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
1312

@@ -64,17 +63,6 @@ MqttData GroupSignalSharedTsHandler::processSignalContexts(std::vector<SignalCon
6463

6564
ProcedureStatus GroupSignalSharedTsHandler::validateSignalContexts(const std::vector<SignalContext>& signalContexts) const
6665
{
67-
68-
static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
69-
SampleType::Float32,
70-
SampleType::UInt8,
71-
SampleType::Int8,
72-
SampleType::UInt16,
73-
SampleType::Int16,
74-
SampleType::UInt32,
75-
SampleType::Int32,
76-
SampleType::UInt64,
77-
SampleType::Int64};
7866
ProcedureStatus status{true, {}};
7967
for (const auto& sigCtx : signalContexts)
8068
{

modules/mqtt_streaming_module/src/signal_arr_atomic_sample_handler.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <opendaq/reader_factory.h>
77
#include <opendaq/reader_utils.h>
88
#include <opendaq/sample_type_traits.h>
9-
#include <set>
109

1110
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
1211

@@ -57,17 +56,6 @@ MqttData SignalArrayAtomicSampleHandler::processSignalContexts(std::vector<Signa
5756

5857
ProcedureStatus SignalArrayAtomicSampleHandler::validateSignalContexts(const std::vector<SignalContext>& signalContexts) const
5958
{
60-
61-
static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
62-
SampleType::Float32,
63-
SampleType::UInt8,
64-
SampleType::Int8,
65-
SampleType::UInt16,
66-
SampleType::Int16,
67-
SampleType::UInt32,
68-
SampleType::Int32,
69-
SampleType::UInt64,
70-
SampleType::Int64};
7159
ProcedureStatus status{true, {}};
7260
for (const auto& sigCtx : signalContexts)
7361
{

0 commit comments

Comments
 (0)