Often different tests in different test executables need to do the same thing. Historically, we have always just copied large blocks of code between tests to solve this. For example, if a function returns an llvm::Error, then we would like to have some set of EXPECT / ASSERT macros that can handle them in the canonical gtest fashion, and these should be shared among all tests. Currently we have no such place to put code of this nature.
This patch adds such a location in llvm/Support/gtest. For now it's header only, but in the future it could be extended to have a library component as well that is force linked into all unittest targets.
Additional use cases of this could include adding asserts and expect macros for std::error_code, or adding various mock objects to be used alongside gmock (think: ASSERT_THAT(ElementExists(Vec, 7)).
In this patch, I take two instances of the same copied file that contains macros for expecting and asserting on llvm::Errors, and move them to this shared directory, then include the shared file.
I would call this 'LLVMTestingSupport' to match the directory name I guess?