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) {
ASSERT_TRUE(symbolizer.symbolize(reinterpret_cast<uintptr_t>(foo), a));
EXPECT_EQ("folly::symbolizer::test::foo()", a.demangledName());
auto path = a.location.file.toString();
folly::StringPiece basename(path);
auto pos = basename.rfind('/');
if (pos != folly::StringPiece::npos) {
basename.advance(pos + 1);
// The version of clang we use doesn't generate a `.debug_aranges` section,
// which the symbolizer needs to lookup the filename.
constexpr bool built_with_clang =
#ifdef __clang__
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;
......
......@@ -26,8 +26,12 @@ namespace folly { namespace test {
namespace {
std::string getHelperPath() {
const auto basename = "nested_command_line_app_test_helper";
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();
}
......
......@@ -27,8 +27,12 @@ namespace folly { namespace test {
namespace {
std::string getHelperPath() {
const auto basename = "program_options_test_helper";
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();
}
......
......@@ -243,7 +243,7 @@ TEST(DynamicConverter, crazy) {
dynamic
dv1 = {},
dv2 = { ds1, ds2 },
dv3 = { ds3 };
dv3({ ds3 });
dynamic
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