Skip to content

Commit 7103b90

Browse files
christophfroehlichmergify[bot]
authored andcommitted
Use windows CI build (#204)
* Use windows CI build * WIN32 CMake changes * Add CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS * Rename ERROR->FAILURE for win builds (cherry picked from commit 252b136)
1 parent c41dc1d commit 7103b90

File tree

5 files changed

+53
-7
lines changed

5 files changed

+53
-7
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Windows Binary Build
2+
# author: Christoph Fröhlich <[email protected]>
3+
# description: 'Build & test all dependencies from released (binary) windows packages.'
4+
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
branches:
9+
- master
10+
# types:
11+
# - labeled
12+
push:
13+
branches:
14+
- master
15+
# issue_comment:
16+
# types:
17+
# - created
18+
19+
jobs:
20+
binary-windows:
21+
# if: |
22+
# (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/check-windows')) ||
23+
# (github.event_name == 'pull_request' && contains(github.event.label.name, 'check-windows')) ||
24+
# (github.event_name == 'workflow_dispatch')
25+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-ros-tooling-win-build.yml@master
26+
with:
27+
ros_distro: jazzy
28+
ref_for_scheduled_build: master
29+
os_name: windows-2019

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
66
-Werror=return-type -Werror=shadow -Werror=format)
77
endif()
88

9+
if(WIN32)
10+
add_compile_definitions(
11+
# For math constants
12+
_USE_MATH_DEFINES
13+
# Minimize Windows namespace collision
14+
NOMINMAX
15+
WIN32_LEAN_AND_MEAN
16+
)
17+
# set the same behavior for windows as it is on linux
18+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
19+
endif()
20+
921
set(THIS_PACKAGE_INCLUDE_DEPENDS
1022
rclcpp
1123
rclcpp_action

test/realtime_box_tests.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
// POSSIBILITY OF SUCH DAMAGE.
2828

2929
#include <gmock/gmock.h>
30-
#include <realtime_tools/realtime_box.h>
30+
31+
#include <array>
32+
33+
#include "realtime_tools/realtime_box.h"
3134

3235
using realtime_tools::RealtimeBox;
3336

test/test_async_function_handler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ TEST_F(AsyncFunctionHandlerTest, check_triggering_with_different_return_state_an
303303
ASSERT_FALSE(async_class.get_handler().is_trigger_cycle_in_progress());
304304
ASSERT_EQ(async_class.get_counter(), 1);
305305

306-
// Trigger one more cycle to return ERROR at the end of cycle,
306+
// Trigger one more cycle to return FAILURE at the end of cycle,
307307
// so return from this cycle should be last cycle's return
308-
async_class.set_return_state(realtime_tools::return_type::ERROR);
308+
async_class.set_return_state(realtime_tools::return_type::FAILURE);
309309
trigger_status = async_class.trigger();
310310
ASSERT_TRUE(trigger_status.first);
311311
ASSERT_EQ(realtime_tools::return_type::OK, trigger_status.second);
@@ -316,20 +316,22 @@ TEST_F(AsyncFunctionHandlerTest, check_triggering_with_different_return_state_an
316316
ASSERT_EQ(async_class.get_handler().get_last_return_value(), realtime_tools::return_type::OK);
317317
async_class.get_handler().wait_for_trigger_cycle_to_finish();
318318
ASSERT_FALSE(async_class.get_handler().is_trigger_cycle_in_progress());
319-
ASSERT_EQ(async_class.get_handler().get_last_return_value(), realtime_tools::return_type::ERROR);
319+
ASSERT_EQ(
320+
async_class.get_handler().get_last_return_value(), realtime_tools::return_type::FAILURE);
320321
ASSERT_LE(async_class.get_counter(), 2);
321322

322323
// Trigger one more cycle to return DEACTIVATE at the end of cycle,
323324
async_class.set_return_state(realtime_tools::return_type::DEACTIVATE);
324325
trigger_status = async_class.trigger();
325326
ASSERT_TRUE(trigger_status.first);
326-
ASSERT_EQ(realtime_tools::return_type::ERROR, trigger_status.second);
327+
ASSERT_EQ(realtime_tools::return_type::FAILURE, trigger_status.second);
327328
ASSERT_TRUE(async_class.get_handler().is_initialized());
328329
ASSERT_TRUE(async_class.get_handler().is_running());
329330
ASSERT_FALSE(async_class.get_handler().is_stopped());
330331
ASSERT_FALSE(async_class.get_handler().is_stopped());
331332
ASSERT_TRUE(async_class.get_handler().is_trigger_cycle_in_progress());
332-
ASSERT_EQ(async_class.get_handler().get_last_return_value(), realtime_tools::return_type::ERROR);
333+
ASSERT_EQ(
334+
async_class.get_handler().get_last_return_value(), realtime_tools::return_type::FAILURE);
333335
async_class.get_handler().wait_for_trigger_cycle_to_finish();
334336
ASSERT_FALSE(async_class.get_handler().is_trigger_cycle_in_progress());
335337
ASSERT_EQ(

test/test_async_function_handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace realtime_tools
2525
{
2626
enum class return_type : std::uint8_t {
2727
OK = 0,
28-
ERROR = 1,
28+
FAILURE = 1,
2929
DEACTIVATE = 2,
3030
};
3131

0 commit comments

Comments
 (0)