You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/04/12 13:52:56 UTC
[geode-native] branch develop updated: GEODE-4921: Fixes Solaris
issues.
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new 9e3d27b GEODE-4921: Fixes Solaris issues.
9e3d27b is described below
commit 9e3d27b59af3b53703d617577f1d5c35610963d1
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Wed Apr 11 16:47:55 2018 +0000
GEODE-4921: Fixes Solaris issues.
---
cppcache/integration-test-2/framework/Cluster.cpp | 32 ++++++++++++++--------
cppcache/integration-test-2/framework/Cluster.h | 5 +++-
.../integration-test-2/framework/GfshExecute.cpp | 17 ++++++++----
.../integration-test-2/framework/GfshExecute.h | 2 +-
4 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/cppcache/integration-test-2/framework/Cluster.cpp b/cppcache/integration-test-2/framework/Cluster.cpp
index 5f7490a..164f38f 100644
--- a/cppcache/integration-test-2/framework/Cluster.cpp
+++ b/cppcache/integration-test-2/framework/Cluster.cpp
@@ -93,28 +93,38 @@ void Cluster::start() {
{*this, locators_, name_ + "/server/" + std::to_string(i)});
}
+ startLocators();
+
+ startServers();
+
+ // std::cout << "cluster: " << jmxManagerPort_ << ": started" << std::endl;
+ started_ = true;
+}
+
+void Cluster::startServers() {
std::vector<std::future<void>> futures;
- for (auto &locator : locators_) {
- futures.push_back(std::async(std::launch::async, [&] { locator.start(); }));
+ for (auto &server : this->servers_) {
+ futures.push_back(std::async(std::launch::async, [&] { server.start(); }));
}
- // TODO hack until there is a way to either tell servers to retry or wait
- // for single future.
for (auto &future : futures) {
- future.wait();
+ future.get();
}
+}
- for (auto &server : servers_) {
- futures.push_back(std::async(std::launch::async, [&] { server.start(); }));
+void Cluster::startLocators() {
+ std::vector<std::future<void>> futures;
+
+ for (auto &locator : locators_) {
+ futures.push_back(std::async(std::launch::async, [&] { locator.start(); }));
}
+ // TODO hack until there is a way to either tell servers to retry or wait
+ // for single future.
for (auto &future : futures) {
- future.wait();
+ future.get();
}
-
- // std::cout << "cluster: " << jmxManagerPort_ << ": started" << std::endl;
- started_ = true;
}
void Cluster::stop() {
diff --git a/cppcache/integration-test-2/framework/Cluster.h b/cppcache/integration-test-2/framework/Cluster.h
index 794b39e..d273bfc 100644
--- a/cppcache/integration-test-2/framework/Cluster.h
+++ b/cppcache/integration-test-2/framework/Cluster.h
@@ -118,7 +118,7 @@ class Server {
Server(Cluster &cluster, std::vector<Locator> &locators, std::string name)
: cluster_(cluster), locators_(locators), name_(std::move(name)) {
auto hostname = "localhost";
- auto port = Framework::getAvailablePort();
+ auto port = static_cast<uint16_t>(0);
serverAddress_ = ServerAddress{hostname, port};
// start();
@@ -240,6 +240,9 @@ class Cluster {
uint16_t jmxManagerPort_;
GfshExecute gfsh_;
+
+ void startLocators();
+ void startServers();
};
#endif // INTEGRATION_TEST_FRAMEWORK_CLUSTER_H
diff --git a/cppcache/integration-test-2/framework/GfshExecute.cpp b/cppcache/integration-test-2/framework/GfshExecute.cpp
index fb9eb61..fd3ed34 100644
--- a/cppcache/integration-test-2/framework/GfshExecute.cpp
+++ b/cppcache/integration-test-2/framework/GfshExecute.cpp
@@ -39,28 +39,34 @@ void GfshExecute::execute(const std::string &command) {
commands.push_back(command);
auto env = boost::this_process::environment();
+ environment _env = env;
// broken on windows env["JAVA_ARGS"] = "-Xmx1g -client";
ipstream outStream;
ipstream errStream;
- auto gfsh = executeChild(commands, env, outStream, errStream);
+ auto gfsh = executeChild(commands, _env, outStream, errStream);
std::string line;
- while (outStream && std::getline(outStream, line) && !line.empty())
+ while (outStream && std::getline(outStream, line)) {
BOOST_LOG_TRIVIAL(debug) << "Gfsh::execute: " << line;
+ }
- while (errStream && std::getline(errStream, line) && !line.empty())
+ while (errStream && std::getline(errStream, line)) {
BOOST_LOG_TRIVIAL(error) << "Gfsh::execute: " << line;
+ }
gfsh.wait();
+ auto exit_code = gfsh.exit_code();
+ BOOST_LOG_TRIVIAL(debug) << "Gfsh::execute: exit:" << exit_code;
+
extractConnectionCommand(command);
}
boost::process::child GfshExecute::executeChild(
- std::vector<std::string> &commands, boost::process::native_environment &env,
+ std::vector<std::string> &commands, boost::process::environment &env,
boost::process::ipstream &outStream, boost::process::ipstream &errStream) {
using namespace boost::process;
@@ -68,7 +74,6 @@ boost::process::child GfshExecute::executeChild(
// https://github.com/klemens-morgenstern/boost-process/issues/159
std::lock_guard<std::mutex> guard(g_child_mutex);
#endif
-
return child(GFSH_EXECUTABLE, args = commands, env, std_out > outStream,
- std_err > errStream, std_in < null);
+ std_err > errStream);
}
diff --git a/cppcache/integration-test-2/framework/GfshExecute.h b/cppcache/integration-test-2/framework/GfshExecute.h
index 2edda39..e1cd8cf 100644
--- a/cppcache/integration-test-2/framework/GfshExecute.h
+++ b/cppcache/integration-test-2/framework/GfshExecute.h
@@ -59,7 +59,7 @@ class GfshExecute : public Gfsh {
void execute(const std::string &command) override;
boost::process::child executeChild(std::vector<std::string> &commands,
- boost::process::native_environment &env,
+ boost::process::environment &env,
boost::process::ipstream &outStream,
boost::process::ipstream &errStream);
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.