Skip to content

Conversation

@ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Oct 30, 2020

Increased code coverage and some fixes

Related with this other PR ros2/rmw_cyclonedds#262

Blast545 and others added 30 commits October 30, 2020 10:10
* Add tests for node_options usage
* Add tests for copying options arguments
* Add bad argument tests for wait sets
* Add tests for wait_set_get_allocator function
* Add test for rcl_take_response function
* Change take_request to match take_response without info
* Change specific test for sequence_number
* Add tests for client take failed
* Remove tests already done in nominal setup
* Add bad arguments tests
* Add test for init returning BAD_ALLOC
* Add test for client get_options
* Add test for already init client
* Add bad argument tests
* Add basic test get_default_domain_id
* Add test for rmw to rcl return code function
* Add test for get_localhost_only
* Add tests for localhost expected usage
* Address peer review comments
* Add test for env variable leading to ULONG_MAX
* Change return values to enum in test
* Fix rcl_get_localhost_only return value
* Address peer review comments
* Add unexpected value to get_localhost
* Add reset_rcl_error after expected fails

Signed-off-by: Jorge Perez <[email protected]>
* 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 <[email protected]>
* Add tests not empty names_and_types
* Add tests graph.c module
* Add tests remap basic usage
* Add more tests remap module
* Add tests ini/fini publisher_node
* Refactor style and naming
* Add nullptr bad arg
* Add tests bad args
* Add test bad_alloc
* Add missing source file
* Remove not working test
* Remove extra rcl_reset_error
* Change ASSERT to EXPECT when fini scope
* Add const for const arguments
* Add missing fini parsed arguments
* Add error string to output
* Add invalid usage comments to test
* Fix lint line length issues
* Fix uncrustify lint
* Modify test to save alloc struct
* Remove internal source file
* Remove case requiring internal def

Signed-off-by: Jorge Perez <[email protected]>
* 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 <[email protected]>
* Add bad param tests ini/fini rosout publisher
* Make ini/fini_publisher_for_node public

Signed-off-by: Jorge Perez <[email protected]>
* Add needed extra null check
* Add test for added check
* Add tests for nullptrs

Signed-off-by: Jorge Perez <[email protected]>
This just prevents a memory leak.

Signed-off-by: Chris Lalancette <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Add bomb allocator
* Fix memory checked for error
* Add tests for bad alloc
* Fix break statement
* Add static keyword to methods added

Signed-off-by: Jorge Perez <[email protected]>
* Change allocation method for copied parameter files
* Add bad allocator test

Signed-off-by: Jorge Perez <[email protected]>
* Add tests for fail init
* Add fini tests
* Add tests rcl_take_request_with_info
* Add tests send_response
* Change const strings to constexpr
* Improve test descriptions
* Remove test

Signed-off-by: Jorge Perez <[email protected]>
* Add nullptr tests get_param_files
* Add bad alloc tests
* Add missing tests
* Add bad alloc tests rcl_arguments_copy
* Remove repeated test
* Remove spaces
* Restore erased test
* Relocate test
* Refactor bomb allocator test
* Add missing rcl_reset_error() checks

Signed-off-by: Jorge Perez <[email protected]>
* Add fault injection macros to rcl functions

Signed-off-by: Stephen Brawner <[email protected]>

* PR fixup

Signed-off-by: Stephen Brawner <[email protected]>
* Do not assume allocation will succeed.
* Do not leak allocated memory on failure.

Signed-off-by: Michel Hidalgo <[email protected]>
Within rcl_node_init() implementation.

Signed-off-by: Michel Hidalgo <[email protected]>
* init/shutdown API
* context fini API
* node init/fini API
* guard condition init/fini API
* security APIs

Signed-off-by: Michel Hidalgo <[email protected]>
* Add fix wait.c init/fini allocation on error
* Add test for the fix
* Remove unit tests

Signed-off-by: Jorge Perez <[email protected]>
* Add coverage tests wait module
* Add fault injection test
* Add zero_init allocator test to init
* Remove bomb allocator test
* Add better handling fault injection
* Add comment to fault injection tests
* Move test to another section

Signed-off-by: Jorge Perez <[email protected]>
hidmic and others added 10 commits October 30, 2020 12:35
* 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 <[email protected]>
* Fix that not to deallocate event impl in some failure case

Signed-off-by: Chen Lihui <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
* Fix memory leak because of mock test

Signed-off-by: Chen Lihui <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
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 <[email protected]>
Resolves #814

This is consistent behavior with finalizing other types of zero-initialized objects.

Signed-off-by: Jacob Perron <[email protected]>
* Make sure to always check return values.

Pointed out by clang static analysis, we should always
check these return values.

Signed-off-by: Chris Lalancette <[email protected]>
@ahcorde
Copy link
Contributor Author

ahcorde commented Oct 30, 2020

Compiled up-to rcl and testing rcl:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@ahcorde
Copy link
Contributor Author

ahcorde commented Nov 2, 2020

  • Windows Build Status

clalancette and others added 2 commits November 2, 2020 09:56
This makes it look like a C statement.

Signed-off-by: Chris Lalancette <[email protected]>
@ahcorde
Copy link
Contributor Author

ahcorde commented Nov 2, 2020

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants