Commit graph

24 commits

Author SHA1 Message Date
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
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
65c2d46ee0
Increase rcl_yaml_param_parser test coverage (#656)
* Cleanup and address issues in parser.c

Signed-off-by: Stephen Brawner <stephenbrawner@verbsurgical.com>

squash! Cleanup and address issues in parser.c

* Increase test coverage of parser

Signed-off-by: Stephen Brawner <stephenbrawner@verbsurgical.com>

* PR Fixup

Signed-off-by: Stephen Brawner <stephenbrawner@verbsurgical.com>

* PR Fixup

Signed-off-by: Stephen Brawner <stephenbrawner@verbsurgical.com>

Co-authored-by: Stephen Brawner <stephenbrawner@verbsurgical.com>
2020-05-26 12:45:36 -07:00
Dirk Thomas
4b9c0a30be
code style only: wrap after open parenthesis if not in one line (#565)
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
2020-02-03 09:06:35 -08:00
Chris Lalancette
cdf1b4d17d
Remove the maximum string size. (#524)
It wasn't preventing any allocations from happening, so it
doesn't seem to serve much purpose.  Also remove the tests
for the maximum string size.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
2019-10-21 18:21:38 -04:00
Michel Hidalgo
78f8652ee4
Enable incremental parameter yaml file parsing. (#507)
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2019-09-24 11:20:23 -03:00
Michel Hidalgo
6f989433bc
Support parameter overrides and remap rules flags on command line (#483)
* Support rcl_params_t copies.

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

* Parse parameter overrides from command line.

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

* Parameter overrides' tests passing.

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

* Test rcl_yaml_node_struct_copy() function

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

* Export rcl_yaml_param_parser as rcl dependency.

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

* Zero initialize parameter overrides before rcl arguments copy.

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

* Initialize local variables early enough.

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

* Simplify rcl package.xml

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

* Assert arguments sanity in rcl args parsing internal functions.

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

* Extend rcl_yaml_param_parser tests to all parameter types.

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

* Address peer review comments.

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

* Support --remap/-r flags.

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

* Please cpplint

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2019-08-26 13:32:16 -03:00
hyunseok-yang
d07003847b Increase MAX_STRING_SIZE (#487)
* Increase MAX_STRING_SIZE

It's too short for string length.
It occurs the error when the string field in yaml files are too long....

Signed-off-by: Hyunseok Yang <hyunseok7.yang@lge.com>

* update test to match increased limit

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
2019-08-23 14:52:46 -07:00
Michel Hidalgo
5fde9c0c0e
[YAML Parser] Support parameter value parsing (#471)
* Support parameter YAML string value parsing.

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

* Address peer review comments.

- Improve test coverage using new getter API.
- Unify function return style and improve readability.

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

* Clean up allocations in rcl_yaml_param_parser package tests.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
2019-07-12 15:07:42 -03:00
ivanpauno
d6ab086b02
Accept quoted int or float values as strings (#464)
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
2019-06-27 17:51:05 -03:00
Jacob Perron
ec8539b65c
Fix memory corruption when maximum number of parameters is exceeded (#456)
If the maximum number is exceeded fail with an informative error message.

Fixes #419.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
2019-06-07 14:56:05 -07:00
Ralf Anton Beier
5f0d331712 Allow empty strings if they are quoted. (#450)
Signed-off-by: Ralf Anton Beier <ralf_beier@me.com>
2019-05-24 08:57:47 -07:00
William Woodall
4d8cb487f8
use new error handling API from rcutils (#314)
* use new error handling API from rcutils

Signed-off-by: William Woodall <william@osrfoundation.org>

* use semicolons after macros

Signed-off-by: William Woodall <william@osrfoundation.org>

* use new error handling API from rcutils

Signed-off-by: William Woodall <william@osrfoundation.org>

* minimize vertical whitespace

Signed-off-by: William Woodall <william@osrfoundation.org>

* use semicolons after macros

Signed-off-by: William Woodall <william@osrfoundation.org>
2018-11-01 21:08:31 -05:00
dhood
f1293b7d3b
[yaml parser] Fix FQN=//node_name when ns is / (#299)
* Fix FQN=//node_name when ns is /

* Check end of string for ns sep

* Add regression test
2018-09-21 14:50:48 -07:00
William Woodall
d63e2bc9cf
changes to support memory audit (#261)
* changes to rcutils_path_join()

* remove uses of malloc/realloc/calloc/free for allocator usage instead

* remove unused class members
2018-06-16 22:06:07 -07:00
anup-pem
5edf27b032 YAML parameter parser (#235)
* Implement a basic YAML based parameter parser for ros2 nodes

* Add README file

* Fix the issues after moving from rcutils_yaml_param_parser to rcl_yaml_param_parser

  - rename folders from rcutils_yaml_param_parser to rcl_yaml_param_parser
  - rename project, header guards and include statements from rcutils_yaml_param_parser to rcl_yaml_param_parser
  - move type declaration in separat file and namespace new structures
  - Fix the code review comments from Mikael

* Few minor changes

   - Changed "params" string to "ros__parameters"
   - Add -Wall, -Wextra and -Wpedantic falgs
   - Fix the compile warning with the new flags

* Fix the changes made in the design of C structure

  - Remove the node_namespaces entry in rcl_params_t
  - Change the type of num_nodes and num_params to size_t

* depend on libyaml_vendor (#236)

* Fix cmake setting standard(C and C++) and add byte_array in C struct

*   Remove C11 so that it defaults to C99

* [rcl_yaml_param_parser] fix export symbols (#237)

* add visibility macros

* remove unused macro

* Support for multi level node and parameter name spaces

* Additional fixes and cleanups

  - Support for string namespace seperator
  - Provide parameter structure init function API
  - name cleanups

* off by 1

* Call yaml_parser_delete()

* fclose(yaml_file)

* free() allocated paths

* Call yaml_event_delete()

* completely deallcoate string array

* Few cleanup changes

  - Add install command into CMakelists.txt
  - Replace one of the zero_allocate with reallocate
  - Pass allocator state
  - Fix int32_t -> rcl_ret_t return value

* Don't include unistd.h

* Use size_t for array indices

* Just pass the allocator in the init function
2018-05-29 18:07:02 +02:00