diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-07-17 09:01:11 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-07-17 14:38:14 +0000 |
commit | 868963dac13ec4265e8642af19ad2b85d2b46ed4 (patch) | |
tree | 8a632182b61e8938c2e4192f2611070384ce01e9 /vespalib/src/tests | |
parent | 6f26d4daad46da0aa3ccae312da522d203a21585 (diff) |
ChildProc -> ChildProcess
Diffstat (limited to 'vespalib/src/tests')
-rw-r--r-- | vespalib/src/tests/assert/assert_test.cpp | 8 | ||||
-rw-r--r-- | vespalib/src/tests/child_proc/.gitignore | 4 | ||||
-rw-r--r-- | vespalib/src/tests/child_proc/CMakeLists.txt | 8 | ||||
-rw-r--r-- | vespalib/src/tests/child_process/.gitignore | 4 | ||||
-rw-r--r-- | vespalib/src/tests/child_process/CMakeLists.txt | 8 | ||||
-rw-r--r-- | vespalib/src/tests/child_process/child_process_test.cpp (renamed from vespalib/src/tests/child_proc/child_proc_test.cpp) | 36 | ||||
-rw-r--r-- | vespalib/src/tests/drop-file-from-cache/drop_file_from_cache_test.cpp | 10 | ||||
-rw-r--r-- | vespalib/src/tests/exception_classes/silenceuncaught_test.cpp | 16 | ||||
-rw-r--r-- | vespalib/src/tests/host_name/host_name_test.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp | 4 | ||||
-rw-r--r-- | vespalib/src/tests/tutorial/make_tutorial.cpp | 4 |
11 files changed, 52 insertions, 52 deletions
diff --git a/vespalib/src/tests/assert/assert_test.cpp b/vespalib/src/tests/assert/assert_test.cpp index bdd9f5785dd..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/child_proc.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)); { - ChildProc 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); } { - ChildProc 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())); { - ChildProc 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_proc/.gitignore b/vespalib/src/tests/child_proc/.gitignore deleted file mode 100644 index 8b43b2b332e..00000000000 --- a/vespalib/src/tests/child_proc/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.depend -Makefile -child_proc_test -vespalib_child_proc_test_app diff --git a/vespalib/src/tests/child_proc/CMakeLists.txt b/vespalib/src/tests/child_proc/CMakeLists.txt deleted file mode 100644 index 45f0ae8f9a9..00000000000 --- a/vespalib/src/tests/child_proc/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_child_proc_test_app TEST - SOURCES - child_proc_test.cpp - DEPENDS - vespalib -) -vespa_add_test(NAME vespalib_child_proc_test_app COMMAND vespalib_child_proc_test_app) 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/child_proc/child_proc_test.cpp b/vespalib/src/tests/child_process/child_process_test.cpp index d485ef75432..ada29cd370d 100644 --- a/vespalib/src/tests/child_proc/child_proc_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/child_proc.h> +#include <vespa/vespalib/util/child_process.h> -using vespalib::ChildProc; +using vespalib::ChildProcess; TEST("simple run, ignore output") { - EXPECT_TRUE(ChildProc::run("echo foo")); + EXPECT_TRUE(ChildProcess::run("echo foo")); } TEST("simple run, ignore output, failure") { - EXPECT_TRUE(!ChildProc::run("false")); + EXPECT_TRUE(!ChildProcess::run("false")); } TEST("simple run, ignore output, timeout") { - EXPECT_TRUE(!ChildProc::run("exec sleep 60", 10)); + EXPECT_TRUE(!ChildProcess::run("exec sleep 60", 10)); } TEST("simple run") { std::string out; - EXPECT_TRUE(ChildProc::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(ChildProc::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(ChildProc::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(ChildProc::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(ChildProc::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(ChildProc::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(!ChildProc::run(my_cmd, out, timeout)); + EXPECT_TRUE(!ChildProcess::run(my_cmd, out, timeout)); } else { out.clear(); std::string in = "ignored\n"; - EXPECT_TRUE(!ChildProc::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") { - ChildProc 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]; - ChildProc 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; - ChildProc 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; - ChildProc 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; - ChildProc 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 17cb977631c..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/child_proc.h> +#include <vespa/vespalib/util/child_process.h> -using vespalib::ChildProc; +using vespalib::ChildProcess; TEST("no arguments") { - ChildProc 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") { - ChildProc 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") { - ChildProc 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 7177a195fa3..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/child_proc.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.") { - ChildProc 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") { - ChildProc 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.") { - ChildProc 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") { - ChildProc 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") { - ChildProc 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.") { - ChildProc 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.") { - ChildProc 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 21a8a571119..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/child_proc.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 8ae808839db..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/child_proc.h> +#include <vespa/vespalib/util/child_process.h> using namespace vespalib; bool runPrint(const char *cmd) { std::string out; - bool res = ChildProc::run(cmd, out); + bool res = ChildProcess::run(cmd, out); fprintf(stderr, "%s", out.c_str()); return res; } diff --git a/vespalib/src/tests/tutorial/make_tutorial.cpp b/vespalib/src/tests/tutorial/make_tutorial.cpp index 25398490318..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/child_proc.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(ChildProc::run(cmd.c_str(), out)); + ASSERT_TRUE(ChildProcess::run(cmd.c_str(), out)); return out; } |