Skip to content

Commit 7bf6b6a

Browse files
author
Aliaksandr Adziareika
committed
Sync build-sdk from main, add diagnostic patch for SkipSamples UB
1 parent c05ee38 commit 7bf6b6a

File tree

3 files changed

+88
-8
lines changed

3 files changed

+88
-8
lines changed

.github/actions/build-sdk/action.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ inputs:
3030
description: 'Run tests after build'
3131
required: false
3232
default: 'false'
33+
ctest-preset:
34+
description: 'CTest preset name'
35+
required: false
36+
default: ''
3337

3438
outputs:
3539
gtest-xml-path:
@@ -59,7 +63,7 @@ runs:
5963
uses: jwlawson/actions-setup-cmake@v2
6064

6165
- name: Install Windows dependencies
62-
if: runner.os == 'Windows'
66+
if: runner.os == 'Windows' && inputs.additional-dependencies != ''
6367
shell: pwsh
6468
run: choco install ${{ inputs.additional-dependencies }} -y --no-progress
6569

@@ -178,16 +182,19 @@ runs:
178182
echo "gtest-xml-path=$GTEST_XML_PATH" >> "$GITHUB_OUTPUT"
179183
180184
CTEST_ARGS=""
185+
if [ -n "${{ inputs.ctest-preset }}" ]; then
186+
CTEST_ARGS="--preset ${{ inputs.ctest-preset }}"
187+
fi
188+
181189
if [ -n "$CMAKE_BUILD_TYPE" ]; then
182-
CTEST_ARGS="--build-config $CMAKE_BUILD_TYPE"
190+
CTEST_ARGS="$CTEST_ARGS --build-config $CMAKE_BUILD_TYPE"
183191
fi
184192
185-
# Use sudo if available (needed for tests requiring elevated privileges)
186193
SUDO_CMD=""
187194
if command -v sudo &> /dev/null; then
188195
SUDO_CMD="sudo -E"
189196
fi
190197
191198
echo "::group::CTest"
192-
$SUDO_CMD ctest --test-dir "$CMAKE_BUILD_PATH" --preset run_tests --output-on-failure $CTEST_ARGS
199+
$SUDO_CMD ctest --test-dir "$CMAKE_BUILD_PATH" --output-on-failure $CTEST_ARGS
193200
echo "::endgroup::"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/core/opendaq/reader/tests/test_stream_reader.cpp b/core/opendaq/reader/tests/test_stream_reader.cpp
2+
index 50c68c0b..b912eea7 100644
3+
--- a/core/opendaq/reader/tests/test_stream_reader.cpp
4+
+++ b/core/opendaq/reader/tests/test_stream_reader.cpp
5+
@@ -1748,16 +1748,20 @@ TYPED_TEST(StreamReaderTest, SkipSamplesOnePacket)
6+
{
7+
for (size_t i = 0; i < 10; ++i)
8+
{
9+
- ASSERT_EQ(firstBatchSamples[i], TypeParam(typename TypeParam::Type(i * 11.1)));
10+
- ASSERT_EQ(secondBatchSamples[i], TypeParam(typename TypeParam::Type((40 + i) * 11.1)));
11+
+ TypeParam expectedFirst = TypeParam(typename TypeParam::Type(i * 11.1));
12+
+ TypeParam expectedSecond = TypeParam(typename TypeParam::Type((40 + i) * 11.1));
13+
+ ASSERT_EQ(firstBatchSamples[i], expectedFirst);
14+
+ ASSERT_EQ(secondBatchSamples[i], expectedSecond);
15+
}
16+
}
17+
else
18+
{
19+
for (size_t i = 0; i < 10; ++i)
20+
{
21+
- ASSERT_EQ(firstBatchSamples[i], (TypeParam)(i * 11.1));
22+
- ASSERT_EQ(secondBatchSamples[i], (TypeParam) ((40 + i) * 11.1));
23+
+ TypeParam expectedFirst = (TypeParam)(i * 11.1);
24+
+ TypeParam expectedSecond = (TypeParam)((40 + i) * 11.1);
25+
+ ASSERT_EQ(firstBatchSamples[i], expectedFirst);
26+
+ ASSERT_EQ(secondBatchSamples[i], expectedSecond);
27+
}
28+
}
29+
}
30+
@@ -1819,16 +1823,20 @@ TYPED_TEST(StreamReaderTest, SkipSamplesBetweenPackets)
31+
{
32+
for (size_t i = 0; i < 10; ++i)
33+
{
34+
- ASSERT_EQ(firstBatchSamples[i], TypeParam(typename TypeParam::Type(i * 11.1)));
35+
- ASSERT_EQ(secondBatchSamples[i], TypeParam(typename TypeParam::Type((40 + i) * 11.1)));
36+
+ TypeParam expectedFirst = TypeParam(typename TypeParam::Type(i * 11.1));
37+
+ TypeParam expectedSecond = TypeParam(typename TypeParam::Type((40 + i) * 11.1));
38+
+ ASSERT_EQ(firstBatchSamples[i], expectedFirst);
39+
+ ASSERT_EQ(secondBatchSamples[i], expectedSecond);
40+
}
41+
}
42+
else
43+
{
44+
for (size_t i = 0; i < 10; ++i)
45+
{
46+
- ASSERT_EQ(firstBatchSamples[i], (TypeParam) (i * 11.1));
47+
- ASSERT_EQ(secondBatchSamples[i], (TypeParam) ((40 + i) * 11.1));
48+
+ TypeParam expectedFirst = (TypeParam)(i * 11.1);
49+
+ TypeParam expectedSecond = (TypeParam)((40 + i) * 11.1);
50+
+ ASSERT_EQ(firstBatchSamples[i], expectedFirst);
51+
+ ASSERT_EQ(secondBatchSamples[i], expectedSecond);
52+
}
53+
}
54+
}

