Comments (9)
We want to test, for each type, (primative, array, strings, nested, bounded/unbounded/fixed)
Test construction, loading, unloading, correctness, assertion, correct cleanup. @dirk-thomas please make into bulleted list
from rosidl.
The list of different types:
- bool
- byte
- char
- float32
- float64
- int8
- uint8
- int16
- uint16
- int32
- uint32
- int64
- uint64
- string (unbounded), string=N (fixed size), string<=N (upper bound)
- submessage
- each of them can be arrays (unbounded, fixed size, upper bound)
The things to test:
- get / set values, ensure valid value range works
- initialized correctly, default values
- alloc/free init/fini functions work
- memory handling is correct (e.g. manually running the test with varlgrind)
from rosidl.
@dirk-thomas while I was trying the tests on the string types I noticed that rosidl_generator_c__String__assignn
doesn't check for the upper-bound limit on an assigned string. In fact it can increase the capacity over that size if the string passed is larger.
from rosidl.
Since rosidl_generator_c__String__assignn
is a generic function it can't perform the check. In order to check for the upper boundary we would need to generate and use a message field specific function. Due to the increased complexity we didn't do that for now.
from rosidl.
Ok.
from rosidl.
@dirk-thomas here is what I commented yesterday. In the destroy function we free the pointer but we don't set it to NULL:
https://github.com/ros2/rosidl/blob/master/rosidl_generator_c/resource/msg__functions.c.template#L201-L208
from rosidl.
Because the pointer variable is local to this function there is no need to set it to zero. It goes out of scope on the next line anyway.
If we would like to set the pointer of the caller to zero we would need to pass a pointer to a pointer.
from rosidl.
You're right, the caller should manage it's pointer.
from rosidl.
Added tests for the following types:
- simple primitives
- simple primitives with default values
- strings
- unbounded arrays of primitives
- bounded arrays of primitives
- static arrays of primitives
The output using valgrind looks good:
$ valgrind --leak-check=yes ./test_interfaces_c
==27699== Memcheck, a memory error detector
==27699== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==27699== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==27699== Command: ./test_interfaces_c
==27699==
Testing rosidl_generator_c message types...
Testing simple primitive message types...
Testing simple primitives with default values...
Testing string types...
Testing primitives unbounded arrays types...
Testing primitives bounded arrays types...
Testing primitives static arrays types...
All tests were good!
==27699==
==27699== HEAP SUMMARY:
==27699== in use at exit: 0 bytes in 0 blocks
==27699== total heap usage: 35 allocs, 35 frees, 1,930 bytes allocated
==27699==
==27699== All heap blocks were freed -- no leaks are possible
==27699==
==27699== For counts of detected and suppressed errors, rerun with: -v
==27699== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
from rosidl.
Related Issues (20)
- rosidl_generate_interfaces - Undocumented DEPENDENCIES option HOT 4
- rosidl_adapter: Constant with trailing `_` causes parser to infinite loop HOT 1
- ros2_foxy: Unknown CMake command "get_executable_path". HOT 2
- LINK : fatal error LNK1104 when building on windows 10 HOT 3
- How to add __attribute__((packed)) to structs HOT 5
- deserialization fails when float is NaN
- msg2idl.py generates incorrect idl HOT 9
- 'ros2 interface show' doesn't work when message file is in sub-directory HOT 3
- Regex problems with directories that include two `+`s (tragic naming but unavoidable)
- Test failures on armhf and armel HOT 1
- Build custom message failed."There are no rules to make targets,没有规则可制作目标" HOT 2
- Add tests parsing/generating msg/srv/action comments with non-ASCII characters HOT 2
- Retrieve interfaces files from sources HOT 1
- Make python geometry msgs typecastable into C++ types automatically
- Coverity report CHECKED_RETURN issue HOT 3
- Make message name available as a ``constexpr`` in type traits.
- Invalid IDL files generated when IDL reserved keywords are used as field name HOT 1
- rosidl generator cpp depreceation warning failing builds when using const values in msg definitions HOT 4
- Provide documented CMake exported namespace targets for consuming generated packages without ament_target_dependencies HOT 1
- Add non-default constructors to avoid initializing messages with dummy data HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rosidl.