Page MenuHomeFreeBSD

lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsll
ClosedPublic

Authored by fuz on Jun 23 2023, 9:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 22, 9:34 PM
Unknown Object (File)
Wed, Oct 16, 6:09 PM
Unknown Object (File)
Wed, Oct 16, 6:09 PM
Unknown Object (File)
Wed, Oct 16, 6:09 PM
Unknown Object (File)
Wed, Oct 16, 5:48 PM
Unknown Object (File)
Oct 5 2024, 4:09 PM
Unknown Object (File)
Sep 27 2024, 1:29 AM
Unknown Object (File)
Sep 19 2024, 9:59 PM
Subscribers

Details

Summary

Add atf unit tests for ffs, ffsl, ffsll, fls, flsl, flsll.
These unit tests will be used for an upcoming DR.

Also supply CFLAGS+=-fno-builtin to ensure our unit tests
actually test libc functions and not clang's builtins.

Sponsored by: FreeBSD Foundation

Test Plan

Unit tests pass with current implementations of
these functions. This DR is the test plan for an upcoming DR.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

fuz requested review of this revision.Jun 23 2023, 9:45 PM
kevans added a reviewer: ngie.
kevans added a subscriber: kevans.

This seems to LGTM, let's perhaps pull in ngie for another sanity check. I think templating ffs_test and fls_test like this is a fine approach.

This revision is now accepted and ready to land.Jun 28 2023, 7:47 PM

Are these testcases already implemented in the libm tests?

lib/libc/tests/string/flsll_test.c
29–31

Why don't you just modify the CFLAGS to define these things at build time instead of creating a ton of basically boilerplate C files?

This seems to LGTM, let's perhaps pull in ngie for another sanity check. I think templating ffs_test and fls_test like this is a fine approach.

Thanks. Do I have approval to commit once @ngie approves? If yes, can this be MFC'ed to 13-STABLE?

Are these testcases already implemented in the libm tests?

I am not aware of any such tests.

lib/libc/tests/string/flsll_test.c
29–31

I was copying the design pattern used for string functions. If this is not how I am supposed to write test cases, could you point me at some example I can copy?

I don't think these should run by default, in fact the overall suite is already taking way too long

can this be made condiitonal, even if installed