summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Testing
Commit message (Collapse)AuthorAgeFilesLines
* [Testing] Move clangd::Annotations to llvm testing supportIlya Biryukov2019-04-252-0/+96
| | | | | | | | | | | | | | | | | | | | | | | Summary: Annotations allow writing nice-looking unit test code when one needs access to locations from the source code, e.g. running code completion at particular offsets in a file. See comments in Annotations.cpp for more details on the API. Also got rid of a duplicate annotations parsing code in clang's code complete tests. Reviewers: gribozavr, sammccall Reviewed By: gribozavr Subscribers: mgorny, hiraditya, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59814 llvm-svn: 359179
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-193-12/+9
| | | | | | | | | | | | | | | | | 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
* Fix error with SmallString implicit conversion.Zachary Turner2018-09-061-3/+1
| | | | llvm-svn: 341597
* Fix a configure issue with Visual Studio generators.Zachary Turner2018-09-061-11/+32
| | | | | | | | | | | | | We can't put the unittest source dir map in the configuration specific directory because VS doesn't have a configure-specific directory, instead it only knows this at runtime. So we have to remove this from the path. This in turn means that the path will be slightly different in VS configurations vs non vs configurations. In the former, the source map will be in the parent directory of the executable, and in the latter it will be in the same directory as the executable. So check both. llvm-svn: 341590
* Quick fix for -DBUILD_SHARED_LIBS=on build after rL341502Fangrui Song2018-09-061-4/+2
| | | | | | | | libLLVMTestingSupport.so references a symbol in utils/unittest/UnitTestMain/TestMain.cpp (a layering issue) and will cause a link error because of -Wl,-z,defs (cmake/modules/HandleLLVMOptions.cmake) Waiting zturner for a better fix. llvm-svn: 341580
* Fix some warnings.Zachary Turner2018-09-061-1/+1
| | | | llvm-svn: 341508
* Fix silly error in unittest helper.Zachary Turner2018-09-051-1/+1
| | | | llvm-svn: 341505
* Add support for unittest inputs.Zachary Turner2018-09-052-0/+37
| | | | | | | | | | | | | | | | | | | | | Occasionally it is useful to have unittest which take inputs. While we normally try to have this test be more of a lit test we occasionally don't have tools that can exercise the code in the right way to test certain things. LLDB has been using this style of unit test for a while, particularly with regards to how it tests core dump and minidump file parsing. Recently i needed this as well for the case where we want to test that some of the PDB reading code works correctly. It needs to exercise the code in a way that is not covered by any dumper and would be impractical to implement in one of the dumpers, but requires a valid PDB file. Since this is now needed by more than one project, it makes sense to have this be a generally supported thing that unit tests can do, and we just encourage people to use this sparingly. Differential Revision: https://reviews.llvm.org/D51561 llvm-svn: 341502
* [LLVMTestingSupport] Add explicit linkage to LLVMSupportMichal Gorny2018-04-081-1/+4
| | | | | | | | | | Explicitly link LLVMTestingSupport library against LLVMSupport. This is necessary to fix linking errors when LLVMTestingSupport is built as a shared library (with BUILD_SHARED_LIBS=ON) and -Wl,-z,defs is used. Differential Revision: https://reviews.llvm.org/D45408 llvm-svn: 329522
* [Testing/Support]: Better matching of Error failure statesPavel Labath2018-04-051-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The existing Failed() matcher only allowed asserting that the operation failed, but it was not possible to verify any details of the returned error. This patch adds two new matchers, which make this possible: - Failed<InfoT>() verifies that the operation failed with a single error of a given type. - Failed<InfoT>(M) additionally check that the contained error info object is matched by the nested matcher M. To make these work, I've changed the implementation of the ErrorHolder class. Now, instead of just storing the string representation of the Error, it fetches the ErrorInfo objects and stores then as a list of shared pointers. This way, ErrorHolder remains copyable, while still retaining the full information contained in the Error object. In case the Error object contains two or more errors, the new matchers will fail to match, instead of trying to match all (or any) of the individual ErrorInfo objects. This seemed to be the most sensible behavior for when one wants to match exact error details, but I could be convinced otherwise... Reviewers: zturner, lhames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44925 llvm-svn: 329288
* Force #define GTEST_LANG_CXX11.Zachary Turner2017-10-271-0/+3
| | | | | | | | | | | | | | | | | | gtest depends on this #define to determine whether it can use various classes like std::tuple, or whether it has to fall back to experimental classes in the std::tr1 namespace. The check in the current version of gtest relies on the value of the `__cplusplus` macro, but MSVC provides a non-conformant value of this macro, making it effectively impossible to detect C++11. In short, LLVM compiled with MSVC has been silently using the tr1 versions of several classes since the beginning of time. This would normally be pretty benign, except that in the latest preview of MSVC they have marked all of the tr1 classes deprecated, so it spews thousands of warnings. llvm-svn: 316798
* Mark LLVMTestingSupport as not installed in LLVMBuild.Zachary Turner2017-06-191-0/+1
| | | | | | This is causing downstream issues with llvm-config. llvm-svn: 305754
* [gtest] Create a shared include directory for gtest utilities.Zachary Turner2017-06-145-0/+76
Many times unit tests for different libraries would like to use the same helper functions for checking common types of errors. This patch adds a common library with helpers for testing things in Support, and introduces helpers in here for integrating the llvm::Error and llvm::Expected<T> classes with gtest and gmock. Normally, we would just be able to write: EXPECT_THAT(someFunction(), succeeded()); but due to some quirks in llvm::Error's move semantics, gmock doesn't make this easy, so two macros EXPECT_THAT_ERROR() and EXPECT_THAT_EXPECTED() are introduced to gloss over the difficulties. Consider this an exception, and possibly only temporary as we look for ways to improve this. Differential Revision: https://reviews.llvm.org/D33059 llvm-svn: 305395
OpenPOWER on IntegriCloud