summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Host/HostInfoTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add a SubsystemRAII that takes care of calling Initialize and ↵Raphael Isemann2019-12-231-9/+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
* Clear the output string passed to GetHostName()Aaron Smith2019-04-171-0/+6
| | | | | | | | LLVM's wchar to UTF8 conversion routine expects an empty string to store the output. GetHostName() on Windows is sometimes called with a non-empty string which triggers an assert. The simple fix is to clear the output string before the conversion. llvm-svn: 358550
* 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
* Remove header grouping comments.Jonas Devlieghere2018-11-111-1/+1
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* [FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere2018-10-311-6/+13
| | | | | | | | | | | | | | | | This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
* Remove dependency from Host to clang.Zachary Turner2018-06-041-60/+1
| | | | | | | | | | Host depended on clang because HostInfo had a function to get the directory where clang was installed. We move this over to the clang expression parser plugin where it's more at home. Differential Revision: https://reviews.llvm.org/D47384 llvm-svn: 333933
* HostInfoMacOSX: Support finding the clang resource directory within CLTools.Adrian Prantl2018-05-251-0/+8
| | | | | | rdar://problem/40537961 llvm-svn: 333248
* Avoid using header from Host/macosx when not testing an apple build.James Y Knight2018-05-221-2/+6
| | | | llvm-svn: 333032
* Conditionally compile a Darwin-only test.Adrian Prantl2018-05-111-0/+2
| | | | llvm-svn: 332140
* Yet another follow-up to r332111. This also handles the case where anAdrian Prantl2018-05-111-5/+5
| | | | | | | LLDB.framework is built inside the LLDB build directory (but not inside an Xcode installation). llvm-svn: 332126
* Fix a regression in r332111. The LLDB.framework path component is notAdrian Prantl2018-05-111-1/+7
| | | | | | usually the last component. llvm-svn: 332120
* HostInfoMacOSX: Share the clang resource directory with Swift.Adrian Prantl2018-05-111-0/+40
| | | | | | | | | | | | | Inside Xcode and in Xcode toolchains LLDB is always in lockstep with the Swift compiler, so it can reuse its Clang resource directory. This allows LLDB and the Swift compiler to share the same Clang module cache. rdar://problem/40039633 Differential Revision: https://reviews.llvm.org/D46736 llvm-svn: 332111
* Remove last Host usage from ArchSpecPavel Labath2017-11-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: In D39387, I was quick to jump to conclusion that ArchSpec has no external dependencies. It turns there still was one call to HostInfo::GetArchitecture left -- for implementing the "systemArch32" architecture and friends. Since GetAugmentedArchSpec is the place we handle these "incomplete" triples that don't specify os or vendor and "systemArch" looks very much like an incomplete triple, I move its handling there. After this ArchSpec *really* does not have external dependencies, and I'll move it to the Utility module as a follow-up. Reviewers: zturner, clayborg, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D39896 llvm-svn: 318046
* Invert ArchSpec<->Platform dependencyPavel Labath2017-10-311-0/+40
Summary: ArchSpec::SetTriple was taking a Platform as an argument, and used it to fill in missing pieces of the specified triple. I invert the dependency by moving this code to other classes. For this purpose, I've created three new functions. - HostInfo::GetAugmentedArchSpec: fills in the triple using the host platform (this used to be implemented by passing a null platform pointer). By putting this code in the Host module, we can provide a way to anyone who does not have a platform instance (lldb-server) an easy way to get Host data. - Platform::GetAugmentedArchSpec: if you have a platform instance, you can call this to let it fill in the triple. - static Platform::GetAugmentedArchSpec: implements the "if platform == 0 then use_host() else use_platform()" part. Reviewers: zturner, jingham, clayborg Subscribers: mgorny, javed.absar, lldb-commits Differential Revision: https://reviews.llvm.org/D39387 llvm-svn: 316987
OpenPOWER on IntegriCloud