From 96be388882c179b1454f5c060a187597b9dc2654 Mon Sep 17 00:00:00 2001 From: Andrew Gallagher Date: Wed, 24 Sep 2014 18:36:16 -0700 Subject: [PATCH] Add and fix BUCK files for folly Summary: This gets almost all of folly building with buck. There are a few cases we don't support yet (custom test wrappers for spooky test binaries, dlopen-enabled exception tracer binary, etc), but the vast majority is covered. Test Plan: built all build targets and ran all tests buck Reviewed By: sdwilsh@fb.com Subscribers: tjackson, sdwilsh, fugalh, njormrod FB internal diff: D1577256 Tasks: 5055879 --- folly/test/FileTest.cpp | 18 +++++++++++++++--- folly/test/FutexTest.cpp | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/folly/test/FileTest.cpp b/folly/test/FileTest.cpp index 9a1d3af5..67021814 100644 --- a/folly/test/FileTest.cpp +++ b/folly/test/FileTest.cpp @@ -147,9 +147,21 @@ TEST(File, Locks) { CHECK_ERR(r); buf[r] = '\0'; - fs::path helper(buf); - helper.remove_filename(); - helper /= "file_test_lock_helper"; + // NOTE(agallagher): Our various internal build systems layout built + // binaries differently, so the two layouts below. + fs::path me(buf); + auto helper_basename = "file_test_lock_helper"; + fs::path helper; + if (fs::exists(me.parent_path() / helper_basename)) { + helper = me.parent_path() / helper_basename; + } else if (fs::exists( + me.parent_path().parent_path() / helper_basename / helper_basename)) { + helper = me.parent_path().parent_path() + / helper_basename / helper_basename; + } else { + throw std::runtime_error( + folly::to("cannot find helper ", helper_basename)); + } TemporaryFile tempFile; File f(tempFile.fd()); diff --git a/folly/test/FutexTest.cpp b/folly/test/FutexTest.cpp index ae23c655..c1063cf8 100644 --- a/folly/test/FutexTest.cpp +++ b/folly/test/FutexTest.cpp @@ -22,8 +22,8 @@ #include #include +#include #include -#include #include using namespace folly::detail; -- 2.34.1