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

Tests for XmlRpcValue and XML conversion. #1216

Merged

Conversation

trainman419
Copy link
Contributor

Unit tests to cover existing functionality.
Moved the logging class definition to the XmlRpcUtil header since the corresponding functions are implemented in XmlRpcUtil.cpp. This makes it easier to break XmlRpcpp into sub-libraries for future unit tests.

I've also update the include path in xmlrpcvalue_base64.cpp because our internal build system does not like the relative include path (and it's more consistent with the rest of the library).

Unit tests to cover existing functionality.
Moved the logging class definition to the XmlRpcUtil header since the
corresponding functions are implemented in XmlRpcUtil.cpp. This makes it
easier to break XmlRpcpp into sub-libraries for future unit tests.
@mikepurvis
Copy link
Member

The tests look reasonable to me, and there should be no ill-effect from moving the header contents, since either one you include will still see the same or a superset of the symbols from before.

👍

@dirk-thomas
Copy link
Member

dirk-thomas commented Nov 2, 2017

Since xmlrpcpp is an external library which has been pulled into this repo I would rather prefer to avoid any changes to it (if not necessary to fix bugs). Would it be possible to do the same testing without moving the code?

@trainman419
Copy link
Contributor Author

The more complex mocking that I'm doing for the other tests relies on having the library broken into smaller pieces so that I can mock the individual pieces without depending on all of the headers.

The biggest change here is moving the logging classes out of XmlRpc.h and into XmlRpcUtil.h (since they're implemented in XmlRpcUtil.cpp anyway), so that individual cpp files that use logging don't need to depend on all of the other headers.

@dirk-thomas
Copy link
Member

Would it make sense to import the tests from the upstream project? Which additional parts are you trying to cover with the test suite?

Since XmlRpcUtil.h is a transitive header of XmlRpc.h the move will be transparent to other code using it. I am just trying to avoid diverging / modifying third-party code if possible. If that is the only change to the third-party code and is absolutely necessary for your testing I am fine with it.

@mikepurvis
Copy link
Member

Looking at the git history, it seems like there was almost no change from late 2011 until a handful of restructurings earlier this year around poll/select and switching out the base64 library. Meanwhile, the upstream project hasn't released anything since 2003: http://xmlrpcpp.sourceforge.net/

Basically, I would argue that there will never be another "import" of upstream development for this package, so we should feel at liberty to iterate it forward in a way that suits the needs of its users in the ROS ecosystem and particularly roscpp.

@trainman419
Copy link
Contributor Author

This appears to be the upstream project: https://sourceforge.net/projects/xmlrpcpp/files/ and it hasn't been updated since 2003 and doesn't have any unit tests. It looks like ROS has moved the upstream tests into the standalone-tests directory because they can't be run in an automated way.

I tried to cover most of the library with the test suite that I've written. The tests in this PR are the simple ones that cover some of the existing functionality and confirm that it works correctly.

@dirk-thomas
Copy link
Member

It looks like ROS has moved the upstream tests into the standalone-tests directory because they can't be run in an automated way.

I was mostly wondering if it makes sense to write tests from scratch or rather iterate on the existing tests and make them work.

Anyway I am fine merging this. Thank you for working on the additional test coverage.

@dirk-thomas dirk-thomas merged commit acb152c into ros:lunar-devel Nov 3, 2017
@trainman419
Copy link
Contributor Author

@dirk-thomas yes, these tests were originally derived from the upstream TestValues.cpp and TestXml.cpp tests, but they've been heavily modified to run within gtest and extended to give more complete test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants