From 7bace8d25d55a71a243ca117699f9c665a47ca2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 15 Nov 2021 17:49:27 +0100 Subject: [PATCH] soltest: Don't assume that parse() can never return false --- test/boostTest.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/boostTest.cpp b/test/boostTest.cpp index 1cc512c32..0d3b0eb34 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -204,15 +204,18 @@ int registerTests( return numTestsAdded; } -void initializeOptions() +bool initializeOptions() { auto const& suite = boost::unit_test::framework::master_test_suite(); auto options = std::make_unique(); - solAssert(options->parse(suite.argc, suite.argv), "Failed to parse options!"); + bool shouldContinue = options->parse(suite.argc, suite.argv); + if (!shouldContinue) + return false; options->validate(); solidity::test::CommonOptions::setSingleton(std::move(options)); + return true; } } @@ -228,7 +231,9 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) master_test_suite_t& master = framework::master_test_suite(); master.p_name.value = "SolidityTests"; - initializeOptions(); + bool shouldContinue = initializeOptions(); + if (!shouldContinue) + exit(0); if (!solidity::test::loadVMs(solidity::test::CommonOptions::get())) exit(1);