/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <folly/FileUtil.h>
#include <folly/Subprocess.h>
#include <folly/experimental/io/FsUtil.h>
+#include <folly/portability/GTest.h>
#include <glog/logging.h>
-#include <gtest/gtest.h>
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";
- return path.native();
+ path.remove_filename() /= basename;
+ if (!fs::exists(path)) {
+ path = path.parent_path().parent_path() / basename / basename;
+ }
+ return path.string();
}
std::string callHelper(ProgramOptionsStyle style,
break;
}
- Subprocess proc(allArgs, Subprocess::pipeStdout(), nullptr, &env);
+ Subprocess proc(allArgs, Subprocess::Options().pipeStdout(), nullptr, &env);
auto p = proc.communicate();
EXPECT_EQ(0, proc.wait().exitStatus());
return p.first;
}
-} // namespace
+} // namespace
// name value