Skip to content

Tolerate packet loss up to 30% in udp echo tests #7209

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 1 commit into from
Jun 15, 2018

Conversation

jarlamsa
Copy link
Contributor

Description

UDP echo tests to tolerate packet loss up to 30%
Packet loss percentage is also printed in the end of each test.

Pull request type

[ ] Fix
[x] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

@jarlamsa
Copy link
Contributor Author

@SeppoTakalo @juhaylinen please review

Copy link
Contributor

@SeppoTakalo SeppoTakalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calculations are not accurate enough for small packet numbers.
Use floating point, not integers.
Or use fixed points calculations.

For example, when packets_recv is 80 and packets_sent is 100:

1 - (packets_recv / packets_sent)

Becomes

1 - (80 / 100) which is
1 - (0)

}
// Packet loss up to 30% tolerated
if (packets_sent > 0) {
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n", packets_sent, packets_recv, 1 - (packets_recv / packets_sent));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 - (packets_recv / packets_sent) is integer calculation.
Convert to float for proper calculation.

https://wiki.sei.cmu.edu/confluence/display/c/FLP06-C.+Convert+integers+to+floating+point+for+floating-point+operations

}
free(stack_mem);
// Packet loss up to 30% tolerated
if (packets_sent > 0) {
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n", packets_sent, packets_recv, 1 - (packets_recv / packets_sent));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, convert to float before calculation.

@jarlamsa jarlamsa force-pushed the udpsocket_echo_packetloss branch from e93d5e0 to 3f35288 Compare June 14, 2018 06:46
@jarlamsa
Copy link
Contributor Author

Changes made according to review

@jarlamsa jarlamsa force-pushed the udpsocket_echo_packetloss branch from 3f35288 to 6bdefd3 Compare June 14, 2018 07:16
@jarlamsa
Copy link
Contributor Author

Is there some issues in the CI servers, some builds are failing after git checkout?

@jarlamsa
Copy link
Contributor Author

@cmonr is it possible to trigger the failed Jenkins job again, it seems to be working again.

@cmonr
Copy link
Contributor

cmonr commented Jun 14, 2018

@jarlamsa Yup! Will be restarting the job momentarily.

Thw way the job failed is new, so I'm capturing the logs before restarting it.

@cmonr
Copy link
Contributor

cmonr commented Jun 14, 2018

@SeppoTakalo Mind re-reviewing?

@cmonr
Copy link
Contributor

cmonr commented Jun 14, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 14, 2018

Build : SUCCESS

Build number : 2353
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7209/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 14, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 15, 2018

@cmonr cmonr merged commit bfb4379 into ARMmbed:master Jun 15, 2018
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.

6 participants