Page MenuHomeFreeBSD

pwait: Test the new -r option
ClosedPublic

Authored by des on Tue, Jul 21, 8:08 PM.
Tags
None
Referenced Files
F164879286: D58385.diff
Tue, Aug 4, 11:07 AM
F164809805: D58385.id.diff
Tue, Aug 4, 3:57 AM
F164800346: D58385.id182621.diff
Tue, Aug 4, 2:54 AM
F164792870: D58385.id182771.diff
Tue, Aug 4, 2:07 AM
F164788585: D58385.id182418.diff
Tue, Aug 4, 1:48 AM
F164785193: D58385.id182418.diff
Tue, Aug 4, 1:05 AM
F164782964: D58385.id182771.diff
Tue, Aug 4, 12:39 AM
Unknown Object (File)
Mon, Aug 3, 10:50 PM
Subscribers

Details

Summary

Test that pwait without -r reports a process as soon as it terminates,
while pwait with -r does not report it until it has been reaped.

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.

Diff Detail

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

Event Timeline

des requested review of this revision.Tue, Jul 21, 8:08 PM
des retitled this revision from pwait: Test that pwait does not report zombies to pwait: Test the new -r option.Wed, Jul 22, 8:16 AM
des edited the summary of this revision. (Show Details)
des edited the summary of this revision. (Show Details)

new behavior is now optional, test both variants

bin/pwait/tests/pwait_reap.c
125 ↗(On Diff #182443)

Why not using posix_spawn() there?

135 ↗(On Diff #182443)

You are not waiting for the termination there, wait_zero(false) only checks for termination and asserts if not. As the consequence, the test is racy, since nothing guarantees that the target has exited when waitpid() is called.

bin/pwait/tests/pwait_reap.c
125 ↗(On Diff #182443)

What would be the advantage?

135 ↗(On Diff #182443)

I think you're confusing WNOWAIT with WNOHANG.

bin/pwait/tests/pwait_reap.c
125 ↗(On Diff #182443)

That the used API is specifically designed for the task at hand.

135 ↗(On Diff #182443)

No, I do not. Re-read what I wrote: wait_zero(false) may assert falsely.

bin/pwait/tests/pwait_reap.c
135 ↗(On Diff #182443)

No. It will block until the target terminates. It will fail if interrupted, but I don't consider that a problem.

This revision is now accepted and ready to land.Fri, Jul 24, 10:02 PM
This revision was automatically updated to reflect the committed changes.
bin/pwait/tests/pwait_reap.c
169 ↗(On Diff #182771)

Shouldn't this be pwait_reap_test(false)?

bin/pwait/tests/pwait_reap.c
169 ↗(On Diff #182771)

You're right, will fix.