Skip to content

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

Merged
merged 3 commits into from
Sep 22, 2016

Conversation

jeromecoutant
Copy link
Collaborator

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

result status should be set to false by default before starting test execution.
@sg-
Copy link
Contributor

sg- commented Sep 19, 2016

@bridadan

Copy link
Contributor

@bridadan bridadan left a 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;
Copy link
Contributor

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();
Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Collaborator Author

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

Copy link
Contributor

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 {
Copy link
Contributor

@bridadan bridadan Sep 20, 2016

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 {

Copy link
Contributor

@bridadan bridadan left a 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

@bridadan
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 902

All builds and test passed!

@sg- sg- merged commit c1c1492 into ARMmbed:master Sep 22, 2016
@jeromecoutant jeromecoutant deleted the PR_STM32_IPV4 branch September 26, 2016 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants