-
Notifications
You must be signed in to change notification settings - Fork 3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve API documentation and test coverage #11878
Conversation
@michalpasztamobica, thank you for your changes. |
68e0336
to
1f5f514
Compare
I fixed the doxyspell error and removed one of the |
@AnttiKauppila , could you review, please? |
As it stands it's a breaking change and should target 6. |
@@ -80,7 +80,7 @@ nsapi_error_t PPPInterface::disconnect() | |||
if (_interface) { | |||
return _interface->bringdown(); | |||
} | |||
return NSAPI_ERROR_OK; | |||
return NSAPI_ERROR_NO_CONNECTION; |
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.
This functional change might need more than just Fix PPPInterface::disconnect to return NO_CONNECTION
or is it that clear ?
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.
Thanks for the remark, @0xc0170 . I amended the commit message, to make sure the reason for this change is clear. Is this ok now?
I think that this code must have never been triggered until I added unittests for it, just now. It's such an obvious bug to return OK
if there is no interface...
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.
61d0ac8 is still the same or is it different commit?
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.
Doesn't the hash of the commit change when amended? The modification looks the same...
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 looked through the changes before and after the recent push and they are identical, only the commit message changed now.
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.
Fix PPPInterface::disconnect to return NO_CONNECTION in case of failure
- this is the new commit msg then?
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.
Yes with "in case of failure" added to clarify what has exactly changed.
Did I misunderstand your request? :)
1f5f514
to
539cff8
Compare
Will start CI soon, some 5.15 needs to get in first today |
CI started |
Test run: FAILEDSummary: 1 of 4 test jobs failed Failed test jobs:
|
@michalpasztamobica Please rebase |
539cff8
to
b7e50ed
Compare
@0xc0170 , rebased, resolved conflicts and fixed uninitialized variable that caused valgrind to crash. |
CI started |
Test run: FAILEDSummary: 1 of 4 test jobs failed Failed test jobs:
|
b7e50ed
to
a9f5319
Compare
@0xc0170 , I rebased and fixed the unittest compilation issue (one of the stubs was renamed form .c to .cpp while the PR was being processed). The CI can be restarted. |
Will start CI when later today |
I triggered CI but right away noticed the conflicts :/ Please rebase and we shall restart CI |
a9f5319
to
67e60b9
Compare
@0xc0170 , I just rebased and resolved conflicts. |
CI restarted |
Test run: FAILEDSummary: 1 of 4 test jobs failed Failed test jobs:
|
The mock was only used by EthernetInterface tests, but we can reuse it for other tests as well.
Mainly focusing on hardening the tests for return values.
67e60b9
to
75472d0
Compare
Logs are not fully clear to me, but there was an uninitialized variable in one of the newly added tests, which valgrind detected. |
CI restarted |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description (required)
Harden
netsocket
APIs in documentation and unittests.Continuation of the task started in #11808.
Summary of change (What the change is for and why)
I've gone through the Doxygen docs of our APIs and tried to make sure all returnable errors are explicitly mentioned and references are given to underlying APIs, if they can return other errors. Then I went to check if existing unittests cover all the possible return values.
The goal is for the users to be able to only check returnable errors, rather than go through all possible
nsapi_error_t
values.The only untested APIs are:
L3IP
- It includesLWIPStack.h
and basically requires full LWIP configuration - quite an overkill for testing what is effectively a wrapper class.DNS
,WiFiInterface
,MeshInterface
) - as they have no code to test. It is also difficult to predict possible return values, as they may depend on the underlying driver implementation.There is one functional change in the return value of PPPInterface function. Reviewers, please pay attention 馃槂 .
I hae also moved
OnboardNetworkStackMock
function it its own file and explicitly called the file a_mock
. I hope this is OK? (Alternatively, we could create amocks
directory, next to the existingstubs
, or call the file a_stub
, even though it contains a mock).Documentation (Details of any document updates required)
Pull request type (required)
Test results (required)
Reviewers (optional)
@AnttiKauppila