-
Notifications
You must be signed in to change notification settings - Fork 3k
FEATURE_IPV4/TESTS: result status could be wrong #2744
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
Conversation
result status should be set to false by default before starting test execution.
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 submitting these changes, these tests should definitely start off as failing and then validate to being a pass. I've made a few change requests, could you take a look?
@@ -66,17 +67,21 @@ int main() { | |||
TEST_ASSERT_TRUE(found_200_ok); | |||
TEST_ASSERT_TRUE(found_hello); | |||
|
|||
result = true; | |||
if (!found_200_ok) result = false; | |||
if (!found_hello) result = false; |
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.
Could you change the above three lines to:
if (found_200_ok && found_hello) result = true;
printf("%s", buffer); | ||
sock.close(); |
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.
Could fix the indent here?
@@ -66,6 +66,8 @@ int main() { | |||
result = false; |
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.
Since we're assuming false by default, can we remove this line?
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 don't think so.
Result is set to true at each loop, so before break, we need to set it back to false
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.
@jeromecoutant Oops, not sure how I missed that, thanks for pointing that out. You're right, this line should stay in then.
printf("%s", buffer); | ||
sock.close(); | ||
} | ||
else { |
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.
Last little nit pick: could you put the above two lines on the same line? According to our committer guide, we follow the K&R style: https://github.com/ARMmbed/mbed-os/blob/master/docs/COMMITTERS.md#rules
So:
}
else {
becomes:
} else {
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 changes @jeromecoutant, LGTM!
/morph test
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 902 All builds and test passed! |
Description
result status should be set to false by default before starting test execution.
For ex, tcp_client_hello_world test case was always OK event if there is no HTTP connection server.
Status
READY