Page MenuHomeFreeBSD

ping: add tests of the Internet checksum function
ClosedPublic

Authored by jansucan on Aug 20 2019, 1:20 PM.
Tags
None
Referenced Files
F81649026: D21340.id61068.diff
Fri, Apr 19, 11:10 AM
F81633737: D21340.diff
Fri, Apr 19, 7:02 AM
Unknown Object (File)
Wed, Apr 17, 10:04 PM
Unknown Object (File)
Tue, Apr 9, 8:52 AM
Unknown Object (File)
Mar 16 2024, 10:08 AM
Unknown Object (File)
Mar 16 2024, 10:08 AM
Unknown Object (File)
Mar 16 2024, 10:08 AM
Unknown Object (File)
Feb 5 2024, 10:43 PM
Subscribers

Details

Summary

Add tests of the Internet checksum function

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25984
Build 24539: arc lint + arc unit

Event Timeline

asomers requested changes to this revision.Aug 20 2019, 3:49 PM

Don't forget to add an entry to etc/mtree/BSD.tests.dist

sbin/ping/tests/in_cksum_test.c
90

This doesn't guarantee that the array will be unaligned. It merely doesn't guarantee that it will be aligned. Better to declare an array that's aligned, then compute the checksum starting from the second byte. That way you'll know it's unaligned.

This revision now requires changes to proceed.Aug 20 2019, 3:49 PM

Add an entry to etc/mtree/BSD.tests.dist.

Ensure an unaligned data by starting from the second byte of an aligned data buffer.

sbin/ping/tests/in_cksum_test.c
90

Thanks. It has been fixed.

sbin/ping/tests/in_cksum_test.c
94

But now the second argument is wrong. Shouldn't it be nitems(data) - 1?

Correct unaligned data buffer size.

sbin/ping/tests/in_cksum_test.c
94

You're right. Thanks. I'm editing too many diffs at once.

sbin/ping/tests/Makefile
6

Here's a footgun you didn't know about: WARNS is by default set to 6 for libraries and binaries, but 0 for tests. You need to set it explicitly.

Set WARNS to 6 explicitly for tests.

sbin/ping/tests/Makefile
6

Fixed.

This revision is now accepted and ready to land.Aug 20 2019, 9:57 PM
This revision was automatically updated to reflect the committed changes.