.github/workflows/ci-sandbox.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ jobs:
133133
cmake-generator: ${{ matrix.cmake-generator }}
134134
enable-tests: true
135135
enable-32bit: ${{ matrix.enable-32bit == true }}
136+
ctest-preset: ${{ env.ctest_preset }}
136137

137138
# TODO: Remove this 1 step before merging to openDAQ/openDAQ
138139
- name: Show ccache statistics
@@ -222,6 +223,14 @@ jobs:
222223
shell: bash
223224
run: cp -r _ci-sandbox/.github/actions .github/
224225

226+
- name: Apply patches
227+
if: github.repository != 'openDAQ/openDAQ'
228+
shell: bash
229+
run: |
230+
for patch in _ci-sandbox/.github/patches/*.patch; do
231+
[ -f "$patch" ] && git apply "$patch" && echo "Applied: $patch"
232+
done
233+
225234
- name: Setup ccache
226235
if: ${{ matrix.disable-ccache != true }}
227236
uses: openDAQ/openDAQ-CI-sandbox/.github/actions/ccache-setup@actions/ccache-setup
@@ -241,6 +250,7 @@ jobs:
241250
cmake-config-args: ${{ matrix.cmake-defines }}
242251
cmake-generator: ${{ matrix.cmake-generator }}
243252
enable-tests: true
253+
ctest-preset: ${{ env.ctest_preset }}
244254

245255
# TODO: Remove this 1 step before merging to openDAQ/openDAQ
246256
- name: Show ccache statistics
@@ -273,7 +283,7 @@ jobs:
273283
cmake-generator: Ninja
274284
cmake-build-type: Release
275285
cmake-defines: >-
276-
-DCMAKE_C_COMPILER=clang
286+
-DCMAKE_C_COMPILER=clang
277287
-DCMAKE_CXX_COMPILER=clang++
278288
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
279289
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
@@ -284,8 +294,8 @@ jobs:
284294
cmake-generator: Ninja
285295
cmake-build-type: Release
286296
cmake-defines: >-
287-
-DCMAKE_C_COMPILER=clang
288-
-DCMAKE_CXX_COMPILER=clang++
297+
-DCMAKE_C_COMPILER=clang
298+
-DCMAKE_CXX_COMPILER=clang++
289299
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
290300
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
291301
disable-ccache:
@@ -310,6 +320,14 @@ jobs:
310320
shell: bash
311321
run: cp -r _ci-sandbox/.github/actions .github/
312322

323+
- name: Apply patches
324+
if: github.repository != 'openDAQ/openDAQ'
325+
shell: bash
326+
run: |
327+
for patch in _ci-sandbox/.github/patches/*.patch; do
328+
[ -f "$patch" ] && git apply "$patch" && echo "Applied: $patch"
329+
done
330+
313331
- name: Setup ccache
314332
id: ccache-setup
315333
if: ${{ matrix.disable-ccache != true }}
@@ -354,11 +372,12 @@ jobs:
354372
cmake-config-args: ${{ matrix.cmake-defines }}
355373
cmake-generator: ${{ matrix.cmake-generator }}
356374
enable-tests: true
375+
ctest-preset: ${{ env.ctest_preset }}
357376

358377
# Save ccache on build failure to preserve compilation progress
359378
- name: Save ccache on failure
360379
if: failure() && matrix.disable-ccache != true
361-
uses: actions/cache/save@v4
380+
uses: actions/cache/save@v4q
362381
with:
363382
path: ${{ github.workspace }}/.ccache
364383
key: ${{ steps.ccache-setup.outputs.cache-key }}

0 commit comments

Comments
 (0)