Page MenuHomeFreeBSD

closefrom_test: Convert to atf-c(3)
AcceptedPublic

Authored by jhb on Tue, Sep 30, 3:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 11, 6:56 PM
Unknown Object (File)
Sat, Oct 11, 6:56 PM
Unknown Object (File)
Sat, Oct 11, 10:08 AM
Unknown Object (File)
Thu, Oct 2, 7:52 AM
Unknown Object (File)
Wed, Oct 1, 12:07 AM
Unknown Object (File)
Tue, Sep 30, 10:50 PM
Unknown Object (File)
Tue, Sep 30, 9:04 PM
Unknown Object (File)
Tue, Sep 30, 8:34 PM
Subscribers

Details

Reviewers
markj
ngie

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67412
Build 64295: arc lint + arc unit

Event Timeline

This seems ok to me. We are making some assumptions about the execution environment though; it might be good to somehow guarantee that there are no holes in the fd space when an ATF test starts.

tests/sys/file/closefrom_test.c
124

I'm not really sure why this assertion must be true when the test is running in under a framework it doesn't control.

This test also assumes that all fds up to 2 are open.

This revision is now accepted and ready to land.Wed, Oct 1, 11:00 AM

I'll resume looking at this later. Need to get into the right mindset to make sure the conversion looks good.
Just some minor comments while here...

tests/sys/file/closefrom_test.c
70

__printflike(3, 4) could be added here too.

100–101
tests/sys/file/closefrom_test.c
124

Yeah. That doesn't seem terribly wise... seems better to get the highest fd to start with, then work off that.

tests/sys/file/closefrom_test.c
70

Hmm, I copied this over from ptrace_test and it should probably be fixed there I guess.

77

Here's a place we assume stderr is valid btw. Same in ptrace_test.

124

It is getting the highest fd before opening anything and working off of that. C and POSIX basically require 0/1/2 to be stdin/out/err and be open. That doesn't seem an unreasonable requirement that we are running in a valid POSIX environment?

tests/sys/file/closefrom_test.c
127

Mark points out that this is probably the more interesting assumption as this is assuming that any extra file descriptors opened by the testing framework are "dense". This is probably true normally as you have to go out of your way a bit to get non-dense fds due to POSIX's requirements.

I have tested this both standalone as well as under kyua test FWIW.

tests/sys/file/closefrom_test.c
177–179
185

Should this be _exit(..)?

188–192
204–205
214–218
282–283
295–299