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
F103366107: D21340.diff
Sun, Nov 24, 2:42 AM
Unknown Object (File)
Thu, Nov 14, 9:36 PM
Unknown Object (File)
Fri, Nov 8, 4:48 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:17 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 25986
Build 24541: 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
7

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
7

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.