diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index a6e38c2553..d220534a97 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -3584,10 +3584,6 @@ True True - - True - True - diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index aef648164f..56ab3f3e63 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -4167,9 +4167,6 @@ ripple\test\mao\impl - - ripple\test\mao\impl - ripple\test\mao diff --git a/src/beast/beast/utility/tests/Journal.test.cpp b/src/beast/beast/utility/tests/Journal.test.cpp index 3196f7fcf1..78d510c7fe 100644 --- a/src/beast/beast/utility/tests/Journal.test.cpp +++ b/src/beast/beast/utility/tests/Journal.test.cpp @@ -95,6 +95,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(Journal,utility,beast); +BEAST_DEFINE_TESTSUITE(Journal,utility,beast); } // beast diff --git a/src/ripple/app/tests/OfferStream.test.cpp b/src/ripple/app/tests/OfferStream.test.cpp index 7a1c2a21d6..83afd21632 100644 --- a/src/ripple/app/tests/OfferStream.test.cpp +++ b/src/ripple/app/tests/OfferStream.test.cpp @@ -39,6 +39,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(OfferStream,tx,ripple); +BEAST_DEFINE_TESTSUITE(OfferStream,tx,ripple); } diff --git a/src/ripple/nodestore/tests/import_test.cpp b/src/ripple/nodestore/tests/import_test.cpp index 2aa9853157..e03cc02a86 100644 --- a/src/ripple/nodestore/tests/import_test.cpp +++ b/src/ripple/nodestore/tests/import_test.cpp @@ -562,7 +562,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(import,NodeStore,ripple); +BEAST_DEFINE_TESTSUITE(import,NodeStore,ripple); #endif @@ -748,255 +748,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(rekey,NodeStore,ripple); - -//------------------------------------------------------------------------------ - -namespace legacy { - -using namespace beast::nudb; -using namespace beast::nudb::detail; - -struct dat_file_header -{ - static std::size_t BEAST_CONSTEXPR size = - 8 + // Type - 2 + // Version - 8 + // Appnum - 8 + // Salt - 2 + // KeySize - 64; // (Reserved) - - char type[8]; - std::size_t version; - std::uint64_t appnum; - std::uint64_t salt; - std::size_t key_size; -}; - -struct key_file_header -{ - static std::size_t BEAST_CONSTEXPR size = - 8 + // Type - 2 + // Version - 8 + // Appnum - 8 + // Salt - 8 + // Pepper - 2 + // KeySize - 2 + // BlockSize - 2 + // LoadFactor - 64; // (Reserved) - - char type[8]; - std::size_t version; - std::uint64_t appnum; - std::uint64_t salt; - std::uint64_t pepper; - std::size_t key_size; - std::size_t block_size; - std::size_t load_factor; - - // Computed values - std::size_t capacity; - std::size_t bucket_size; - std::size_t buckets; - std::size_t modulus; -}; - -// Read data file header from stream -template -void -read (istream& is, dat_file_header& dh) -{ - read (is, dh.type, sizeof(dh.type)); - read(is, dh.version); - read(is, dh.appnum); - read(is, dh.salt); - read(is, dh.key_size); - std::array zero; - read (is, zero.data(), zero.size()); -} - -// Read data file header from file -template -void -read (File& f, dat_file_header& dh) -{ - std::array buf; - try - { - f.read(0, buf.data(), buf.size()); - } - catch (file_short_read_error const&) - { - Throw ( - "short data file header"); - } - istream is(buf); - read (is, dh); -} - -// Read key file header from stream -template -void -read (istream& is, std::size_t file_size, - key_file_header& kh) -{ - read(is, kh.type, sizeof(kh.type)); - read(is, kh.version); - read(is, kh.appnum); - read(is, kh.salt); - read(is, kh.pepper); - read(is, kh.key_size); - read(is, kh.block_size); - read(is, kh.load_factor); - std::array zero; - read (is, zero.data(), zero.size()); - - // VFALCO These need to be checked to handle - // when the file size is too small - kh.capacity = bucket_capacity(kh.block_size); - kh.bucket_size = bucket_size(kh.capacity); - if (file_size > kh.block_size) - { - // VFALCO This should be handled elsewhere. - // we shouldn't put the computed fields in this header. - if (kh.block_size > 0) - kh.buckets = (file_size - kh.bucket_size) - / kh.block_size; - else - // VFALCO Corruption or logic error - kh.buckets = 0; - } - else - { - kh.buckets = 0; - } - kh.modulus = ceil_pow2(kh.buckets); -} - -// Read key file header from file -template -void -read (File& f, key_file_header& kh) -{ - std::array buf; - try - { - f.read(0, buf.data(), buf.size()); - } - catch (file_short_read_error const&) - { - Throw ( - "short key file header"); - } - istream is(buf); - read (is, f.actual_size(), kh); -} - -} // detail - -class update_test : public beast::unit_test::suite -{ -public: - void - run() override - { - testcase(abort_on_fail) << arg(); - - using namespace beast::nudb; - using namespace beast::nudb::detail; - - pass(); - auto const args = parse_args(arg()); - bool usage = args.empty(); - - if (! usage && - args.find("path") == args.end()) - { - log << - "Missing parameter: path"; - usage = true; - } - - if (usage) - { - log << - "Usage:\n" << - "--unittest-arg=path=\n" << - "path: NuDB path to update (without extensions)"; - return; - } - - auto const path = args.at("path"); - - using hash_type = beast::xxhasher; - - auto const dp = path + ".dat"; - auto const kp = path + ".key"; - - log << - "path: " << path; - - native_file df; - native_file kf; - df.open(file_mode::write, dp); - kf.open(file_mode::write, kp); - legacy::dat_file_header dh0; - legacy::key_file_header kh0; - read(df, dh0); - read(kf, kh0); - - dat_file_header dh; - std::memcpy(dh.type, "nudb.dat", 8); - dh.version = dh0.version;; - dh.uid = make_uid(); - dh.appnum = dh0.appnum; - dh.key_size = dh0.key_size; - - key_file_header kh; - std::memcpy(kh.type, "nudb.key", 8); - kh.version = dh.version; - kh.uid = dh.uid; - kh.appnum = dh.appnum; - kh.key_size = dh.key_size; - kh.salt = kh0.salt; - kh.pepper = kh0.pepper; - kh.block_size = kh0.block_size; - kh.load_factor = kh0.load_factor; - - // VFALCO These need to be checked to handle - // when the file size is too small - kh.capacity = bucket_capacity(kh.block_size); - kh.bucket_size = bucket_size(kh.capacity); - auto const kf_size = kf.actual_size(); - if (kf_size > kh.block_size) - { - // VFALCO This should be handled elsewhere. - // we shouldn't put the computed fields - // in this header. - if (kh.block_size > 0) - kh.buckets = (kf_size - kh.bucket_size) - / kh.block_size; - else - // VFALCO Corruption or logic error - kh.buckets = 0; - } - else - { - kh.buckets = 0; - } - kh.modulus = ceil_pow2(kh.buckets); - beast::nudb::detail::verify(dh); - beast::nudb::detail::verify(dh, kh); - write(df, dh); - write(kf, kh); - } -}; - -BEAST_DEFINE_TESTSUITE_MANUAL(update,NodeStore,ripple); +BEAST_DEFINE_TESTSUITE(rekey,NodeStore,ripple); } } diff --git a/src/ripple/overlay/tests/short_read.test.cpp b/src/ripple/overlay/tests/short_read.test.cpp index af050d8dc0..a66a16d1a3 100644 --- a/src/ripple/overlay/tests/short_read.test.cpp +++ b/src/ripple/overlay/tests/short_read.test.cpp @@ -559,6 +559,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(short_read,overlay,ripple); +BEAST_DEFINE_TESTSUITE(short_read,overlay,ripple); } diff --git a/src/ripple/test/mao/impl/Net_test.cpp b/src/ripple/test/mao/impl/Net_test.cpp deleted file mode 100644 index fb0555f758..0000000000 --- a/src/ripple/test/mao/impl/Net_test.cpp +++ /dev/null @@ -1,140 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ripple { -namespace test { -namespace mao { - -struct TestApp -{ - TestApp() - { - auto config = std::make_unique(); - setupConfigForUnitTests(*config); - // Hack so we dont have to call Config::setup - HTTPClient::initializeSSLContext(*config); - auto logs = std::make_unique(); - auto timeKeeper = std::make_unique(); - timeKeeper_ = timeKeeper.get(); - instance = make_Application(std::move(config), - std::move(logs), std::move(timeKeeper)); - instance->setup(); - thread_ = std::thread( - [&]() { instance->run(); }); - } - - ~TestApp() - { - if (thread_.joinable()) - { - instance->signalStop(); - thread_.join(); - } - } - - void - join() - { - thread_.join(); - } - - Application* - operator->() - { - return instance.get(); - } - - template - void - rpc (T const& t, Args const&... args) - { - std::vector v; - collect(v, t, args...); - RPCCall::fromCommandLine( - instance->config(), v, - instance->logs()); - } - -private: - inline - void - collect (std::vector& v) - { - } - - template - void - collect (std::vector& v, - T const& t, Args const&... args) - { - v.emplace_back(t); - collect(v, args...); - } - - ManualTimeKeeper* timeKeeper_; - std::unique_ptr instance; - std::thread thread_; - std::mutex mutex_; -}; - -class Net_test : public beast::unit_test::suite -{ -public: - void - testStartStop() - { - TestApp app; - pass(); - } - - void - testRPC() - { - TestApp app; - app.rpc("stop"); - app.join(); - pass(); - } - - void - run() override - { - testStartStop(); - testRPC(); - } -}; - -BEAST_DEFINE_TESTSUITE_MANUAL(Net,mao,ripple) - -} // mao -} // test -} // ripple diff --git a/src/ripple/unity/test.cpp b/src/ripple/unity/test.cpp index 788c3dd017..90dc452e62 100644 --- a/src/ripple/unity/test.cpp +++ b/src/ripple/unity/test.cpp @@ -46,7 +46,6 @@ #include #include -#include #include #include