Commit graph

751 commits

Author SHA1 Message Date
Michel Hidalgo
316765b2e0 Fix rcl package's logging API error specs and handling. (#746)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Jorge Perez
184e3320e3 Fix bug error handling get_param_files (#743)
* 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 <jjperez@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Michel Hidalgo
2fabe16d9c Complete subscription API test coverage (#734)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Jorge Perez
72837b77c6 Add deallocate calls to free strdup allocated memory (#737)
* 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>
2020-11-02 16:22:11 +01:00
Jorge Perez
f3a8bb0127 Add missing calls to rcl_convert_rmw_ret_to_rcl_ret (#738)
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Jorge Perez
c1bf050bff Add mock tests, publisher 95% coverage (#732)
* 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>
2020-11-02 16:22:11 +01:00
Jorge Perez
e4004955ad Reformat rmw_impl_id_check to call a testable function (#725)
* 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>
2020-11-02 16:22:11 +01:00
Chris Lalancette
c8889f2363 Make sure to call rcl_arguments_fini at the end of the test.
This just prevents a memory leak.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
2020-11-02 16:22:11 +01:00
Jorge Perez
4e14874cf4 Add remap needed null check (#711)
* Add needed extra null check
* Add test for added check
* Add tests for nullptrs

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Jorge Perez
0d411f518e Make public ini/fini rosout publisher (#704)
* Add bad param tests ini/fini rosout publisher
* Make ini/fini_publisher_for_node public

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Jorge Perez
01927e52ac Move rcl_remap_copy to public header (#709)
* 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>
2020-11-02 16:22:11 +01:00
Jorge Perez
563a61cbc6 Add coverage tests for rcl (#703)
* 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 <jjperez@ekumenlabs.com>
2020-11-02 16:22:11 +01:00
Jorge Perez
3d6c2e90ba Add bad arguments tests for coverage (#698)
* 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>
2020-11-02 16:22:11 +01:00
Michel Hidalgo
7cc97f48f3 Improve error checking and handling in subscription APIs. (#739)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-23 19:36:19 +02:00
brawner
a270de6825 Add fault injection macros and unit tests to rcl_action (#730)
* 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>
2020-10-23 19:36:19 +02:00
Jacob Perron
76a706db9b
Fix memory leak in rcl_subscription_init()/rcl_publisher_init() (#794, #834) (#832)
* 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>
2020-10-16 13:42:49 -07:00
Michel Hidalgo
6ec0c6cfa2 Improve rcl init test coverage. (#684)
* Improve rcl init test coverage.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>

* Address peer review comments.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Jorge Perez
dda5103935 Remove unused check context.c (#691)
* Remove unused check context.c
* Add test for functionality removed
* Add rcl_reset_error() statement

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Jorge Perez
91dad10c1e Improve subscription coverage (#681)
* Add bad argument tests for subscription.c
* Add missing rcl_reset_error()
* Add test failing cyclone
* Disable test not working for rmw_cyclone_cpp
* Add simple bad alloc test
* Add tests enclave_name
* Revert "Add tests enclave_name"
* Move init/fini tests
* Add auxiliar testing class
* Reformat into smaller tests
* Add checks ini/fini rmw messages
* Add issue report for disabled test
* Add assert for msg init
* Add bad_allocator test

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Michel Hidalgo
c52a938b9e Improve rcl timer test coverage. (#680)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Michel Hidalgo
b254630a6a Improve wait sets test coverage. (#683)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Michel Hidalgo
a4aa379d35 Minor fixes to rcl clock implementation. (#688)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Michel Hidalgo
c58dd7ab3d Improve clock test coverage. (#685)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
Michel Hidalgo
e2988b25ae Improve enclave validation test coverage. (#682)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-10-16 19:28:54 +02:00
brawner
a4e6485313 Fix test_rcl_lifecycle (#788)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-16 19:28:38 +02:00
brawner
dd62d09042 Add fault injection macros and unit tests to rcl_lifecycle (#731)
* 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>
2020-10-16 19:28:38 +02:00
brawner
b62b83b5cd Add mocking unit tests for rcl_yaml_param_parser (coverage part 3/3) (#772)
* Add mocking unit tests for rcl_yaml

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* deallocate test_path

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Fix memory leaks

Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-09 09:02:32 +02:00
brawner
08bbdde860 Add fault-injection unit tests (coverage part 2/3) (#766)
* Fault injection tests for rcl_yaml

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* PR Feedback

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Pause fault injection

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* variant_copy

Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-09 09:02:32 +02:00
brawner
79e2e044d3 Add basic unit tests for refactored functions in rcl_yaml_param_parser (coverage part 1/3) (#771)
* Add basic unit tests for refactored functions

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* PR Fixup

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Fix memory errors

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* headers moved

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Addressing feedback

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Switch to decltype

Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-09 09:02:32 +02:00
brawner
a34c4816c9 Fix mem leaks in unit test from 776 (#779)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-09 09:02:32 +02:00
tomoya
bf2029acf8 remove debugging statements. (#755)
Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
2020-10-09 09:02:32 +02:00
ahcorde
bba14e9318 Removed variant benchmark
Signed-off-by: ahcorde <ahcorde@gmail.com>
2020-10-08 08:45:33 +02:00
Scott K Logan
b981951677 Several memory-related fixes for rcl_variant_t benchmarks (#813)
* Remove a bunch of redundant nullptr assignments
* Fix some memory leaks
* Ensure source string is deallocated
* Remove redundant array size assignment

Signed-off-by: Scott K Logan <logans@cottsay.net>
2020-10-08 08:45:33 +02:00
Alejandro Hernández Cordero
f1bc651394 Improved rcl_yaml_param_parser benchmark test (#810)
Signed-off-by: ahcorde <ahcorde@gmail.com>
2020-10-08 08:45:33 +02:00
Alejandro Hernández Cordero
1c08083888 Added benchmark test to rcl_yaml_param_parser (#803)
* Added benchmark test to rcl_yaml_param_parser

Signed-off-by: ahcorde <ahcorde@gmail.com>

* reset heap counters

Signed-off-by: ahcorde <ahcorde@gmail.com>

* updated benchmark tests

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Added feedback

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Replace BENCHMARK_DEFINE_F and BENCHMARK_REGISTER_F with BENCHMARK_F

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Used rcpputils for the path

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Clean up the CMake dependencies

Signed-off-by: Scott K Logan <logans@cottsay.net>

* Updated test

Signed-off-by: ahcorde <ahcorde@gmail.com>

* udpated test name

Signed-off-by: ahcorde <ahcorde@gmail.com>

Co-authored-by: Scott K Logan <logans@cottsay.net>
2020-10-08 08:45:33 +02:00
Jacob Perron
46e9ff8032 1.1.8 2020-10-07 10:41:11 -07:00
brawner
7c1f2746f4
Fix yaml parser error when meets .nan (refactor on #754) (#781) (#785)
* Fix yaml parser error when meets .nan

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Correct code style

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Modify as suggested

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Improve test

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Fix minor flaw

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Fix minor flaw again

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Satisfy windows CI

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Change the match rule for special float

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

Distinguish +.inf and -.inf

Signed-off-by: Ada-King <Bingtao.Du@sony.com>

* Remove unnecessary #include change.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* Add in two more necessary includes.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

Co-authored-by: Ada-King <Bingtao.Du@sony.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Stephen Brawner <brawner@gmail.com>

Co-authored-by: Ada-King <Bingtao.Du@sony.com>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
2020-10-05 18:12:26 -07:00
brawner
2c513aa0ed
[foxy backport] Refactor parser.c for better testability (#754) (#784)
* Refactor parser.c for better testability (#754)

* Refactor rcl_yaml_param_parser for better testability

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Reorder parser.c to match parser.h

Signed-off-by: Stephen Brawner <brawner@gmail.com>

squash! Reorder parser.c to match parser.h

* Refactor yaml_variant.c for deduplication

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* ADD_VALUE_TO_SIMPLE_ARRAY for deduplication

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Remove fprintf

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* PR Fixup

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Move headers to src directory

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* PR Fixup

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Rebase #780

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Missing includes

Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-05 18:01:07 -07:00
brawner
6a137f1aba
Tweaks to client.c and subscription.c for cleaner init/fini (#728) (#822)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-05 13:34:05 -07:00
brawner
34107decc9
Set transition_map->states/transition size to 0 on fini (#729) (#821)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-05 13:30:57 -07:00
brawner
c4e690c92a
Address issue 716 by zero initializing pointers and freeing memory (#717) (#820)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-05 13:30:39 -07:00
brawner
d22d923931
Don't overwrite cur_ns pointer if reallocation fails (#780) (#783)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-01 16:25:16 -07:00
brawner
2e9ce913db
Set yaml_variant values to NULL on finalization (#765) (#782)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-10-01 15:06:52 -07:00
Michel Hidalgo
a26c9cf575
Fix rcl_parse_yaml_file() error handling. (#776) (#786)
It should not fini its output argument, silently invalidating the given pointer.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2020-09-24 10:14:41 -03:00
Shane Loretz
c5e903a38a
[Foxy backport] Use valid clock in case of issue in rcl_timer_init (#795) Store reference to rcl_clock_t instead of copy (#797) (#805)
* Use valid clock in case of issue in rcl_timer_init (#795)

* Use valid clock in case of issue

Signed-off-by: Stephen Brawner <brawner@gmail.com>

* Cleanup

Signed-off-by: Stephen Brawner <brawner@gmail.com>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

* Store reference to rcl_clock_t instead of copy (#797)

rcl_clock_t can't be trivially copied because adding or removing clock
jump callbacks to a copy will free the pointer held by the original
instance.

Signed-off-by: Shane Loretz<sloretz@openrobotics.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Co-authored-by: brawner <brawner@gmail.com>
2020-09-23 07:56:42 -07:00
Shane Loretz
055d7eba62
Topic fix rcl lifecycle test issue (#715) (#796)
* Fix missing call fini() for lifecycle_transition and node in test_rcl_lifecycle

Signed-off-by: Barry Xu <barry.xu@sony.com>

* Fix error overwritten while allocator is Nullptr.

Signed-off-by: Barry Xu <barry.xu@sony.com>

* Optimize used variables

Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Co-authored-by: Barry Xu <barry.xu@sony.com>
2020-09-09 15:25:10 -07:00
brawner
474754586c
Remove std::cout line from test_rcl_lifecycle.cpp (#773) (#774)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
2020-08-28 10:47:26 -07:00
Jacob Perron
a9d8044858 1.1.7 2020-08-03 14:56:23 -07:00
Alejandro Hernández Cordero
aa0967f0e2
Removed doxygen warnings (#712) (#724)
* Removed doxygen warnings

Signed-off-by: ahcorde <ahcorde@gmail.com>

* added feedback

Signed-off-by: ahcorde <ahcorde@gmail.com>
2020-07-22 15:23:48 +02:00
Ivan Santiago Paunovic
fd5e56a0e6
Set domain id to 0 if it is RMW_DEFAULT_DOMAIN_ID (#719)
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
2020-07-20 10:38:49 -03:00