mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
soltest: fix Boost::Test usage.
This commit is contained in:
parent
c296f1664f
commit
a14a7b23ee
@ -57,6 +57,7 @@ include(EthCcache)
|
|||||||
|
|
||||||
# Let's find our dependencies
|
# Let's find our dependencies
|
||||||
include(EthDependencies)
|
include(EthDependencies)
|
||||||
|
find_package(Boost REQUIRED COMPONENTS filesystem system unit_test_framework program_options)
|
||||||
find_package(fmt CONFIG REQUIRED)
|
find_package(fmt CONFIG REQUIRED)
|
||||||
find_package(jsoncpp CONFIG REQUIRED)
|
find_package(jsoncpp CONFIG REQUIRED)
|
||||||
find_package(range-v3 CONFIG REQUIRED)
|
find_package(range-v3 CONFIG REQUIRED)
|
||||||
|
@ -201,7 +201,7 @@ add_executable(soltest ${sources}
|
|||||||
${solcli_sources}
|
${solcli_sources}
|
||||||
${yul_phaser_sources}
|
${yul_phaser_sources}
|
||||||
)
|
)
|
||||||
target_link_libraries(soltest PRIVATE solcli libsolc yul solidity smtutil solutil phaser Boost::boost yulInterpreter evmasm Boost::filesystem Boost::program_options Boost::unit_test_framework evmc)
|
target_link_libraries(soltest PRIVATE solcli libsolc yul solidity smtutil solutil phaser Boost::boost yulInterpreter evmasm Boost::filesystem Boost::program_options evmc)
|
||||||
|
|
||||||
|
|
||||||
# Special compilation flag for Visual Studio (version 2019 at least affected)
|
# Special compilation flag for Visual Studio (version 2019 at least affected)
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4535) // calling _set_se_translator requires /EHa
|
#pragma warning(disable:4535) // calling _set_se_translator requires /EHa
|
||||||
#endif
|
#endif
|
||||||
#include <boost/test/unit_test.hpp>
|
#define BOOST_TEST_NO_MAIN
|
||||||
|
#include <boost/test/included/unit_test.hpp>
|
||||||
#include <boost/test/tree/traverse.hpp>
|
#include <boost/test/tree/traverse.hpp>
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
@ -217,11 +218,7 @@ void initializeOptions()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Prototype -- why isn't this declared in the boost headers?
|
test_suite* solidity_init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
||||||
// TODO: replace this with a (global) fixture.
|
|
||||||
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] );
|
|
||||||
|
|
||||||
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
|
||||||
{
|
{
|
||||||
using namespace solidity::test;
|
using namespace solidity::test;
|
||||||
|
|
||||||
@ -291,17 +288,11 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BOOST_TEST_DYN_LINK should be defined if user want to link against shared boost test library
|
|
||||||
#ifdef BOOST_TEST_DYN_LINK
|
|
||||||
|
|
||||||
// Because we want to have customized initialization function and support shared boost libraries at the same time,
|
// Because we want to have customized initialization function and support shared boost libraries at the same time,
|
||||||
// we are forced to customize the entry point.
|
// we are forced to customize the entry point.
|
||||||
// see: https://www.boost.org/doc/libs/1_67_0/libs/test/doc/html/boost_test/adv_scenarios/shared_lib_customizations/init_func.html
|
// see: https://www.boost.org/doc/libs/1_67_0/libs/test/doc/html/boost_test/adv_scenarios/shared_lib_customizations/init_func.html
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
auto init_unit_test = []() -> bool { init_unit_test_suite(0, nullptr); return true; };
|
return ::boost::unit_test::unit_test_main(solidity_init_unit_test_suite, argc, argv);
|
||||||
return boost::unit_test::unit_test_main(init_unit_test, argc, argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user