mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
soltest: Handle CLI validation errors gracefully
This commit is contained in:
parent
cf6704ae06
commit
7c83559881
@ -159,6 +159,8 @@ bool CommonOptions::parse(int argc, char const* const* argv)
|
|||||||
po::variables_map arguments;
|
po::variables_map arguments;
|
||||||
addOptions();
|
addOptions();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
po::command_line_parser cmdLineParser(argc, argv);
|
po::command_line_parser cmdLineParser(argc, argv);
|
||||||
cmdLineParser.options(options);
|
cmdLineParser.options(options);
|
||||||
auto parsedOptions = cmdLineParser.run();
|
auto parsedOptions = cmdLineParser.run();
|
||||||
@ -179,6 +181,11 @@ bool CommonOptions::parse(int argc, char const* const* argv)
|
|||||||
errorMessage << token;
|
errorMessage << token;
|
||||||
BOOST_THROW_EXCEPTION(std::runtime_error(errorMessage.str()));
|
BOOST_THROW_EXCEPTION(std::runtime_error(errorMessage.str()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (po::error const& exception)
|
||||||
|
{
|
||||||
|
solThrow(ConfigException, exception.what());
|
||||||
|
}
|
||||||
|
|
||||||
if (vmPaths.empty())
|
if (vmPaths.empty())
|
||||||
{
|
{
|
||||||
|
@ -222,15 +222,17 @@ bool initializeOptions()
|
|||||||
|
|
||||||
// TODO: Prototype -- why isn't this declared in the boost headers?
|
// TODO: Prototype -- why isn't this declared in the boost headers?
|
||||||
// TODO: replace this with a (global) fixture.
|
// 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*/[]);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
master_test_suite_t& master = framework::master_test_suite();
|
master_test_suite_t& master = framework::master_test_suite();
|
||||||
master.p_name.value = "SolidityTests";
|
master.p_name.value = "SolidityTests";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
bool shouldContinue = initializeOptions();
|
bool shouldContinue = initializeOptions();
|
||||||
if (!shouldContinue)
|
if (!shouldContinue)
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -292,6 +294,17 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
|||||||
})
|
})
|
||||||
removeTestSuite(suite);
|
removeTestSuite(suite);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (solidity::test::ConfigException const& exception)
|
||||||
|
{
|
||||||
|
cerr << exception.what() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
catch (std::runtime_error const& exception)
|
||||||
|
{
|
||||||
|
cerr << exception.what() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user