-
Notifications
You must be signed in to change notification settings - Fork 126
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 Google tests for unit testing jni #36
Add Google tests for unit testing jni #36
Conversation
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
This is nice work, I haven't done C/C++ unit testing in a lifetime, great to see how the modern version looks like!
Without looking at the code you probably want to find a way to start measuring leaked memory after the init call(s), or explicitly call a function that cleans up what's allocated in the init call. |
Signed-off-by: John Mazanec <jmazane@amazon.com>
The way I confirmed was that I ran valgrind just on the init library call and the still reachable memory matched the value returned when I ran valgrind for all of the nmslib tests. In terms of deallocation, the init library function calls registration function like this. There does not appear to be a way to unregister these spaces or methods. |
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for adding coverage for c++ code. This also helps with running Valgrind memleak tests.
Signed-off-by: Jack Mazanec <jmazane1@nd.edu>
Signed-off-by: Jack Mazanec <jmazane1@nd.edu>
Signed-off-by: Jack Mazanec <jmazane1@nd.edu>
Signed-off-by: Jack Mazanec <jmazane1@nd.edu> Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Jack Mazanec <jmazane1@nd.edu>
Description
This PR adds google tests for testing the nmslib_wrapper and faiss_wrapper. Additionally, I made some minor stylistic changes to the jni to help testing and clean up. The primary purpose of these tests is to be able to identify potential memory leaks.
In order to mock the JNIUtilInterface, this PR adds MockJNIUtil class built off of gmock. In the constructor of this class, the default behavior is defined. This can be overriden inside individual test cases.
While the tests cover each library wrapper function, they do not yet exercise all possible functionality. In order to keep the scope of this PR focused, I will leave expansion to a future PR.
In order to build tests:
To run the tests:
In order to test memory checks, I ran the tests with valgrind. Here are some of the results:
A couple things to note about these results:
Issues Resolved
#31
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.