Page MenuHomeFreeBSD

test: sys/sysctl.h is standalone
AbandonedPublic

Authored by imp on Oct 14 2021, 3:11 PM.

Details

Summary

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

Sponsored by: Netflix

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit 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
13

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
13

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...