Commit 932cba0f authored by Andrew Gallagher's avatar Andrew Gallagher Committed by facebook-github-bot-1

folly: fix tests running under buck (w/ clang and dynamic linking)

Summary: Various fixes to get tests passing using buck's dev mode.

Reviewed By: @yfeldblum

Differential Revision: D2299981
parent e0de0a27
...@@ -34,13 +34,23 @@ TEST(Symbolizer, Single) { ...@@ -34,13 +34,23 @@ TEST(Symbolizer, Single) {
ASSERT_TRUE(symbolizer.symbolize(reinterpret_cast<uintptr_t>(foo), a)); ASSERT_TRUE(symbolizer.symbolize(reinterpret_cast<uintptr_t>(foo), a));
EXPECT_EQ("folly::symbolizer::test::foo()", a.demangledName()); EXPECT_EQ("folly::symbolizer::test::foo()", a.demangledName());
auto path = a.location.file.toString(); // The version of clang we use doesn't generate a `.debug_aranges` section,
folly::StringPiece basename(path); // which the symbolizer needs to lookup the filename.
auto pos = basename.rfind('/'); constexpr bool built_with_clang =
if (pos != folly::StringPiece::npos) { #ifdef __clang__
basename.advance(pos + 1); true;
#else
false;
#endif
if (!built_with_clang) {
auto path = a.location.file.toString();
folly::StringPiece basename(path);
auto pos = basename.rfind('/');
if (pos != folly::StringPiece::npos) {
basename.advance(pos + 1);
}
EXPECT_EQ("SymbolizerTest.cpp", basename.str());
} }
EXPECT_EQ("SymbolizerTest.cpp", basename.str());
} }
FrameArray<100> goldenFrames; FrameArray<100> goldenFrames;
......
...@@ -26,8 +26,12 @@ namespace folly { namespace test { ...@@ -26,8 +26,12 @@ namespace folly { namespace test {
namespace { namespace {
std::string getHelperPath() { std::string getHelperPath() {
const auto basename = "nested_command_line_app_test_helper";
auto path = fs::executable_path(); auto path = fs::executable_path();
path.remove_filename() /= "nested_command_line_app_test_helper"; path.remove_filename() /= basename;
if (!fs::exists(path)) {
path = path.parent_path().parent_path() / basename / basename;
}
return path.native(); return path.native();
} }
......
...@@ -27,8 +27,12 @@ namespace folly { namespace test { ...@@ -27,8 +27,12 @@ namespace folly { namespace test {
namespace { namespace {
std::string getHelperPath() { std::string getHelperPath() {
const auto basename = "program_options_test_helper";
auto path = fs::executable_path(); auto path = fs::executable_path();
path.remove_filename() /= "program_options_test_helper"; path.remove_filename() /= basename;
if (!fs::exists(path)) {
path = path.parent_path().parent_path() / basename / basename;
}
return path.native(); return path.native();
} }
......
...@@ -243,7 +243,7 @@ TEST(DynamicConverter, crazy) { ...@@ -243,7 +243,7 @@ TEST(DynamicConverter, crazy) {
dynamic dynamic
dv1 = {}, dv1 = {},
dv2 = { ds1, ds2 }, dv2 = { ds1, ds2 },
dv3 = { ds3 }; dv3({ ds3 });
dynamic dynamic
dm1 = dynamic::object(true, dv1)(false, dv2), dm1 = dynamic::object(true, dv1)(false, dv2),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment