This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Test] Always set the cleanupSubprocesses tear down hook
ClosedPublic

Authored by JDevlieghere on Jul 14 2020, 9:39 AM.

Details

Summary

Always set the cleanupSubprocesses tear down hook when using spawnSubprocess or forkSubprocess instead of relying on the caller to do so. This is not only less error prone but also means the tests can be more concise.

Diff Detail

Event Timeline

JDevlieghere created this revision.Jul 14 2020, 9:39 AM
This revision is now accepted and ready to land.Jul 14 2020, 10:26 AM

I suppose this might have been because someone wanted to ensure cleanupSubprocesses is not called twice (if multiple subprocesses are spawned). It looks like it should be safe to do so, though it's not completely ideal. TBH, I'm not sure why this needs to be a tear down "hook". I t seems like this could just be a separate step in the normal tearDown function...

shafik added a subscriber: shafik.Jul 14 2020, 10:28 AM

Curious, why didn't we do it this way before?

I suppose this might have been because someone wanted to ensure cleanupSubprocesses is not called twice (if multiple subprocesses are spawned). It looks like it should be safe to do so, though it's not completely ideal. TBH, I'm not sure why this needs to be a tear down "hook". I t seems like this could just be a separate step in the normal tearDown function...

Makes sense, I'll move it in the regular teardown.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2020, 2:06 PM