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

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

Merged
merged 1 commit into from Jun 15, 2018

Conversation

Projects
None yet
6 participants
@jarlamsa
Contributor

jarlamsa commented Jun 13, 2018

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

This comment has been minimized.

Contributor

jarlamsa commented Jun 13, 2018

@SeppoTakalo @juhaylinen please review

@cmonr cmonr requested review from SeppoTakalo and juhaylinen Jun 13, 2018

@cmonr cmonr added the needs: review label Jun 13, 2018

@SeppoTakalo

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));

This comment has been minimized.

@SeppoTakalo

SeppoTakalo Jun 13, 2018

Contributor

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));

This comment has been minimized.

@SeppoTakalo

SeppoTakalo Jun 13, 2018

Contributor

Same here, convert to float before calculation.

@0xc0170 0xc0170 added needs: work and removed needs: review labels Jun 13, 2018

@jarlamsa jarlamsa force-pushed the jarlamsa:udpsocket_echo_packetloss branch from e93d5e0 to 3f35288 Jun 14, 2018

@jarlamsa

This comment has been minimized.

Contributor

jarlamsa commented Jun 14, 2018

Changes made according to review

@jarlamsa jarlamsa force-pushed the jarlamsa:udpsocket_echo_packetloss branch from 3f35288 to 6bdefd3 Jun 14, 2018

@jarlamsa

This comment has been minimized.

Contributor

jarlamsa commented Jun 14, 2018

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

@jarlamsa

This comment has been minimized.

Contributor

jarlamsa commented Jun 14, 2018

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

@cmonr

This comment has been minimized.

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 cmonr added needs: review and removed needs: work labels Jun 14, 2018

@cmonr

This comment has been minimized.

Contributor

cmonr commented Jun 14, 2018

@SeppoTakalo Mind re-reviewing?

@cmonr cmonr added needs: CI and removed needs: review labels Jun 14, 2018

@cmonr

This comment has been minimized.

Contributor

cmonr commented Jun 14, 2018

/morph build

@mbed-ci

This comment has been minimized.

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

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@cmonr cmonr merged commit bfb4379 into ARMmbed:master Jun 15, 2018

14 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/astyle Passed, 922 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 8997 cycles (-609 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 9964B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment