Add fault injection macros and unit tests#80
Conversation
8749636 to
1110fbe
Compare
Signed-off-by: Stephen Brawner <brawner@gmail.com>
Signed-off-by: Stephen Brawner <brawner@gmail.com>
Signed-off-by: Stephen Brawner <brawner@gmail.com>
1110fbe to
a6fa53e
Compare
|
Rebase against master after merging #82 Testing this PR branch against current ros 2 branches. Testing |
rosidl_typesupport_cpp/test/test_message_type_support_dispatch.cpp
Outdated
Show resolved
Hide resolved
| &type_support_cpp_identifier, | ||
| "test_type_support1"); | ||
| EXPECT_NE(result, nullptr); | ||
| } catch (...) { |
There was a problem hiding this comment.
Why the try catch block in this scenario? if it is an expected throw, maybe EXPECT_THROW can be used? (Not clear to me if possible though)
There was a problem hiding this comment.
Because it doesn't throw for all potential errors. In some instances it will just return a nullptr.
There was a problem hiding this comment.
Should we be catching specific exceptions? Or in other words, doesn't the API specify what exceptions it may throw?
There was a problem hiding this comment.
I don't think the API does say anything about it, but adding a specific catch for the runtime errors seems reasonable.
There was a problem hiding this comment.
At some point, we should document potential exceptions just like we document error codes.
rosidl_typesupport_cpp/test/test_service_type_support_dispatch.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Stephen Brawner <brawner@gmail.com>
Signed-off-by: Stephen Brawner <brawner@gmail.com>
|
The |
* Add fault injection macros and unit tests Signed-off-by: Stephen Brawner <brawner@gmail.com> * target definitions Signed-off-by: Stephen Brawner <brawner@gmail.com> * Adjust tests Signed-off-by: Stephen Brawner <brawner@gmail.com> * PR Fixup Signed-off-by: Stephen Brawner <brawner@gmail.com> * Catch runtime exception Signed-off-by: Stephen Brawner <brawner@gmail.com> * Unused variable Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Add fault injection macros and unit tests Signed-off-by: Stephen Brawner <brawner@gmail.com> * target definitions Signed-off-by: Stephen Brawner <brawner@gmail.com> * Adjust tests Signed-off-by: Stephen Brawner <brawner@gmail.com> * PR Fixup Signed-off-by: Stephen Brawner <brawner@gmail.com> * Catch runtime exception Signed-off-by: Stephen Brawner <brawner@gmail.com> * Unused variable Signed-off-by: Stephen Brawner <brawner@gmail.com>
This adds unit test macros and fault injection to rosidl_typesupport_c and rosidl_typesupport_cpp. With these fault injections, coverage can get to 100%. I'll post CI results soon.
Signed-off-by: Stephen Brawner brawner@gmail.com