From 3845683a86cc1a7eda3cfc18be5d807a9fdc7b3d Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Fri, 25 Jan 2019 13:28:26 -0800 Subject: [PATCH] define a weak Test::RunTestsImpl() symbol to avoid link errors Summary: The test.cpp file uses `Test::RunTestsImpl()` but previously did not define it. It is instead provided by a separate library at runtime. However, this library itself depends on the library that contains test.cpp, causing a circular dependency. This circular dependencies causes linking to fail depending on the build mode that is used. This fixes the circular dependency issue by making `test.cpp` provide a default `Test::RunTestsImpl()` implementation, but defining it as a weak symbol so that subsequent libraries can override it. Reviewed By: markw65 Differential Revision: D13790133 fbshipit-source-id: 2491a185178ae68514650ef599c276e9c1b6000c --- hphp/test/ext/test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hphp/test/ext/test.cpp b/hphp/test/ext/test.cpp index 4f01b240705..e5b7d0d4749 100644 --- a/hphp/test/ext/test.cpp +++ b/hphp/test/ext/test.cpp @@ -36,6 +36,19 @@ TestLogger Test::logger; /////////////////////////////////////////////////////////////////////////////// +#if FOLLY_HAVE_WEAK_SYMBOLS +// RunTestsImpl is generally expected to be defined by a separate module that +// will be supplied at link time. However, since that module will depend on us +// as a library we need to supply a default implementation here to avoid link +// errors. +FOLLY_ATTR_WEAK void Test::RunTestsImpl(bool& allPassed, std::string& suite, + std::string& which, std::string& + /*set*/) { + printf("RunTestsImpl was not overridden when attempting to " + "run test suite: %s\n", suite.c_str()); +} +#endif + bool Test::RunTests(std::string &suite, std::string &which, std::string &set) { bool allPassed = true; Option::Load(); -- 2.11.4.GIT