mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
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.
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/protocol/digest.h>
|
#include <ripple/protocol/digest.h>
|
||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/basics/CheckLibraryVersions.h>
|
|
||||||
#include <ripple/basics/contract.h>
|
#include <ripple/basics/contract.h>
|
||||||
#include <ripple/basics/StringUtilities.h>
|
#include <ripple/basics/StringUtilities.h>
|
||||||
#include <ripple/basics/Sustain.h>
|
#include <ripple/basics/Sustain.h>
|
||||||
@@ -47,6 +46,7 @@
|
|||||||
|
|
||||||
#include <google/protobuf/stubs/common.h>
|
#include <google/protobuf/stubs/common.h>
|
||||||
|
|
||||||
|
#include <boost/process.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
@@ -60,14 +60,6 @@
|
|||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_VERSION >= 106400
|
|
||||||
#define HAS_BOOST_PROCESS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_BOOST_PROCESS
|
|
||||||
#include <boost/process.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -235,9 +227,7 @@ static int runUnitTests(
|
|||||||
if (ipv4)
|
if (ipv4)
|
||||||
ripple::test::envUseIPv4 = true;
|
ripple::test::envUseIPv4 = true;
|
||||||
|
|
||||||
#if HAS_BOOST_PROCESS
|
|
||||||
if (!child && num_jobs == 1)
|
if (!child && num_jobs == 1)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
multi_runner_parent parent_runner;
|
multi_runner_parent parent_runner;
|
||||||
|
|
||||||
@@ -249,7 +239,6 @@ static int runUnitTests(
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
#if HAS_BOOST_PROCESS
|
|
||||||
if (!child)
|
if (!child)
|
||||||
{
|
{
|
||||||
multi_runner_parent parent_runner;
|
multi_runner_parent parent_runner;
|
||||||
@@ -299,16 +288,12 @@ static int runUnitTests(
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
int run (int argc, char** argv)
|
int run (int argc, char** argv)
|
||||||
{
|
{
|
||||||
// Make sure that we have the right OpenSSL and Boost libraries.
|
|
||||||
version::checkLibraryVersions();
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
beast::setCurrentThreadName ("rippled: main");
|
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 "
|
"Force unit test log message output. Only useful in combination with "
|
||||||
"--quiet, in which case log messages will print but suite/case names "
|
"--quiet, in which case log messages will print but suite/case names "
|
||||||
"will not.")
|
"will not.")
|
||||||
#if HAS_BOOST_PROCESS
|
|
||||||
("unittest-jobs", po::value <std::size_t> (),
|
("unittest-jobs", po::value <std::size_t> (),
|
||||||
"Number of unittest jobs to run in parallel (child processes).")
|
"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
|
// 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;
|
std::size_t numJobs = 1;
|
||||||
bool unittestChild = false;
|
bool unittestChild = false;
|
||||||
#if HAS_BOOST_PROCESS
|
|
||||||
if (vm.count("unittest-jobs"))
|
if (vm.count("unittest-jobs"))
|
||||||
numJobs = std::max(numJobs, vm["unittest-jobs"].as<std::size_t>());
|
numJobs = std::max(numJobs, vm["unittest-jobs"].as<std::size_t>());
|
||||||
unittestChild = bool (vm.count("unittest-child"));
|
unittestChild = bool (vm.count("unittest-child"));
|
||||||
#endif
|
|
||||||
|
|
||||||
return runUnitTests(
|
return runUnitTests(
|
||||||
vm["unittest"].as<std::string>(), argument,
|
vm["unittest"].as<std::string>(), argument,
|
||||||
@@ -483,7 +464,6 @@ int run (int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if HAS_BOOST_PROCESS
|
|
||||||
if (vm.count("unittest-jobs"))
|
if (vm.count("unittest-jobs"))
|
||||||
{
|
{
|
||||||
// unittest jobs only makes sense with `unittest`
|
// 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";
|
std::cerr << "To run the unit tests the '--unittest' option must be present.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto config = std::make_unique<Config>();
|
auto config = std::make_unique<Config>();
|
||||||
@@ -727,8 +706,8 @@ int main (int argc, char** argv)
|
|||||||
"GCC version 5.1.0 or later is required to compile rippled.");
|
"GCC version 5.1.0 or later is required to compile rippled.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static_assert (BOOST_VERSION >= 105700,
|
static_assert (BOOST_VERSION >= 106700,
|
||||||
"Boost version 1.57 or later is required to compile rippled");
|
"Boost version 1.67 or later is required to compile rippled");
|
||||||
|
|
||||||
//
|
//
|
||||||
// These debug heap calls do nothing in release or non Visual Studio builds.
|
// These debug heap calls do nothing in release or non Visual Studio builds.
|
||||||
|
|||||||
@@ -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 <string>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -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 <ripple/basics/contract.h>
|
|
||||||
#include <ripple/basics/impl/CheckLibraryVersionsImpl.h>
|
|
||||||
#include <ripple/beast/core/SemanticVersion.h>
|
|
||||||
#include <boost/version.hpp>
|
|
||||||
#include <openssl/opensslv.h>
|
|
||||||
#include <sstream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
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<std::runtime_error> (
|
|
||||||
"Didn't understand required version of " + name + ": " + required);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! a.parse(actual))
|
|
||||||
{
|
|
||||||
Throw<std::runtime_error> (
|
|
||||||
"Didn't understand actual version of " + name + ": " + required);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a < r)
|
|
||||||
{
|
|
||||||
Throw<std::runtime_error> (
|
|
||||||
"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
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ripple/basics/impl/BasicConfig.cpp>
|
#include <ripple/basics/impl/BasicConfig.cpp>
|
||||||
#include <ripple/basics/impl/CheckLibraryVersions.cpp>
|
|
||||||
#include <ripple/basics/impl/contract.cpp>
|
#include <ripple/basics/impl/contract.cpp>
|
||||||
#include <ripple/basics/impl/CountedObject.cpp>
|
#include <ripple/basics/impl/CountedObject.cpp>
|
||||||
#include <ripple/basics/impl/Log.cpp>
|
#include <ripple/basics/impl/Log.cpp>
|
||||||
|
|||||||
@@ -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 <ripple/basics/CheckLibraryVersions.h>
|
|
||||||
#include <ripple/basics/impl/CheckLibraryVersionsImpl.h>
|
|
||||||
#include <ripple/beast/unit_test.h>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <test/basics/base_uint_test.cpp>
|
#include <test/basics/base_uint_test.cpp>
|
||||||
#include <test/basics/Buffer_test.cpp>
|
#include <test/basics/Buffer_test.cpp>
|
||||||
#include <test/basics/CheckLibraryVersions_test.cpp>
|
|
||||||
#include <test/basics/contract_test.cpp>
|
#include <test/basics/contract_test.cpp>
|
||||||
#include <test/basics/DetectCrash_test.cpp>
|
#include <test/basics/DetectCrash_test.cpp>
|
||||||
#include <test/basics/hardened_hash_test.cpp>
|
#include <test/basics/hardened_hash_test.cpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user