This is just a further check to ensure the test is correct,
and also gets rid of a slew of dead store warnings from
clang static analysis.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Fix that not to deallocate event impl in some failure case
Signed-off-by: Chen Lihui <Lihui.Chen@sony.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
* Fix test memory leaks
1. calling rcutils_string_map_fini to avoid memory leak
2. Fix memory leak that not to call rcutils_string_array_fini for enclaves
3. Fix that not to rcutils_string_array_fini for node_names_2 and node_namespaces_2
4. Fix that not to rcl_log_levels_fini for copied_log_levels
5. Fix that not to call rmw_security_options_fini for options
6. Call test_msgs__srv__BasicTypes_Request__fini for service_request in the end
Signed-off-by: Chen Lihui <Lihui.Chen@sony.com>
* init/shutdown API
* context fini API
* node init/fini API
* guard condition init/fini API
* security APIs
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
* Add deallocate calls to free strdup allocated memory
* Add variables to know if free is required
* Reformat not use extra booleans
* Address peer review comments
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
* Add mimick test for rcl_publisher_get_subscription_count
* Remove const qualifiers
* Add missing mock suffix
* Improve test description
* Add mock test for rcl_publisher_assert_liveliness
* Add class to init publisher tests
* Add test for mocked rmw_publish
* Add mock test for rcl_publish_serialized
* Mock rcutils_string_map_init to make init fail
* Add mock test making rmw_publisher_get_actual_qos fail
* Add class to ease mimick usage
* Reformat tests to use helper class
* Add mocked rcutils_string_map_init to make init fail
* Add tests mocking loaned functions
* Add mock fail tests for publisher_init
* Add publisher fini fail mock tests
* Add nullptr tests
* Update mocking utilities
* Reformat with macro utility
* Add comments for mocked tests
* Check count_size value after test
* Reformat to use constexpr where possible
* Add variable making clear bad param test
* Add link to original file to help tracking changes
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
* Reformat rmw_impl_id_check to call a testable function
* Reformat to expose the function in the public header
* Reformat style return result
* Expose macro names to be tested with the function checker
* Add test for failing cases of the function
* Set error variable and log in the main caller
* Use format string for logging
* Change name of checker function
* Reset rcl error to avoid overwrite
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
* Add test for remap internal functions
* Add function headers
* Make local function public
* Move rcl_remap_copy to public header
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
* Add test context bad_fini
* Add bad name service tests
* Add default case validation result
* Add bad_arg tests rcl_lexer_lookahead2_accept
* Add bad_arg test rcl_trigger_guard_condition
* Add bad arguments events test
* Add message_lost event test
* Disable failing test
* Address peer review comments
* Remove failing test
* Separate non related API tests
* Add comments to explain error causes
* Use test fixture without params
* Replace nullptr with NULL
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
* Add fault injection macros and unit tests to rcl_action
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Addressing feedback
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* PR Fixup
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* PR Fixup
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Fix memory leak in rcl_subscription_init()/rcl_publisher_init() (#794)
* Fix memory leak in rcl_subscription_init()/rcl_publisher_init()
In rcl_subscription_init(), while rmw_subscription_get_actual_qos()
return failure, created rmw subscription handle isn't freed.
In rcl_publisher_init(), while rmw_publisher_get_actual_qos()
return failure, created rmw publisher handle isn't freed.
Signed-off-by: Barry Xu <barry.xu@sony.com>
* Remove codes on the cascading errors.
Signed-off-by: Barry Xu <barry.xu@sony.com>
* Change code style
Signed-off-by: Barry Xu <barry.xu@sony.com>
* Output error message to stderr
Signed-off-by: Barry Xu <barry.xu@sony.com>
* Remove format string
This version of the macro is not available in Foxy.
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
* Print new line
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Co-authored-by: Barry Xu <barry.xu@sony.com>
* Add fault injection macros and unit tests to rcl_lifecycle
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Address feedback
Signed-off-by: Stephen Brawner <brawner@gmail.com>
* PR Fixup
Signed-off-by: Stephen Brawner <brawner@gmail.com>