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)
Sat, Jun 29, 12:25 AM
Unknown Object (File)
Thu, Jun 27, 10:32 PM
Unknown Object (File)
Mon, Jun 24, 1:26 AM
Unknown Object (File)
Tue, Jun 18, 4:57 PM
Unknown Object (File)
Tue, Jun 18, 4:27 PM
Unknown Object (File)
Fri, Jun 14, 10:49 PM
Unknown Object (File)
Fri, Jun 14, 7:12 PM
Unknown Object (File)
May 18 2024, 12:50 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 Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #15412)

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 ↗(On Diff #15412)

Please use SRCTOP instead.

28 ↗(On Diff #15412)

This should be fixed...

asomers edited edge metadata.

Use SRCTOP and justify disabling compiler warnings.

tests/sys/kern/Makefile
28 ↗(On Diff #15412)

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 ↗(On Diff #15506)

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

943 ↗(On Diff #15506)

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

986–989 ↗(On Diff #15506)

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

996–997 ↗(On Diff #15506)

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 ↗(On Diff #15506)

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.