-
Notifications
You must be signed in to change notification settings - Fork 136
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
[Update] Add Messaging Unit Tests and Fix Issue #293 Message Memory Leak #296
Conversation
CI MessageAborting, need an authorized user to run CI |
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.
I'll add another comment about making a full test suite
Here are some basic tests we will want for the messaging system:
Right now your test also relies on a human to watch it and judge whether it works correctly or not -- let's try to automate that. Later we might integrate with a proper unit testing framework which can provide a standardized way to define tests and the expected output for them. For now you can do this manually. I'm imaging something that would display output like this when run:
Making the logic for this will be a bit awkward since the only place you can put code is in the nflib defined callbacks (setup, message, packet, etc). Probably the easiest way is to have all of the testing logic inside the message_handler function you define. The setup function might create the first message for Test 1 which would initiate the whole process. |
…t to hold 'global data'
Revert "[Update] Print out socket ID information for manager and network func…"
great work @NoahChinitzGWU and @Lhahn01 on Friday revising this to follow a better testing structure. I think we still had a couple minor issues to resolve when we ended. Let me know when the PR is fully updated and I’ll do a final review Be sure to add a comment to the |
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.
Overall looks good. A few final nits.
Co-authored-by: Tim Wood <timwood@gwu.edu>
Co-authored-by: Tim Wood <timwood@gwu.edu>
Co-authored-by: Tim Wood <timwood@gwu.edu>
Co-authored-by: Tim Wood <timwood@gwu.edu>
Co-authored-by: Tim Wood <timwood@gwu.edu>
Co-authored-by: Tim Wood <timwood@gwu.edu>
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.
I added a commit suggestion so the readme will describe the test cases. Otherwise this is ready to go.
Co-authored-by: Tim Wood <timwood@gwu.edu>
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.
Ready to go!
Summary:
This PR includes a new NF called Basic Message Test that tests the functionality of an NF sending messages to itself. This NF was created in response to Issue #293 where a memory leak was found. The memory leak occurred when a message was trying to be sent and the message queue had been filled; the message was never freed and put back into the shared memory pool. Three tests are ran: the first making sure that one message (with the correct data) can be sent to an NF, next it tests if 10 messages can be sent to an NF, and finally it tests to make sure that even if the ring buffer is overflowed that the appropriate messages are received by the NF. Moreover, there were changes made to
onvm_sc_common.c
in which if there was no packet sent to the function then we would return the first instance ID associated with the given service ID.Without the fix,
test_messaging.c
would output:This makes sense since Test 4 is testing to make sure that all messages have been deallocated back to the memory pool. Since these overloaded messages were never put back into the memory pool correctly (which was the memory leak), we see that there is a memory leak.
With the fix,
test_messaging.c
will output:Now that the fix has been implemented, all 4 tests pass and the memory leak is plugged.
Usage:
Usage is described in README.md
Merging notes:
TODO before merging :
Test Plan:
The NF was run extensively to ensure no segmentation faults occurred, as well as proper deallocation of memory was maintained.
Review: