From 06d0ff6e5281ca237d358e953fe8069d16a6926a Mon Sep 17 00:00:00 2001 From: Joe Loser Date: Fri, 15 Jun 2018 18:06:30 -0500 Subject: [PATCH] Remove conditional check for using Boost.Process: - Since we require a min Boost version of 1.67 as of recently (for Beast), we also remove the conditional checks that existed for us to know whether Boost.Process is available or not. We can always assume it is available now. - Remove runtime checks for minimum Boost and OpenSSL versions since they are checked at CMake configure time. --- src/ripple/app/main/Main.cpp | 27 +--- src/ripple/basics/CheckLibraryVersions.h | 38 ------ .../basics/impl/CheckLibraryVersions.cpp | 121 ------------------ src/ripple/unity/basics.cpp | 1 - src/test/basics/CheckLibraryVersions_test.cpp | 55 -------- src/test/unity/basics_test_unity.cpp | 1 - 6 files changed, 3 insertions(+), 240 deletions(-) delete mode 100644 src/ripple/basics/CheckLibraryVersions.h delete mode 100644 src/ripple/basics/impl/CheckLibraryVersions.cpp delete mode 100644 src/test/basics/CheckLibraryVersions_test.cpp diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index 7ad220ebfc..1fc7bb8bde 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -47,6 +46,7 @@ #include +#include #include #include @@ -60,14 +60,6 @@ #include #endif -#if BOOST_VERSION >= 106400 -#define HAS_BOOST_PROCESS 1 -#endif - -#if HAS_BOOST_PROCESS -#include -#endif - namespace po = boost::program_options; namespace ripple { @@ -235,9 +227,7 @@ static int runUnitTests( if (ipv4) ripple::test::envUseIPv4 = true; -#if HAS_BOOST_PROCESS if (!child && num_jobs == 1) -#endif { multi_runner_parent parent_runner; @@ -249,7 +239,6 @@ static int runUnitTests( return EXIT_FAILURE; return EXIT_SUCCESS; } -#if HAS_BOOST_PROCESS if (!child) { multi_runner_parent parent_runner; @@ -299,16 +288,12 @@ static int runUnitTests( return EXIT_FAILURE; return EXIT_SUCCESS; } -#endif } //------------------------------------------------------------------------------ int run (int argc, char** argv) { - // Make sure that we have the right OpenSSL and Boost libraries. - version::checkLibraryVersions(); - using namespace std; beast::setCurrentThreadName ("rippled: main"); @@ -396,10 +381,8 @@ int run (int argc, char** argv) "Force unit test log message output. Only useful in combination with " "--quiet, in which case log messages will print but suite/case names " "will not.") -#if HAS_BOOST_PROCESS ("unittest-jobs", po::value (), "Number of unittest jobs to run in parallel (child processes).") -#endif ; // These are hidden options, not intended to be shown in the usage/help message @@ -465,11 +448,9 @@ int run (int argc, char** argv) std::size_t numJobs = 1; bool unittestChild = false; -#if HAS_BOOST_PROCESS if (vm.count("unittest-jobs")) numJobs = std::max(numJobs, vm["unittest-jobs"].as()); unittestChild = bool (vm.count("unittest-child")); -#endif return runUnitTests( vm["unittest"].as(), argument, @@ -483,7 +464,6 @@ int run (int argc, char** argv) } else { -#if HAS_BOOST_PROCESS if (vm.count("unittest-jobs")) { // unittest jobs only makes sense with `unittest` @@ -491,7 +471,6 @@ int run (int argc, char** argv) std::cerr << "To run the unit tests the '--unittest' option must be present.\n"; return 1; } -#endif } auto config = std::make_unique(); @@ -727,8 +706,8 @@ int main (int argc, char** argv) "GCC version 5.1.0 or later is required to compile rippled."); #endif - static_assert (BOOST_VERSION >= 105700, - "Boost version 1.57 or later is required to compile rippled"); + static_assert (BOOST_VERSION >= 106700, + "Boost version 1.67 or later is required to compile rippled"); // // These debug heap calls do nothing in release or non Visual Studio builds. diff --git a/src/ripple/basics/CheckLibraryVersions.h b/src/ripple/basics/CheckLibraryVersions.h deleted file mode 100644 index 6be0718e48..0000000000 --- a/src/ripple/basics/CheckLibraryVersions.h +++ /dev/null @@ -1,38 +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. -*/ -//============================================================================== - -#ifndef RIPPLE_BASICS_CHECKLIBRARYVERSIONS_H_INCLUDED -#define RIPPLE_BASICS_CHECKLIBRARYVERSIONS_H_INCLUDED - -#include - -namespace ripple { -namespace version { - -/** Check all library versions against Ripple's version requirements. - - Throws std::runtime_error if one or more libraries are out-of-date and do - not meet the version requirements. - */ -void checkLibraryVersions(); - -} // namespace version -} // namespace ripple - -#endif diff --git a/src/ripple/basics/impl/CheckLibraryVersions.cpp b/src/ripple/basics/impl/CheckLibraryVersions.cpp deleted file mode 100644 index 8acf2ccf95..0000000000 --- a/src/ripple/basics/impl/CheckLibraryVersions.cpp +++ /dev/null @@ -1,121 +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 - -namespace ripple { -namespace version { - -std::string -boostVersion(VersionNumber boostVersion) -{ - std::stringstream ss; - ss << (boostVersion / 100000) << "." - << (boostVersion / 100 % 1000) << "." - << (boostVersion % 100); - return ss.str(); -} - -std::string -openSSLVersion(VersionNumber openSSLVersion) -{ - std::stringstream ss; - ss << (openSSLVersion / 0x10000000L) << "." - << (openSSLVersion / 0x100000 % 0x100) << "." - << (openSSLVersion / 0x1000 % 0x100); - auto patchNo = openSSLVersion % 0x10; - if (patchNo) - ss << '-' << char('a' + patchNo - 1); - return ss.str(); -} - -void checkVersion(std::string name, std::string required, std::string actual) -{ - beast::SemanticVersion r, a; - if (! r.parse(required)) - { - Throw ( - "Didn't understand required version of " + name + ": " + required); - } - - if (! a.parse(actual)) - { - Throw ( - "Didn't understand actual version of " + name + ": " + required); - } - - if (a < r) - { - Throw ( - "Your " + name + " library is out of date.\n" + "Your version: " + - actual + "\nRequired version: " + required + "\n"); - } -} - -void checkBoost(std::string version) -{ - const char* boostMinimal = "1.57.0"; - checkVersion("Boost", boostMinimal, version); -} - -void checkOpenSSL(std::string version) -{ - // The minimal version depends on whether we're linking - // against 1.0.1 or later versions: - beast::SemanticVersion v; - - char const* openSSLMinimal101 = "1.0.1-g"; - char const* openSSLMinimal102 = "1.0.2-j"; - - if (v.parse (version) && - v.majorVersion == 1 && - v.minorVersion == 0 && - v.patchVersion == 1) - { - // Use of the 1.0.1 series should be dropped as soon - // as possible since as of January 2, 2017 it is no - // longer supported. Unfortunately, a number of - // platforms officially supported by Ripple still - // use the 1.0.1 branch. - // - // Additionally, requiring 1.0.1u (the latest) is - // similarly not possible, since those officially - // supported platforms use older releases and - // backport important fixes. - checkVersion ("OpenSSL", openSSLMinimal101, version); - return; - } - - checkVersion ("OpenSSL", openSSLMinimal102, version); -} - -void checkLibraryVersions() -{ - checkBoost(boostVersion(BOOST_VERSION)); - checkOpenSSL(openSSLVersion(OPENSSL_VERSION_NUMBER)); -} - -} // namespace version -} // namespace ripple diff --git a/src/ripple/unity/basics.cpp b/src/ripple/unity/basics.cpp index 70103e4d8c..92f16b1e5a 100644 --- a/src/ripple/unity/basics.cpp +++ b/src/ripple/unity/basics.cpp @@ -19,7 +19,6 @@ #include -#include #include #include #include diff --git a/src/test/basics/CheckLibraryVersions_test.cpp b/src/test/basics/CheckLibraryVersions_test.cpp deleted file mode 100644 index cb5e363f43..0000000000 --- a/src/test/basics/CheckLibraryVersions_test.cpp +++ /dev/null @@ -1,55 +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 - -namespace ripple { -namespace version { - -struct CheckLibraryVersions_test : beast::unit_test::suite -{ - void testBadOpenSSL() - { - testcase ("Out-of-Date OpenSSL"); - except ([&]{ checkOpenSSL("0.9.8-o"); }); - except ([&]{ checkOpenSSL("1.0.1-d"); }); - except ([&]{ checkOpenSSL("1.0.2-c"); }); - } - - void testBadBoost() - { - testcase ("Out-of-Date Boost"); - except ([&]{ checkBoost ("1.54.0"); }); - } - - void run() override - { - unexcept ([&]{ checkLibraryVersions(); }); - - testBadOpenSSL(); - testBadBoost(); - } -}; - -BEAST_DEFINE_TESTSUITE(CheckLibraryVersions, ripple_basics, ripple); - -} // namespace version -} // namespace ripple diff --git a/src/test/unity/basics_test_unity.cpp b/src/test/unity/basics_test_unity.cpp index 4c41979fab..da3ab91890 100644 --- a/src/test/unity/basics_test_unity.cpp +++ b/src/test/unity/basics_test_unity.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include