Page MenuHomeFreeBSD

test: sys/sysctl.h is standalone
AbandonedPublic

Authored by imp on Oct 14 2021, 3:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 23, 5:57 AM
Unknown Object (File)
Feb 1 2024, 4:13 AM
Unknown Object (File)
Dec 20 2023, 7:54 AM
Unknown Object (File)
Dec 7 2023, 8:30 PM
Unknown Object (File)
Nov 4 2023, 1:00 PM
Unknown Object (File)
Oct 13 2023, 5:01 AM
Unknown Object (File)
Sep 19 2023, 3:48 AM
Unknown Object (File)
Sep 12 2023, 10:58 AM
Subscribers

Details

Summary

Ensure that sys/sysctl.h can be included standalone.

Sponsored by: Netflix

Diff Detail

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

Event Timeline

imp requested review of this revision.Oct 14 2021, 3:11 PM
imp created this revision.
tests/sys/sys/sysctl_h_self.c
14

But what about headers that might be included by atf-c.h? Can't this just be a standalone C program, not using ATF at all?

Also this is testing the build, not the installed system. I could drop this test on a system where sysctl.h depends on other headers and it'd pass. Perhaps the right form for this test is a shell script which tries to compile a small C program a la autoconf.

tests/sys/sys/sysctl_h_self.c
14

But what about headers that might be included by atf-c.h? Can't this just be a standalone C program, not using ATF at all?

Sure. Since I included it first.

Also this is testing the build, not the installed system. I could drop this test on a system where sysctl.h depends on other headers and it'd pass. Perhaps the right form for this test is a shell script which tries to compile a small C program a la autoconf.

But I like that better. I'll rework with that.

I'm torn... on the one hand I like the idea of building this during MK_TESTS=yes because the build will fail if you break it.
On the other hand, I like being able to test the target system.

I'd personally lean towards breaking the build of the tests, but I'm easy.

There are/were other facilities in ATF that supported compile-time testing, but I think they should be removed, not expanded on.

Maybe it makes sense to instead run cpp and look at the headers output instead of doing this?

Also, this seems like (and I'm going to regret saying this) something that a system like autoconf might excel at (*shudders*).

In D32496#742664, @ngie wrote:

Also, this seems like (and I'm going to regret saying this) something that a system like autoconf might excel at (*shudders*).

It's because of lame autoconf systems that make lame assumptions that I'm doing this... the tests im adding won't be in atf: they will be part of buildworld...