summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Host/MainLoopTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add a SubsystemRAII that takes care of calling Initialize and ↵Raphael Isemann2019-12-231-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Terminate in the unit tests Summary: Many of our tests need to initialize certain subsystems/plugins of LLDB such as `FileSystem` or `HostInfo` by calling their static `Initialize` functions before the test starts and then calling `::Terminate` after the test is done (in reverse order). This adds a lot of error-prone boilerplate code to our testing code. This patch adds a RAII called SubsystemRAII that ensures that we always call ::Initialize and then call ::Terminate after the test is done (and that the Terminate calls are always in the reverse order of the ::Initialize calls). It also gets rid of all of the boilerplate that we had for these calls. Per-fixture initialization is still not very nice with this approach as it would require some kind of static unique_ptr that gets manually assigned/reseted from the gtest SetUpTestCase/TearDownTestCase functions. Because of that I changed all per-fixture setup to now do per-test setup which can be done by just having the SubsystemRAII as a member of the test fixture. This change doesn't influence our normal test runtime as LIT anyway runs each test case separately (and the Initialize/Terminate calls are anyway not very expensive). It will however make running all tests in a single executable slightly slower. Reviewers: labath, JDevlieghere, martong, espindola, shafik Reviewed By: labath Subscribers: mgorny, rnkovacs, emaste, MaskRay, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71630
* [lldb] [unittest] Reenable MainLoopTest.DetectsEOF on NetBSDMichał Górny2019-11-181-4/+0
| | | | | The underlying issue is already fixed in the NetBSD kernel for some time, so we can finally reenable the test.
* [LLDB] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368933
* [lldb-server] Introduce Socket::Initialize and Terminate to simply WSASocket ↵Aaron Smith2019-04-101-9/+3
| | | | | | | | | | | | | | | | setup Reviewers: zturner, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D60440 llvm-svn: 358044
* [lldb] [MainLoop] Add kevent() EINTR handlingMichal Gorny2019-02-151-0/+24
| | | | | | | | | | | | | Add missing EINTR handling for kevent() calls. If the call is interrupted, return from Poll() as if zero events were returned and let the polling resume on next iteration. This fixes test flakiness on NetBSD. Includes a test case suggested by Pavel Labath on D42206. Differential Revision: https://reviews.llvm.org/D58230 llvm-svn: 354122
* [lldb] [unittests] Disable MainLoopTest::DetectsEOF on NetBSDMichal Gorny2019-02-081-0/+5
| | | | | | | | | | The NetBSD kernel currently does not support detecting closed slave pty via kevent on master pty. This causes the test to hang forever. To avoid that, disable the test until the kernel is fixed. Differential Revision: https://reviews.llvm.org/D57912 llvm-svn: 353545
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Move PseudoTerminal to the lldb_private namespacePavel Labath2017-12-111-1/+1
| | | | | | | lldb_utility doesn't make sense, as it is no longer even living in the "utility" module. llvm-svn: 320346
* MainLoop: avoid infinite loop when pty slave gets closedPavel Labath2017-12-111-0/+20
| | | | | | | | | | | | | | | | | | | | | Summary: For ptys (at least on Linux), the end-of-file (closing of the slave FD) is signalled by the POLLHUP flag. We were ignoring this flag, which meant that when this happened, we would spin in a loop, continuously calling poll(2) and not making any progress. This makes sure we treat POLLHUP as a read event (reading will return 0), and we call the registered callback when it happens. This is the behavior our clients expect (and is consistent with how select(2) works). Reviewers: eugene, beanz Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D41008 llvm-svn: 320345
* Rename Error -> Status.Zachary Turner2017-05-121-5/+5
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* MainLoop: Add unit testsPavel Labath2017-05-041-0/+120
Summary: This adds a couple of unit tests to the MainLoop class. To get the kqueue based version of the signal handling passing, I needed to modify the implementation a bit to make the queue object persistent. Otherwise, only the signals which are send during the Run call would get processed, which did not match the ppoll behaviour. I also took the opportunity to remove the ForEach template functions and replace them with something more reasonable. Reviewers: beanz, eugene Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D32753 llvm-svn: 302133
OpenPOWER on IntegriCloud