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)
May 17 2024, 8:10 AM
Unknown Object (File)
Apr 6 2024, 11:18 AM
Unknown Object (File)
Feb 14 2024, 6:31 PM
Unknown Object (File)
Dec 20 2023, 6:56 AM
Unknown Object (File)
Dec 10 2023, 7:10 PM
Unknown Object (File)
Nov 9 2023, 9:14 PM
Unknown Object (File)
Oct 10 2023, 7:53 PM
Unknown Object (File)
Oct 8 2023, 8:10 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