summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-07-20 10:49:58 +0200
committerGitHub <noreply@github.com>2020-07-20 10:49:58 +0200
commit9ba56dd4bcab7cad71f04737cf858a76236a5acf (patch)
treef9ff2bd25872e2a0368b340c4734b873002b7a52
parentd0de44f2d5bf59a116edb10a09935e791cbbcd23 (diff)
parentf059e8ebe82d51c40ee1d488a7a30bec1d87caed (diff)
Merge pull request #13921 from vespa-engine/arnej/child-proc
Arnej/child proc
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/configdefs/a.def2
-rw-r--r--fnet/src/tests/examples/examples_test.cpp54
-rw-r--r--searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp4
-rw-r--r--searchcore/src/tests/proton/flushengine/flushengine_test.cpp2
-rw-r--r--searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp12
-rw-r--r--staging_vespalib/src/tests/state_server/state_server_test.cpp4
-rw-r--r--vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp8
-rw-r--r--vbench/src/tests/app_vbench/app_vbench_test.cpp14
-rw-r--r--vespalib/CMakeLists.txt2
-rw-r--r--vespalib/src/tests/assert/assert_test.cpp8
-rw-r--r--vespalib/src/tests/child_process/.gitignore4
-rw-r--r--vespalib/src/tests/child_process/CMakeLists.txt8
-rw-r--r--vespalib/src/tests/child_process/child_process_test.cpp (renamed from vespalib/src/tests/slaveproc/slaveproc_test.cpp)36
-rw-r--r--vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp10
-rw-r--r--vespalib/src/tests/exception_classes/silenceuncaught_test.cpp16
-rw-r--r--vespalib/src/tests/host_name/host_name_test.cpp2
-rw-r--r--vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp4
-rw-r--r--vespalib/src/tests/slaveproc/.gitignore4
-rw-r--r--vespalib/src/tests/slaveproc/CMakeLists.txt8
-rw-r--r--vespalib/src/tests/tutorial/make_tutorial.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/util/CMakeLists.txt2
-rw-r--r--vespalib/src/vespa/vespalib/util/child_process.cpp (renamed from vespalib/src/vespa/vespalib/util/slaveproc.cpp)56
-rw-r--r--vespalib/src/vespa/vespalib/util/child_process.h (renamed from vespalib/src/vespa/vespalib/util/slaveproc.h)18
-rw-r--r--vespamalloc/src/tests/doubledelete/expectsignal.cpp4
-rw-r--r--vespamalloc/src/tests/overwrite/expectsignal.cpp4
25 files changed, 145 insertions, 145 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/configdefs/a.def b/configserver/src/test/java/com/yahoo/vespa/config/server/configdefs/a.def
index bf99c65ec14..e2f22a38fc3 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/configdefs/a.def
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/configdefs/a.def
@@ -29,7 +29,7 @@ config[].role string
config[].id reference
## Wether the NC should start the corresponding role using the
-## slavewrapper utility application or not.
+## wrapper utility application or not.
config[].usewrapper bool default=false
routingtable[].hop[].name string
diff --git a/fnet/src/tests/examples/examples_test.cpp b/fnet/src/tests/examples/examples_test.cpp
index c704c58abc9..8f13aca0898 100644
--- a/fnet/src/tests/examples/examples_test.cpp
+++ b/fnet/src/tests/examples/examples_test.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/thread.h>
#include <atomic>
@@ -10,9 +10,9 @@
static const int PORT0 = 18570;
static const int PORT1 = 18571;
-using vespalib::SlaveProc;
+using vespalib::ChildProcess;
-bool runProc(SlaveProc &proc, std::atomic<bool> &done) {
+bool runProc(ChildProcess &proc, std::atomic<bool> &done) {
char buf[4096];
proc.close(); // close stdin
while (proc.running() && !done) {
@@ -38,7 +38,7 @@ bool runProc(const std::string &cmd) {
vespalib::Thread::sleep(500);
}
std::atomic<bool> done(false);
- SlaveProc proc(cmd.c_str());
+ ChildProcess proc(cmd.c_str());
ok = runProc(proc, done);
}
return ok;
@@ -47,60 +47,60 @@ bool runProc(const std::string &cmd) {
TEST("usage") {
std::atomic<bool> done(false);
{
- SlaveProc proc("exec ../../examples/proxy/fnet_proxy_app");
+ ChildProcess proc("exec ../../examples/proxy/fnet_proxy_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/ping/fnet_pingserver_app");
+ ChildProcess proc("exec ../../examples/ping/fnet_pingserver_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/ping/fnet_pingclient_app");
+ ChildProcess proc("exec ../../examples/ping/fnet_pingclient_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/fnet_rpc_client_app");
+ ChildProcess proc("exec ../../examples/frt/rpc/fnet_rpc_client_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/fnet_rpc_server_app");
+ ChildProcess proc("exec ../../examples/frt/rpc/fnet_rpc_server_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/fnet_echo_client_app");
+ ChildProcess proc("exec ../../examples/frt/rpc/fnet_echo_client_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/vespa-rpc-info");
+ ChildProcess proc("exec ../../examples/frt/rpc/vespa-rpc-info");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/vespa-rpc-invoke-bin");
+ ChildProcess proc("exec ../../examples/frt/rpc/vespa-rpc-invoke-bin");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/fnet_rpc_callback_server_app");
+ ChildProcess proc("exec ../../examples/frt/rpc/fnet_rpc_callback_server_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/fnet_rpc_callback_client_app");
+ ChildProcess proc("exec ../../examples/frt/rpc/fnet_rpc_callback_client_app");
EXPECT_FALSE(runProc(proc, done));
}
{
- SlaveProc proc("exec ../../examples/frt/rpc/vespa-rpc-proxy");
+ ChildProcess proc("exec ../../examples/frt/rpc/vespa-rpc-proxy");
EXPECT_FALSE(runProc(proc, done));
}
}
TEST("timeout") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("exec ../../examples/timeout/fnet_timeout_app", out));
+ EXPECT_TRUE(ChildProcess::run("exec ../../examples/timeout/fnet_timeout_app", out));
fprintf(stderr, "%s\n", out.c_str());
}
TEST_MT_F("ping", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/ping/fnet_pingserver_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/ping/fnet_pingserver_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -114,7 +114,7 @@ TEST_MT_F("ping", 2, std::atomic<bool>()) {
TEST_MT_F("ping times out", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -128,12 +128,12 @@ TEST_MT_F("ping times out", 2, std::atomic<bool>()) {
TEST_MT_F("ping with proxy", 3, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/ping/fnet_pingserver_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/ping/fnet_pingserver_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
} else if (thread_id == 1) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/proxy/fnet_proxy_app tcp/%d tcp/localhost:%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/proxy/fnet_proxy_app tcp/%d tcp/localhost:%d",
PORT1, PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -147,7 +147,7 @@ TEST_MT_F("ping with proxy", 3, std::atomic<bool>()) {
TEST_MT_F("rpc client server", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -161,7 +161,7 @@ TEST_MT_F("rpc client server", 2, std::atomic<bool>()) {
TEST_MT_F("rpc echo client", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -175,7 +175,7 @@ TEST_MT_F("rpc echo client", 2, std::atomic<bool>()) {
TEST_MT_F("rpc info", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -191,7 +191,7 @@ TEST_MT_F("rpc info", 2, std::atomic<bool>()) {
TEST_MT_F("rpc invoke", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -206,7 +206,7 @@ TEST_MT_F("rpc invoke", 2, std::atomic<bool>()) {
TEST_MT_F("rpc callback client server", 2, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_callback_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_callback_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
@@ -220,12 +220,12 @@ TEST_MT_F("rpc callback client server", 2, std::atomic<bool>()) {
TEST_MT_F("rpc callback client server with proxy", 3, std::atomic<bool>()) {
if (thread_id == 0) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_callback_server_app tcp/%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/fnet_rpc_callback_server_app tcp/%d",
PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
} else if (thread_id == 1) {
- SlaveProc proc(vespalib::make_string("exec ../../examples/frt/rpc/vespa-rpc-proxy tcp/%d tcp/localhost:%d",
+ ChildProcess proc(vespalib::make_string("exec ../../examples/frt/rpc/vespa-rpc-proxy tcp/%d tcp/localhost:%d",
PORT1, PORT0).c_str());
TEST_BARRIER();
EXPECT_TRUE(runProc(proc, f1));
diff --git a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp
index 7488fc633fd..f034ccdd6d1 100644
--- a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp
+++ b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp
@@ -13,7 +13,7 @@
#include <vespa/messagebus/network/rpcnetworkparams.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/signalhandler.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/config/common/exceptions.h>
@@ -207,7 +207,7 @@ App::Main()
route.c_str(), feedFile.c_str()));
fprintf(stderr, "running feed command: %s\n", feedCmd.c_str());
std::string feederOutput;
- bool feedingOk = vespalib::SlaveProc::run(feedCmd.c_str(), feederOutput);
+ bool feedingOk = vespalib::ChildProcess::run(feedCmd.c_str(), feederOutput);
if (!feedingOk) {
fprintf(stderr, "error: feed command failed\n");
fprintf(stderr, "feed command output:\n-----\n%s\n-----\n", feederOutput.c_str());
diff --git a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
index b5bcd65cd33..dbfbbd16820 100644
--- a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
+++ b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
@@ -162,7 +162,7 @@ public:
return wrappedTargets;
}
- // Called once by flush engine slave thread for each task done
+ // Called once by flush engine thread for each task done
void taskDone()
{
std::lock_guard<std::mutex> guard(_lock);
diff --git a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp
index fd7069c618a..2f5ee2f22cb 100644
--- a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp
+++ b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchlib/fef/indexproperties.h>
@@ -154,7 +154,7 @@ struct Model {
}
bool verify() {
generate();
- return vespalib::SlaveProc::run(vespalib::make_string("%s dir:%s", prog, gen_dir.c_str()).c_str());
+ return vespalib::ChildProcess::run(vespalib::make_string("%s dir:%s", prog, gen_dir.c_str()).c_str());
}
void verify_valid(std::initializer_list<std::string> features) {
for (const std::string &f: features) {
@@ -207,12 +207,12 @@ struct ShadowModel : Model {
};
TEST_F("print usage", Model()) {
- EXPECT_TRUE(!vespalib::SlaveProc::run(vespalib::make_string("%s", prog).c_str()));
+ EXPECT_TRUE(!vespalib::ChildProcess::run(vespalib::make_string("%s", prog).c_str()));
}
TEST_F("setup output directory", Model()) {
- ASSERT_TRUE(vespalib::SlaveProc::run(vespalib::make_string("rm -rf %s", gen_dir.c_str()).c_str()));
- ASSERT_TRUE(vespalib::SlaveProc::run(vespalib::make_string("mkdir %s", gen_dir.c_str()).c_str()));
+ ASSERT_TRUE(vespalib::ChildProcess::run(vespalib::make_string("rm -rf %s", gen_dir.c_str()).c_str()));
+ ASSERT_TRUE(vespalib::ChildProcess::run(vespalib::make_string("mkdir %s", gen_dir.c_str()).c_str()));
}
//-----------------------------------------------------------------------------
@@ -317,7 +317,7 @@ TEST_F("require that imported attribute field can be used by rank feature", Simp
//-----------------------------------------------------------------------------
TEST_F("cleanup files", Model()) {
- ASSERT_TRUE(vespalib::SlaveProc::run(vespalib::make_string("rm -rf %s", gen_dir.c_str()).c_str()));
+ ASSERT_TRUE(vespalib::ChildProcess::run(vespalib::make_string("rm -rf %s", gen_dir.c_str()).c_str()));
}
TEST_MAIN_WITH_PROCESS_PROXY() { TEST_RUN_ALL(); }
diff --git a/staging_vespalib/src/tests/state_server/state_server_test.cpp b/staging_vespalib/src/tests/state_server/state_server_test.cpp
index e61d3d216cd..2a07de10968 100644
--- a/staging_vespalib/src/tests/state_server/state_server_test.cpp
+++ b/staging_vespalib/src/tests/state_server/state_server_test.cpp
@@ -12,7 +12,7 @@
#include <vespa/vespalib/net/simple_metrics_producer.h>
#include <vespa/vespalib/net/simple_component_config_producer.h>
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/net/state_explorer.h>
#include <vespa/vespalib/net/slime_explorer.h>
#include <vespa/vespalib/net/generic_state_handler.h>
@@ -40,7 +40,7 @@ std::map<vespalib::string,vespalib::string> empty_params;
vespalib::string run_cmd(const vespalib::string &cmd) {
std::string out;
- ASSERT_TRUE(SlaveProc::run(cmd.c_str(), out));
+ ASSERT_TRUE(ChildProcess::run(cmd.c_str(), out));
return out;
}
diff --git a/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp b/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp
index 0b4a83bf714..d19a5a323f2 100644
--- a/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp
+++ b/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp
@@ -1,11 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vbench/test/all.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/net/crypto_engine.h>
using namespace vbench;
-using vespalib::SlaveProc;
+using vespalib::ChildProcess;
using InputReader = vespalib::InputReader;
using OutputWriter = vespalib::OutputWriter;
@@ -32,7 +32,7 @@ void readUntil(Input &input, SimpleBuffer &buffer, const string &end) {
TEST("dumpurl usage") {
std::string out;
- EXPECT_FALSE(SlaveProc::run("../../apps/dumpurl/vbench_dumpurl_app", out));
+ EXPECT_FALSE(ChildProcess::run("../../apps/dumpurl/vbench_dumpurl_app", out));
fprintf(stderr, "%s\n", out.c_str());
}
@@ -48,7 +48,7 @@ TEST_MT_F("run dumpurl", 2, ServerSocket()) {
out.write("data");
} else {
std::string out;
- EXPECT_TRUE(SlaveProc::run(strfmt("../../apps/dumpurl/vbench_dumpurl_app localhost %d /foo",
+ EXPECT_TRUE(ChildProcess::run(strfmt("../../apps/dumpurl/vbench_dumpurl_app localhost %d /foo",
f1.port()).c_str(), out));
fprintf(stderr, "%s\n", out.c_str());
}
diff --git a/vbench/src/tests/app_vbench/app_vbench_test.cpp b/vbench/src/tests/app_vbench/app_vbench_test.cpp
index 8b5bb71425d..0e89d30e853 100644
--- a/vbench/src/tests/app_vbench/app_vbench_test.cpp
+++ b/vbench/src/tests/app_vbench/app_vbench_test.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vbench/test/all.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/net/crypto_engine.h>
#include <vespa/vespalib/net/tls/tls_crypto_engine.h>
#include <vespa/vespalib/test/make_tls_options_for_testing.h>
@@ -11,7 +11,7 @@
#include <fcntl.h>
using namespace vbench;
-using vespalib::SlaveProc;
+using vespalib::ChildProcess;
using InputReader = vespalib::InputReader;
using OutputWriter = vespalib::OutputWriter;
@@ -32,7 +32,7 @@ void write_file(const vespalib::string &file_name, const vespalib::string &conte
TEST("vbench usage") {
std::string out;
- EXPECT_FALSE(SlaveProc::run("../../apps/vbench/vbench_app", out));
+ EXPECT_FALSE(ChildProcess::run("../../apps/vbench/vbench_app", out));
fprintf(stderr, "%s\n", out.c_str());
}
@@ -69,14 +69,14 @@ struct Servers {
TEST_MT_F("run vbench", 2, Servers()) {
if (thread_id == 0) {
std::string out;
- EXPECT_TRUE(SlaveProc::run(strfmt("sed 's/_LOCAL_PORT_/%d/' vbench.cfg.template > vbench.cfg", f1.portal->listen_port()).c_str()));
- EXPECT_TRUE(SlaveProc::run("../../apps/vbench/vbench_app run vbench.cfg 2> vbench.out", out));
+ EXPECT_TRUE(ChildProcess::run(strfmt("sed 's/_LOCAL_PORT_/%d/' vbench.cfg.template > vbench.cfg", f1.portal->listen_port()).c_str()));
+ EXPECT_TRUE(ChildProcess::run("../../apps/vbench/vbench_app run vbench.cfg 2> vbench.out", out));
fprintf(stderr, "null crypto: %s\n", out.c_str());
EXPECT_GREATER(f1.my_get.cnt, 10u);
} else {
std::string tls_out;
- EXPECT_TRUE(SlaveProc::run(strfmt("sed 's/_LOCAL_PORT_/%d/' vbench.tls.cfg.template > vbench.tls.cfg", f1.tls_portal->listen_port()).c_str()));
- EXPECT_TRUE(SlaveProc::run("../../apps/vbench/vbench_app run vbench.tls.cfg 2> vbench.tls.out", tls_out));
+ EXPECT_TRUE(ChildProcess::run(strfmt("sed 's/_LOCAL_PORT_/%d/' vbench.tls.cfg.template > vbench.tls.cfg", f1.tls_portal->listen_port()).c_str()));
+ EXPECT_TRUE(ChildProcess::run("../../apps/vbench/vbench_app run vbench.tls.cfg 2> vbench.tls.out", tls_out));
fprintf(stderr, "tls crypto: %s\n", tls_out.c_str());
EXPECT_GREATER(f1.my_tls_get.cnt, 10u);
}
diff --git a/vespalib/CMakeLists.txt b/vespalib/CMakeLists.txt
index 1ca9816a921..c894a798b91 100644
--- a/vespalib/CMakeLists.txt
+++ b/vespalib/CMakeLists.txt
@@ -97,7 +97,7 @@ vespa_define_module(
src/tests/sharedptr
src/tests/signalhandler
src/tests/simple_thread_bundle
- src/tests/slaveproc
+ src/tests/child_process
src/tests/slime
src/tests/slime/external_data_value
src/tests/slime/summary-feature-benchmark
diff --git a/vespalib/src/tests/assert/assert_test.cpp b/vespalib/src/tests/assert/assert_test.cpp
index 860f56304ff..8b770f0f3eb 100644
--- a/vespalib/src/tests/assert/assert_test.cpp
+++ b/vespalib/src/tests/assert/assert_test.cpp
@@ -1,6 +1,6 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/assert.h>
#include <vespa/vespalib/io/fileutil.h>
@@ -16,19 +16,19 @@ TEST("that it borks the first time.") {
vespalib::rmdir("var", true);
ASSERT_TRUE(vespalib::mkdir(assertDir, true));
{
- SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
+ ChildProcess proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
proc.wait();
ASSERT_EQUAL(proc.getExitCode() & 0x7f, 6);
}
{
- SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
+ ChildProcess proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
proc.readLine(assertName);
proc.wait();
ASSERT_EQUAL(proc.getExitCode() & 0x7f, 0);
}
ASSERT_EQUAL(0, unlink(assertName.c_str()));
{
- SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
+ ChildProcess proc("ulimit -c 0 && exec env VESPA_HOME=./ ./vespalib_asserter_app myassert 10000");
proc.wait();
ASSERT_EQUAL(proc.getExitCode() & 0x7f, 6);
}
diff --git a/vespalib/src/tests/child_process/.gitignore b/vespalib/src/tests/child_process/.gitignore
new file mode 100644
index 00000000000..7e094c772a6
--- /dev/null
+++ b/vespalib/src/tests/child_process/.gitignore
@@ -0,0 +1,4 @@
+.depend
+Makefile
+child_process_test
+vespalib_child_process_test_app
diff --git a/vespalib/src/tests/child_process/CMakeLists.txt b/vespalib/src/tests/child_process/CMakeLists.txt
new file mode 100644
index 00000000000..1c9af730510
--- /dev/null
+++ b/vespalib/src/tests/child_process/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+vespa_add_executable(vespalib_child_process_test_app TEST
+ SOURCES
+ child_process_test.cpp
+ DEPENDS
+ vespalib
+)
+vespa_add_test(NAME vespalib_child_process_test_app COMMAND vespalib_child_process_test_app)
diff --git a/vespalib/src/tests/slaveproc/slaveproc_test.cpp b/vespalib/src/tests/child_process/child_process_test.cpp
index 547da991211..ada29cd370d 100644
--- a/vespalib/src/tests/slaveproc/slaveproc_test.cpp
+++ b/vespalib/src/tests/child_process/child_process_test.cpp
@@ -1,57 +1,57 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
-using vespalib::SlaveProc;
+using vespalib::ChildProcess;
TEST("simple run, ignore output") {
- EXPECT_TRUE(SlaveProc::run("echo foo"));
+ EXPECT_TRUE(ChildProcess::run("echo foo"));
}
TEST("simple run, ignore output, failure") {
- EXPECT_TRUE(!SlaveProc::run("false"));
+ EXPECT_TRUE(!ChildProcess::run("false"));
}
TEST("simple run, ignore output, timeout") {
- EXPECT_TRUE(!SlaveProc::run("exec sleep 60", 10));
+ EXPECT_TRUE(!ChildProcess::run("exec sleep 60", 10));
}
TEST("simple run") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("/bin/echo -n foo", out));
+ EXPECT_TRUE(ChildProcess::run("/bin/echo -n foo", out));
EXPECT_EQUAL(out, "foo");
}
TEST("simple run, strip single-line trailing newline") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("echo foo", out));
+ EXPECT_TRUE(ChildProcess::run("echo foo", out));
EXPECT_EQUAL(out, "foo");
}
TEST("simple run, don't strip multi-line output") {
std::string out;
- EXPECT_TRUE(SlaveProc::run("perl -e 'print \"foo\\n\\n\"'", out));
+ EXPECT_TRUE(ChildProcess::run("perl -e 'print \"foo\\n\\n\"'", out));
EXPECT_EQUAL(out, "foo\n\n");
}
TEST("simple run with input") {
std::string in = "bar";
std::string out;
- EXPECT_TRUE(SlaveProc::run(in, "cat", out));
+ EXPECT_TRUE(ChildProcess::run(in, "cat", out));
EXPECT_EQUAL(out, "bar");
}
TEST("simple run with input, strip single-line trailing newline") {
std::string in = "bar\n";
std::string out;
- EXPECT_TRUE(SlaveProc::run(in, "cat", out));
+ EXPECT_TRUE(ChildProcess::run(in, "cat", out));
EXPECT_EQUAL(out, "bar");
}
TEST("simple run with input, don't strip multi-line output") {
std::string in = "bar\n\n";
std::string out;
- EXPECT_TRUE(SlaveProc::run(in, "cat", out));
+ EXPECT_TRUE(ChildProcess::run(in, "cat", out));
EXPECT_EQUAL("bar\n\n", out);
}
@@ -64,11 +64,11 @@ TEST_MT("simple run, partial output due to timeout", 2) {
(thread_id == 0) ? "out" : "", timeout);
if (thread_id == 0) {
out.clear();
- EXPECT_TRUE(!SlaveProc::run(my_cmd, out, timeout));
+ EXPECT_TRUE(!ChildProcess::run(my_cmd, out, timeout));
} else {
out.clear();
std::string in = "ignored\n";
- EXPECT_TRUE(!SlaveProc::run(in, my_cmd, out, timeout));
+ EXPECT_TRUE(!ChildProcess::run(in, my_cmd, out, timeout));
}
if (out == "foo") {
break;
@@ -78,7 +78,7 @@ TEST_MT("simple run, partial output due to timeout", 2) {
}
TEST("proc failure") {
- SlaveProc proc("false");
+ ChildProcess proc("false");
// read with length 0 will wait for output
EXPECT_TRUE(proc.read(NULL, 0) == 0);
EXPECT_TRUE(proc.wait(60000));
@@ -90,7 +90,7 @@ TEST("basic read/write") {
int x;
int read;
char buf[64];
- SlaveProc proc("cat");
+ ChildProcess proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
@@ -117,7 +117,7 @@ TEST("basic read/write") {
TEST("continuos run, readLine") {
std::string str;
- SlaveProc proc("cat");
+ ChildProcess proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
@@ -142,7 +142,7 @@ TEST("continuos run, readLine") {
TEST("readLine, eof flushes last line") {
std::string str;
- SlaveProc proc("cat");
+ ChildProcess proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
@@ -166,7 +166,7 @@ TEST("readLine, eof flushes last line") {
TEST("long continuos run, readLine") {
std::string in;
std::string out;
- SlaveProc proc("cat");
+ ChildProcess proc("cat");
EXPECT_TRUE(proc.running());
EXPECT_TRUE(!proc.failed());
diff --git a/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp b/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
index 63defa58c41..787e46cfd91 100644
--- a/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
+++ b/vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp
@@ -1,23 +1,23 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
-using vespalib::SlaveProc;
+using vespalib::ChildProcess;
TEST("no arguments") {
- SlaveProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache");
+ ChildProcess drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache");
drop.wait();
EXPECT_EQUAL(1, drop.getExitCode());
}
TEST("file does not exist") {
- SlaveProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache not_exist");
+ ChildProcess drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache not_exist");
drop.wait();
EXPECT_EQUAL(2, drop.getExitCode());
}
TEST("All is well") {
- SlaveProc drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache vespalib_drop_file_from_cache_test_app");
+ ChildProcess drop("../../apps/vespa-drop-file-from-cache/vespa-drop-file-from-cache vespalib_drop_file_from_cache_test_app");
drop.wait();
EXPECT_EQUAL(0, drop.getExitCode());
}
diff --git a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
index 8d81d9e0821..89030a19cd6 100644
--- a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
+++ b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/exception.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
using namespace vespalib;
@@ -14,32 +14,32 @@ using namespace vespalib;
#endif
TEST("that uncaught exception causes negative exitcode.") {
- SlaveProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught");
+ ChildProcess proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught");
proc.wait();
EXPECT_LESS(proc.getExitCode(), 0);
}
TEST("that uncaught silenced exception causes exitcode 66") {
- SlaveProc proc("exec ./vespalib_caught_uncaught_app silenced_and_uncaught");
+ ChildProcess proc("exec ./vespalib_caught_uncaught_app silenced_and_uncaught");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 66);
}
TEST("that caught silenced exception followed by an uncaught causes negative exitcode.") {
- SlaveProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught_after_silenced_and_caught");
+ ChildProcess proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught_after_silenced_and_caught");
proc.wait();
EXPECT_LESS(proc.getExitCode(), 0);
}
TEST("that caught silenced exception causes exitcode 0") {
- SlaveProc proc("exec ./vespalib_caught_uncaught_app silenced_and_caught");
+ ChildProcess proc("exec ./vespalib_caught_uncaught_app silenced_and_caught");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 0);
}
#ifndef __SANITIZE_ADDRESS__
TEST("that mmap within limits are fine cause exitcode 0") {
- SlaveProc proc("exec ./vespalib_mmap_app 150000000 10485760 1");
+ ChildProcess proc("exec ./vespalib_mmap_app 150000000 10485760 1");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 0);
}
@@ -48,13 +48,13 @@ TEST("that mmap within limits are fine cause exitcode 0") {
// setrlimit with RLIMIT_AS is broken on Darwin
#else
TEST("that mmap beyond limits cause negative exitcode.") {
- SlaveProc proc("ulimit -c 0 && exec ./vespalib_mmap_app 100000000 10485760 10");
+ ChildProcess proc("ulimit -c 0 && exec ./vespalib_mmap_app 100000000 10485760 10");
proc.wait();
EXPECT_LESS(proc.getExitCode(), 0);
}
TEST("that mmap beyond limits with set VESPA_SILENCE_CORE_ON_OOM cause exitcode 66.") {
- SlaveProc proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10");
+ ChildProcess proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10");
proc.wait();
EXPECT_EQUAL(proc.getExitCode(), 66);
}
diff --git a/vespalib/src/tests/host_name/host_name_test.cpp b/vespalib/src/tests/host_name/host_name_test.cpp
index 4e0c59d836d..442da2ac2e8 100644
--- a/vespalib/src/tests/host_name/host_name_test.cpp
+++ b/vespalib/src/tests/host_name/host_name_test.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/host_name.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
using namespace vespalib;
diff --git a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp
index a7509014b00..db7a51222b7 100644
--- a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp
+++ b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp
@@ -1,12 +1,12 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
using namespace vespalib;
bool runPrint(const char *cmd) {
std::string out;
- bool res = SlaveProc::run(cmd, out);
+ bool res = ChildProcess::run(cmd, out);
fprintf(stderr, "%s", out.c_str());
return res;
}
diff --git a/vespalib/src/tests/slaveproc/.gitignore b/vespalib/src/tests/slaveproc/.gitignore
deleted file mode 100644
index 8851e99df13..00000000000
--- a/vespalib/src/tests/slaveproc/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.depend
-Makefile
-slaveproc_test
-vespalib_slaveproc_test_app
diff --git a/vespalib/src/tests/slaveproc/CMakeLists.txt b/vespalib/src/tests/slaveproc/CMakeLists.txt
deleted file mode 100644
index 58211d671bc..00000000000
--- a/vespalib/src/tests/slaveproc/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(vespalib_slaveproc_test_app TEST
- SOURCES
- slaveproc_test.cpp
- DEPENDS
- vespalib
-)
-vespa_add_test(NAME vespalib_slaveproc_test_app COMMAND vespalib_slaveproc_test_app)
diff --git a/vespalib/src/tests/tutorial/make_tutorial.cpp b/vespalib/src/tests/tutorial/make_tutorial.cpp
index 4890b0db62a..de0eb585e3c 100644
--- a/vespalib/src/tests/tutorial/make_tutorial.cpp
+++ b/vespalib/src/tests/tutorial/make_tutorial.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -20,7 +20,7 @@ std::string readFile(const std::string &filename) {
std::string runCommand(const std::string &cmd) {
std::string out;
- ASSERT_TRUE(SlaveProc::run(cmd.c_str(), out));
+ ASSERT_TRUE(ChildProcess::run(cmd.c_str(), out));
return out;
}
diff --git a/vespalib/src/vespa/vespalib/util/CMakeLists.txt b/vespalib/src/vespa/vespalib/util/CMakeLists.txt
index 4029c4881c4..0973653861f 100644
--- a/vespalib/src/vespa/vespalib/util/CMakeLists.txt
+++ b/vespalib/src/vespa/vespalib/util/CMakeLists.txt
@@ -46,7 +46,7 @@ vespa_add_library(vespalib_vespalib_util OBJECT
sig_catch.cpp
signalhandler.cpp
simple_thread_bundle.cpp
- slaveproc.cpp
+ child_process.cpp
stash.cpp
string_hash.cpp
stringfmt.cpp
diff --git a/vespalib/src/vespa/vespalib/util/slaveproc.cpp b/vespalib/src/vespa/vespalib/util/child_process.cpp
index 6f40aa9a4d7..ce0c2eb1779 100644
--- a/vespalib/src/vespa/vespalib/util/slaveproc.cpp
+++ b/vespalib/src/vespa/vespalib/util/child_process.cpp
@@ -1,17 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "guard.h"
-#include "slaveproc.h"
+#include "child_process.h"
#include <cstring>
namespace vespalib {
-namespace slaveproc {
+namespace child_process {
using namespace std::chrono;
/**
- * @brief SlaveProc internal timeout management.
+ * @brief ChildProcess internal timeout management.
**/
class Timer
{
@@ -54,14 +54,14 @@ public:
}
};
-} // namespace slaveproc
+} // namespace child_process
-using slaveproc::Timer;
+using child_process::Timer;
//-----------------------------------------------------------------------------
void
-SlaveProc::Reader::OnReceiveData(const void *data, size_t length)
+ChildProcess::Reader::OnReceiveData(const void *data, size_t length)
{
const char *buf = (const char *) data;
MonitorGuard lock(_cond);
@@ -80,7 +80,7 @@ SlaveProc::Reader::OnReceiveData(const void *data, size_t length)
bool
-SlaveProc::Reader::hasData()
+ChildProcess::Reader::hasData()
{
// NB: caller has lock on _cond
return (!_data.empty() || !_queue.empty());
@@ -88,7 +88,7 @@ SlaveProc::Reader::hasData()
bool
-SlaveProc::Reader::waitForData(Timer &timer, MonitorGuard &lock)
+ChildProcess::Reader::waitForData(Timer &timer, MonitorGuard &lock)
{
// NB: caller has lock on _cond
CounterGuard count(_waitCnt);
@@ -100,7 +100,7 @@ SlaveProc::Reader::waitForData(Timer &timer, MonitorGuard &lock)
void
-SlaveProc::Reader::updateEOF()
+ChildProcess::Reader::updateEOF()
{
// NB: caller has lock on _cond
if (_data.empty() && _queue.empty() && _gotEOF) {
@@ -109,7 +109,7 @@ SlaveProc::Reader::updateEOF()
}
-SlaveProc::Reader::Reader()
+ChildProcess::Reader::Reader()
: _cond(),
_queue(),
_data(),
@@ -120,13 +120,13 @@ SlaveProc::Reader::Reader()
}
-SlaveProc::Reader::~Reader()
+ChildProcess::Reader::~Reader()
{
}
uint32_t
-SlaveProc::Reader::read(char *buf, uint32_t len, int msTimeout)
+ChildProcess::Reader::read(char *buf, uint32_t len, int msTimeout)
{
if (eof()) {
return 0;
@@ -156,7 +156,7 @@ SlaveProc::Reader::read(char *buf, uint32_t len, int msTimeout)
bool
-SlaveProc::Reader::readLine(std::string &line, int msTimeout)
+ChildProcess::Reader::readLine(std::string &line, int msTimeout)
{
line.clear();
if (eof()) {
@@ -193,7 +193,7 @@ SlaveProc::Reader::readLine(std::string &line, int msTimeout)
//-----------------------------------------------------------------------------
void
-SlaveProc::checkProc()
+ChildProcess::checkProc()
{
if (_running) {
bool stillRunning;
@@ -205,7 +205,7 @@ SlaveProc::checkProc()
}
-SlaveProc::SlaveProc(const char *cmd)
+ChildProcess::ChildProcess(const char *cmd)
: _reader(),
_proc(cmd, true, &_reader),
_running(false),
@@ -217,11 +217,11 @@ SlaveProc::SlaveProc(const char *cmd)
}
-SlaveProc::~SlaveProc() = default;
+ChildProcess::~ChildProcess() = default;
bool
-SlaveProc::write(const char *buf, uint32_t len)
+ChildProcess::write(const char *buf, uint32_t len)
{
if (len == 0) {
return true;
@@ -231,28 +231,28 @@ SlaveProc::write(const char *buf, uint32_t len)
bool
-SlaveProc::close()
+ChildProcess::close()
{
return _proc.WriteStdin(nullptr, 0);
}
uint32_t
-SlaveProc::read(char *buf, uint32_t len, int msTimeout)
+ChildProcess::read(char *buf, uint32_t len, int msTimeout)
{
return _reader.read(buf, len, msTimeout);
}
bool
-SlaveProc::readLine(std::string &line, int msTimeout)
+ChildProcess::readLine(std::string &line, int msTimeout)
{
return _reader.readLine(line, msTimeout);
}
bool
-SlaveProc::wait(int msTimeout)
+ChildProcess::wait(int msTimeout)
{
bool done = true;
checkProc();
@@ -273,7 +273,7 @@ SlaveProc::wait(int msTimeout)
bool
-SlaveProc::running()
+ChildProcess::running()
{
checkProc();
return _running;
@@ -281,24 +281,24 @@ SlaveProc::running()
bool
-SlaveProc::failed()
+ChildProcess::failed()
{
checkProc();
return _failed;
}
int
-SlaveProc::getExitCode()
+ChildProcess::getExitCode()
{
return _exitCode;
}
bool
-SlaveProc::run(const std::string &input, const char *cmd,
+ChildProcess::run(const std::string &input, const char *cmd,
std::string &output, int msTimeout)
{
- SlaveProc proc(cmd);
+ ChildProcess proc(cmd);
Timer timer(msTimeout);
char buf[4096];
proc.write(input.data(), input.length());
@@ -317,7 +317,7 @@ SlaveProc::run(const std::string &input, const char *cmd,
bool
-SlaveProc::run(const char *cmd, std::string &output, int msTimeout)
+ChildProcess::run(const char *cmd, std::string &output, int msTimeout)
{
std::string input; // empty input
return run(input, cmd, output, msTimeout);
@@ -325,7 +325,7 @@ SlaveProc::run(const char *cmd, std::string &output, int msTimeout)
bool
-SlaveProc::run(const char *cmd, int msTimeout)
+ChildProcess::run(const char *cmd, int msTimeout)
{
std::string input; // empty input
std::string output; // ignore output
diff --git a/vespalib/src/vespa/vespalib/util/slaveproc.h b/vespalib/src/vespa/vespalib/util/child_process.h
index c08a13f0b1d..0ae7206ac48 100644
--- a/vespalib/src/vespa/vespalib/util/slaveproc.h
+++ b/vespalib/src/vespa/vespalib/util/child_process.h
@@ -8,17 +8,17 @@
#include <queue>
#include "sync.h"
-namespace vespalib::slaveproc { class Timer; }
+namespace vespalib::child_process { class Timer; }
namespace vespalib {
/**
- * @brief Slave Process utility class for running external programs
+ * @brief Child Process utility class for running external programs
*
* Designed for use in unit tests and other places
* where you need to run, control and communicate with
* some external program.
**/
-class SlaveProc
+class ChildProcess
{
private:
class Reader : public FastOS_ProcessRedirectListener
@@ -33,7 +33,7 @@ private:
void OnReceiveData(const void *data, size_t length) override;
bool hasData();
- bool waitForData(slaveproc::Timer &timer, MonitorGuard &lock);
+ bool waitForData(child_process::Timer &timer, MonitorGuard &lock);
void updateEOF();
public:
@@ -54,19 +54,19 @@ private:
void checkProc();
public:
- SlaveProc(const SlaveProc &) = delete;
- SlaveProc &operator=(const SlaveProc &) = delete;
+ ChildProcess(const ChildProcess &) = delete;
+ ChildProcess &operator=(const ChildProcess &) = delete;
/**
- * @brief Run a slave process
+ * @brief Run a child process
*
* Starts a process running the given command
* @param cmd A shell command line to run
**/
- explicit SlaveProc(const char *cmd);
+ explicit ChildProcess(const char *cmd);
/** @brief destructor doing cleanup if needed */
- ~SlaveProc();
+ ~ChildProcess();
/**
* @return process id
diff --git a/vespamalloc/src/tests/doubledelete/expectsignal.cpp b/vespamalloc/src/tests/doubledelete/expectsignal.cpp
index 9ac93da014d..a0f6561889a 100644
--- a/vespamalloc/src/tests/doubledelete/expectsignal.cpp
+++ b/vespamalloc/src/tests/doubledelete/expectsignal.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <sys/wait.h>
using namespace vespalib;
@@ -25,7 +25,7 @@ int Test::Main()
fprintf(stderr, "argc=%d : Running '%s' expecting signal %d\n", _argc, _argv[2], retval);
- SlaveProc cmd(_argv[2]);
+ ChildProcess cmd(_argv[2]);
for(std::string line; cmd.readLine(line, 60000);) {
fprintf(stdout, "%s\n", line.c_str());
}
diff --git a/vespamalloc/src/tests/overwrite/expectsignal.cpp b/vespamalloc/src/tests/overwrite/expectsignal.cpp
index e78f1b7b181..2b37499f85d 100644
--- a/vespamalloc/src/tests/overwrite/expectsignal.cpp
+++ b/vespamalloc/src/tests/overwrite/expectsignal.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/slaveproc.h>
+#include <vespa/vespalib/util/child_process.h>
#include <sys/wait.h>
using namespace vespalib;
@@ -24,7 +24,7 @@ int Test::Main()
fprintf(stderr, "argc=%d : Running '%s' expecting signal %d\n", _argc, _argv[2], retval);
- SlaveProc cmd(_argv[2]);
+ ChildProcess cmd(_argv[2]);
for(std::string line; cmd.readLine(line, 60000);) {
fprintf(stdout, "%s\n", line.c_str());
}