diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-05-27 10:40:48 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-05-27 13:58:49 +0000 |
commit | 1b3e34605eba38778deaa09f81998c9b8c80acc7 (patch) | |
tree | 49d96ed7b1cdf57f58bd3cbe2383d55f1c320edf /staging_vespalib/src/tests | |
parent | 92dca89a98d9912fdefc0150fa914b788acfa056 (diff) |
Move datastore and btree code from searchlib to vespalib
Namespace is still `search` and not `vespalib` due to the massive
amount of code that would need to be modified for such a change.
Other changes:
- Move `BufferWriter` from searchlib to vespalib
- Move assertion and rand48 utilities from staging_vespalib to vespalib
- Move gtest utility code from staging_vespalib to vespalib
Diffstat (limited to 'staging_vespalib/src/tests')
-rw-r--r-- | staging_vespalib/src/tests/assert/.gitignore | 1 | ||||
-rw-r--r-- | staging_vespalib/src/tests/assert/CMakeLists.txt | 16 | ||||
-rw-r--r-- | staging_vespalib/src/tests/assert/assert_test.cpp | 39 | ||||
-rw-r--r-- | staging_vespalib/src/tests/assert/asserter.cpp | 25 |
4 files changed, 0 insertions, 81 deletions
diff --git a/staging_vespalib/src/tests/assert/.gitignore b/staging_vespalib/src/tests/assert/.gitignore deleted file mode 100644 index d0e23fcd846..00000000000 --- a/staging_vespalib/src/tests/assert/.gitignore +++ /dev/null @@ -1 +0,0 @@ -staging_vespalib_asserter_app diff --git a/staging_vespalib/src/tests/assert/CMakeLists.txt b/staging_vespalib/src/tests/assert/CMakeLists.txt deleted file mode 100644 index 7403a488645..00000000000 --- a/staging_vespalib/src/tests/assert/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -vespa_add_executable(staging_vespalib_assert_test_app TEST - SOURCES - assert_test.cpp - DEPENDS - staging_vespalib -) -vespa_add_test(NAME staging_vespalib_assert_test_app COMMAND staging_vespalib_assert_test_app) - -vespa_add_executable(staging_vespalib_asserter_app TEST - SOURCES - asserter.cpp - DEPENDS - staging_vespalib -) diff --git a/staging_vespalib/src/tests/assert/assert_test.cpp b/staging_vespalib/src/tests/assert/assert_test.cpp deleted file mode 100644 index 454c0957974..00000000000 --- a/staging_vespalib/src/tests/assert/assert_test.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// 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/stringfmt.h> -#include <vespa/vespalib/util/assert.h> -#include <vespa/vespalib/io/fileutil.h> -#include <sys/stat.h> -#include <unistd.h> -#include <vespa/defaults.h> - -using namespace vespalib; - -TEST("that it borks the first time.") { - std::string assertName; - const char * assertDir = "var/db/vespa/tmp"; - vespalib::rmdir("var", true); - ASSERT_TRUE(vespalib::mkdir(assertDir, true)); - { - SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./staging_vespalib_asserter_app myassert 10000"); - proc.wait(); - ASSERT_EQUAL(proc.getExitCode() & 0x7f, 6); - } - { - SlaveProc proc("ulimit -c 0 && exec env VESPA_HOME=./ ./staging_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=./ ./staging_vespalib_asserter_app myassert 10000"); - proc.wait(); - ASSERT_EQUAL(proc.getExitCode() & 0x7f, 6); - } - ASSERT_EQUAL(0, unlink(assertName.c_str())); - ASSERT_TRUE(vespalib::rmdir("var", true)); -} - -TEST_MAIN_WITH_PROCESS_PROXY() { TEST_RUN_ALL(); } diff --git a/staging_vespalib/src/tests/assert/asserter.cpp b/staging_vespalib/src/tests/assert/asserter.cpp deleted file mode 100644 index 640464889c0..00000000000 --- a/staging_vespalib/src/tests/assert/asserter.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/util/assert.h> -#include <cassert> -#include <cstdlib> -#include <fstream> -#include <string> - -int main(int argc, char *argv[]) { - assert(argc == 3); - const char * assertKey = argv[1]; - size_t assertCount = strtoul(argv[2], nullptr, 0); - for (size_t i(0); i < assertCount; i++) { - ASSERT_ONCE_OR_LOG(true, assertKey, 100); - ASSERT_ONCE_OR_LOG(false, assertKey, 100); - } - std::string filename = vespalib::assert::getAssertLogFileName(assertKey); - std::ifstream is(filename.c_str()); - assert(is); - std::string line; - std::getline(is, line); - printf("%s\n", filename.c_str()); - assert(line.find(assertKey) != std::string::npos); - assert(assertCount == vespalib::assert::getNumAsserts(assertKey)); - return 0; -} |