Page MenuHomeFreeBSD

Automate the subr_unit test.
ClosedPublic

Authored by asomers on Apr 20 2016, 11:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 10, 8:03 AM
Unknown Object (File)
Mon, Dec 9, 3:47 PM
Unknown Object (File)
Nov 14 2024, 1:30 PM
Unknown Object (File)
Oct 4 2024, 11:06 PM
Unknown Object (File)
Oct 4 2024, 4:14 PM
Unknown Object (File)
Oct 2 2024, 12:34 PM
Unknown Object (File)
Oct 2 2024, 6:01 AM
Unknown Object (File)
Sep 29 2024, 10:38 PM
Subscribers

Details

Summary

Build and install the subr_unit test program originally written by phk, and run
it with the other ATF test.

tests/sys/kern/Makefile
Build and install the subr_unit test as a plain test

sys/kern/subr_unit.c

  • Reduce the default number of repetitions from 100 to 1, and add a
	  command-line parser to override it.
  • Don't be so noisy by default
  • Fix an include problem for the test build

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3411
Build 3449: arc lint + arc unit

Event Timeline

asomers retitled this revision from to Automate the subr_unit test..
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added reviewers: gibbs, ngie.
tests/sys/kern/Makefile
29

FYI, I'll be able to remove the -Wno-sign-compare after merging D6004

Should a similar approach be used with to tests/sys/kern/acct/acct_test here ?

tests/sys/kern/Makefile
7

Please use SRCTOP instead.

28

This should be fixed...

asomers edited edge metadata.

Use SRCTOP and justify disabling compiler warnings.

tests/sys/kern/Makefile
28

This is a weird one. There are a lot of functions, such as clean_unrhdrl, whose prototypes are in headers that cannot be included in userland. In the test program, though, they're effectively static. There are three options:

  1. Add prototypes in an #ifndef _KERNEL section near the top of subr_unit.c. I don't like this option because it isn't DRY.
  1. Move the relevant prototypes into their own header, subr_unit.h, and include that from systm.h. I don't like this option because it seems heavy-handed and there's no precedent for it.
  1. Add -Wno-missing-prototypes. If you agree that this is better than option 2, then I'll add some comments about why I did it.
sys/kern/subr_unit.c
888

I've probably remove "rather than ... kern" because that can change at a later date.

943

I'd probably use a macro/put this up near the comment about why things are the way they are.

986–989

This is not properly sorted (char* -> long -> int -> u_int -> bool)

996–997

How do you know errno hasn't been set to a different value by another preceding call? The official way to do this (per opengroup) is to set errno = 0, then test out errno after this call: http://pubs.opengroup.org/onlinepubs/7908799/xsh/strtol.html

1019

a != NULL?

ngie edited edge metadata.

LGTM. Thanks!

This revision is now accepted and ready to land.Apr 28 2016, 9:59 PM
This revision was automatically updated to reflect the committed changes.