This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Refactor & update of EditlineTest
Needs ReviewPublic

Authored by nealsid on Dec 9 2021, 3:33 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch has a few minor cleanups and a restructuring of the EditlineTest class:

Cleanups:

  • Adds some comments to member variables
  • Renames _editline_sp to _editline_up to reflect that it's a unique_ptr
  • Create a debug macro for ConsumeAllOutput when EDITLINE_DUMP_OUTPUT is 1
  • Rename _sp_output_thread to output_read_thread since it's no longer a shared pointer.

Restructuring:

  • Merge EditlineAdapter and EditlineTestFixture. EditLineAdapter is a useful separation, but is only used by EditlineTestFixture. It's a perfectly fine pattern to put test state & helper methods in the test fixture class, which is what this patch does.
  • Remove FilePointer, which is an RAII class for FILE* pointers. We used it in two locations, which are to store FILE* variables for the pty file handles. In the primary case, the Pseudoterminal class already closes the handle in it's destructor, so we don't need to (and were actually causing a harmless double close of the handle), and in the second case, we need to manage the handle close ourselves anyway, because some tests need to close the handle manually as part of their test case.

Diff Detail

Event Timeline

nealsid created this revision.Dec 9 2021, 3:33 PM
nealsid requested review of this revision.Dec 9 2021, 3:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2021, 3:33 PM
nealsid edited the summary of this revision. (Show Details)Dec 9 2021, 3:39 PM
nealsid edited the summary of this revision. (Show Details)