Page MenuHomeFreeBSD

libc/tests: add stdbit test framework and unit tests
Needs ReviewPublic

Authored by fuz on Mon, Nov 10, 9:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 16, 6:13 PM
Unknown Object (File)
Sat, Nov 15, 3:14 PM
Unknown Object (File)
Fri, Nov 14, 9:17 PM
Unknown Object (File)
Fri, Nov 14, 9:17 PM
Unknown Object (File)
Fri, Nov 14, 6:34 PM
Unknown Object (File)
Fri, Nov 14, 6:34 PM
Unknown Object (File)
Fri, Nov 14, 3:55 PM
Unknown Object (File)
Fri, Nov 14, 1:07 PM
Subscribers

Details

Reviewers
markj
des
adrian
Summary

This adds unit tests for all 70 functions in <stdbit.h>.

I'm sorry for the test framework, but it makes it so I don't
have to write 70 unit tests by hand.

Test Plan

This is the test plan for D53657.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 68740
Build 65623: arc lint + arc unit

Event Timeline

fuz requested review of this revision.Mon, Nov 10, 9:35 AM
  • libc/tests/Makefile: use tab, not space for indent
  • libc/tests/stdbit: remove - from /*-
adrian added a subscriber: adrian.

absolutely amazing use of macros and included source files i love it

This revision is now accepted and ready to land.Tue, Nov 18, 3:08 PM
des added inline comments.
lib/libc/tests/stdbit/stdbit-test-framework.c
64

no longer needed

lib/libc/tests/stdbit/stdbit-test-kernel.c
41
48
lib/libc/tests/stdbit/stdbit-test-framework.c
64

If I remove ATF_TP_ADD_TCS, the tests fail to build (undefined symbol main). If I just remove the individual test cases ATF_TP_ADD_TC, then no unit tests end up defined. I am confused as to which part of this is “no longer needed.” Please clarify.

  • fix formatting issues in stdbit unit tests
This revision now requires review to proceed.Wed, Nov 19, 11:23 AM
  • use _WIDTH macros from C23 <limits.h> in stdbit unit tests, see D53825
des requested changes to this revision.Wed, Nov 19, 2:05 PM

I just remembered that you need to add an stdbit directory to etc/mtree/BSD.tests.mk:

--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -382,6 +382,8 @@
             ..
             ssp
             ..
+            stdbit
+            ..
             stdio
             ..
             stdlib
This revision now requires changes to proceed.Wed, Nov 19, 2:05 PM

Thanks, this is something I always forget about.

  • etc/mtree: add stdbit directory to etc/mtree/BSD.tests.mk