Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add launch-based nosetest with simple pub/sub testing for all rmw implementations #7

Merged
merged 1 commit into from
Mar 28, 2015

Conversation

dirk-thomas
Copy link
Member

Connects to ros2/ros2#4

Current state of these unit tests:

Depends on ros2/rclcpp#17

@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label Mar 27, 2015
while (rclcpp::ok() and i <= number_of_messages) {
set_data_func(ros_msg, i);
p->publish(ros_msg);
std::cout << "published ros msg #" << i << std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this indented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the line was important 😉

Fixed.

@tfoote
Copy link
Contributor

tfoote commented Mar 27, 2015

lgtm

@wjwwood
Copy link
Member

wjwwood commented Mar 27, 2015

Other than the comments, this lgtm and I think it should be merged.

I'm excited to see some really easy to use process management in tests, and this is a good proof of concept. However, I think to be scalable we have to streamline the patterns here some more. However, I don't just want to complain without giving constructive feedback, so we should have a meeting about this to discuss details about testing. I would just list suggestions on how we could stream line testing, but it hinges on some fundamental points about testing, for example do we test before or after installing the package we are testing? And do we source the installation target space before running tests? Based on the answers to those questions I would suggest different strategies to streamline the process for making tests like this. But since it's neither clear to me what the right answers to those questions are nor clear to me what we're currently doing, I think we should discuss our test process before working further on making writing tests easy and low effort.

rclcpp::Node::SharedPtr node,
void (*set_data_func)(typename T::Ptr&, size_t),
size_t number_of_messages
) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss this particular point of code style again outside of the scope of this pr, because I would have written this as:

template<typename T>
int publish(
  rclcpp::Node::SharedPtr node,
  void (*set_data_func)(typename T::Ptr&, size_t),
  size_t number_of_messages)
{
  ...
}

Such that the opening { is visually lined up with its counter part on line 34, rather than the one on line 27, which it is lined up with but does not match. Normally I would say what you wrote above is good because it minimizes the number of lines of delta to add a parameter to the end or parameters, but since you cannot leave a trailing , it's not the case here, so it doesn't really make it better to put the closing ) on it's own line.

@wjwwood
Copy link
Member

wjwwood commented Mar 27, 2015

Another question, do we have a consensus on whether or not test code should have a license and copyright block at the top of files?

auto node = rclcpp::Node::make_shared("test_subscriber");

rclcpp::subscription::SubscriptionBase::SharedPtr sub;
sub = subscribe<simple_msgs::Uint32>(node, print_counter_data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could simplify this by using auto:

auto sub = subscribe<simple_msgs::Uint32>(node, print_counter_data);

@wjwwood
Copy link
Member

wjwwood commented Mar 27, 2015

Ok, I'm done with my review, :shipit:

@dirk-thomas
Copy link
Member Author

I think any code file should have copyright / license information. The only files excluded are commonly CMakeLists.txt / setup.py / Makefiles. I will wait for the ament_copyright package to auto-insert the information.

@dirk-thomas
Copy link
Member Author

@wjwwood Thanks for the comments - I have addressed them.

@wjwwood
Copy link
Member

wjwwood commented Mar 27, 2015

Sounds good to me.

@esteve
Copy link
Member

esteve commented Mar 28, 2015

+1

dirk-thomas added a commit that referenced this pull request Mar 28, 2015
add launch-based nosetest with simple pub/sub testing for all rmw implementations
@dirk-thomas dirk-thomas merged commit ea3d7c5 into master Mar 28, 2015
@dirk-thomas dirk-thomas removed the in progress Actively being worked on (Kanban column) label Mar 28, 2015
@dirk-thomas dirk-thomas deleted the launch_package branch March 28, 2015 17:26
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.

4 participants