mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6041 from ethereum/default-ipc-options
Unify isoltest and soltest options code
This commit is contained in:
commit
0166b4d948
@ -30,7 +30,7 @@ add_executable(soltest ${sources} ${headers}
|
|||||||
${libsolidity_sources} ${libsolidity_headers}
|
${libsolidity_sources} ${libsolidity_headers}
|
||||||
${libsolidity_util_sources} ${libsolidity_util_headers}
|
${libsolidity_util_sources} ${libsolidity_util_headers}
|
||||||
)
|
)
|
||||||
target_link_libraries(soltest PRIVATE libsolc yul solidity evmasm devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
target_link_libraries(soltest PRIVATE libsolc yul solidity evmasm devcore ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||||
|
|
||||||
if (LLL)
|
if (LLL)
|
||||||
target_link_libraries(soltest PRIVATE lll)
|
target_link_libraries(soltest PRIVATE lll)
|
||||||
|
@ -17,17 +17,29 @@
|
|||||||
|
|
||||||
#include <test/Common.h>
|
#include <test/Common.h>
|
||||||
|
|
||||||
|
#include <libdevcore/Assertions.h>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
|
||||||
boost::filesystem::path discoverTestPath()
|
/// If non-empty returns the value of the env. variable ETH_TEST_PATH, otherwise
|
||||||
|
/// it tries to find a path that contains the directories "libsolidity/syntaxTests"
|
||||||
|
/// and returns it if found.
|
||||||
|
/// The routine searches in the current directory, and inside the "test" directory
|
||||||
|
/// starting from the current directory and up to three levels up.
|
||||||
|
/// @returns the path of the first match or an empty path if not found.
|
||||||
|
boost::filesystem::path testPath()
|
||||||
{
|
{
|
||||||
|
if (auto path = getenv("ETH_TEST_PATH"))
|
||||||
|
return path;
|
||||||
|
|
||||||
auto const searchPath =
|
auto const searchPath =
|
||||||
{
|
{
|
||||||
fs::current_path() / ".." / ".." / ".." / "test",
|
fs::current_path() / ".." / ".." / ".." / "test",
|
||||||
@ -45,6 +57,70 @@ boost::filesystem::path discoverTestPath()
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string IPCEnvOrDefaultPath()
|
||||||
|
{
|
||||||
|
if (auto path = getenv("ETH_TEST_IPC"))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
if (auto home = getenv("HOME"))
|
||||||
|
return std::string(home) + "/.ethereum/geth.ipc";
|
||||||
|
|
||||||
|
return std::string{};
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonOptions::CommonOptions(std::string _caption):
|
||||||
|
options(_caption,
|
||||||
|
po::options_description::m_default_line_length,
|
||||||
|
po::options_description::m_default_line_length - 23
|
||||||
|
)
|
||||||
|
{
|
||||||
|
options.add_options()
|
||||||
|
("testpath", po::value<fs::path>(&this->testPath)->default_value(dev::test::testPath()), "path to test files")
|
||||||
|
("ipcpath", po::value<fs::path>(&ipcPath)->default_value(IPCEnvOrDefaultPath()), "path to ipc socket")
|
||||||
|
("no-ipc", po::bool_switch(&disableIPC), "disable semantic tests")
|
||||||
|
("no-smt", po::bool_switch(&disableSMT), "disable SMT checker");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommonOptions::validate() const
|
||||||
|
{
|
||||||
|
assertThrow(
|
||||||
|
!testPath.empty(),
|
||||||
|
ConfigException,
|
||||||
|
"No test path specified. The --testpath argument must not be empty when given."
|
||||||
|
);
|
||||||
|
assertThrow(
|
||||||
|
fs::exists(testPath),
|
||||||
|
ConfigException,
|
||||||
|
"Invalid test path specified."
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!disableIPC)
|
||||||
|
{
|
||||||
|
assertThrow(
|
||||||
|
!ipcPath.empty(),
|
||||||
|
ConfigException,
|
||||||
|
"No ipc path specified. The --ipcpath argument must not be empty when given."
|
||||||
|
);
|
||||||
|
assertThrow(
|
||||||
|
fs::exists(ipcPath),
|
||||||
|
ConfigException,
|
||||||
|
"Invalid ipc path specified."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommonOptions::parse(int argc, char const* const* argv)
|
||||||
|
{
|
||||||
|
po::variables_map arguments;
|
||||||
|
|
||||||
|
po::command_line_parser cmdLineParser(argc, argv);
|
||||||
|
cmdLineParser.options(options);
|
||||||
|
po::store(cmdLineParser.run(), arguments);
|
||||||
|
po::notify(arguments);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,19 +17,37 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <libdevcore/Exceptions.h>
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Tries to find a path that contains the directories "libsolidity/syntaxTests"
|
struct ConfigException : public Exception {};
|
||||||
/// and returns it if found.
|
|
||||||
/// The routine searches in the current directory, and inside the "test" directory
|
struct CommonOptions: boost::noncopyable
|
||||||
/// starting from the current directory and up to three levels up.
|
{
|
||||||
/// @returns the path of the first match or an empty path if not found.
|
boost::filesystem::path ipcPath;
|
||||||
boost::filesystem::path discoverTestPath();
|
boost::filesystem::path testPath;
|
||||||
|
bool optimize = false;
|
||||||
|
bool disableIPC = false;
|
||||||
|
bool disableSMT = false;
|
||||||
|
|
||||||
|
virtual bool parse(int argc, char const* const* argv);
|
||||||
|
// Throws a ConfigException on error
|
||||||
|
virtual void validate() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CommonOptions(std::string caption = "");
|
||||||
|
|
||||||
|
boost::program_options::options_description options;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ h256 const EmptyTrie("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5
|
|||||||
|
|
||||||
string getIPCSocketPath()
|
string getIPCSocketPath()
|
||||||
{
|
{
|
||||||
string ipcPath = dev::test::Options::get().ipcPath;
|
string ipcPath = dev::test::Options::get().ipcPath.string();
|
||||||
if (ipcPath.empty())
|
if (ipcPath.empty())
|
||||||
BOOST_FAIL("ERROR: ipcPath not set! (use --ipcpath <path> or the environment variable ETH_TEST_IPC)");
|
BOOST_FAIL("ERROR: ipcPath not set! (use --ipcpath <path> or the environment variable ETH_TEST_IPC)");
|
||||||
|
|
||||||
|
@ -28,10 +28,13 @@
|
|||||||
|
|
||||||
#include <boost/test/framework.hpp>
|
#include <boost/test/framework.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev::test;
|
using namespace dev::test;
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
|
||||||
Options const& Options::get()
|
Options const& Options::get()
|
||||||
{
|
{
|
||||||
@ -39,59 +42,21 @@ Options const& Options::get()
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Options::Options()
|
Options::Options()
|
||||||
{
|
{
|
||||||
auto const& suite = boost::unit_test::framework::master_test_suite();
|
auto const& suite = boost::unit_test::framework::master_test_suite();
|
||||||
for (auto i = 0; i < suite.argc; i++)
|
|
||||||
if (string(suite.argv[i]) == "--ipcpath" && i + 1 < suite.argc)
|
|
||||||
{
|
|
||||||
ipcPath = suite.argv[i + 1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (string(suite.argv[i]) == "--testpath" && i + 1 < suite.argc)
|
|
||||||
{
|
|
||||||
testPath = suite.argv[i + 1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (string(suite.argv[i]) == "--optimize")
|
|
||||||
optimize = true;
|
|
||||||
else if (string(suite.argv[i]) == "--abiencoderv2")
|
|
||||||
useABIEncoderV2 = true;
|
|
||||||
else if (string(suite.argv[i]) == "--evm-version")
|
|
||||||
{
|
|
||||||
evmVersionString = i + 1 < suite.argc ? suite.argv[i + 1] : "INVALID";
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
else if (string(suite.argv[i]) == "--show-messages")
|
|
||||||
showMessages = true;
|
|
||||||
else if (string(suite.argv[i]) == "--no-ipc")
|
|
||||||
disableIPC = true;
|
|
||||||
else if (string(suite.argv[i]) == "--no-smt")
|
|
||||||
disableSMT = true;
|
|
||||||
|
|
||||||
if (!disableIPC && ipcPath.empty())
|
if (suite.argc == 0)
|
||||||
if (auto path = getenv("ETH_TEST_IPC"))
|
return;
|
||||||
ipcPath = path;
|
|
||||||
|
|
||||||
if (testPath.empty())
|
options.add_options()
|
||||||
if (auto path = getenv("ETH_TEST_PATH"))
|
("optimize", po::bool_switch(&optimize), "enables optimization")
|
||||||
testPath = path;
|
("abiencoderv2", po::bool_switch(&useABIEncoderV2), "enables abi encoder v2")
|
||||||
|
("evm-version", po::value(&evmVersionString), "which evm version to use")
|
||||||
|
("show-messages", po::bool_switch(&showMessages), "enables message output");
|
||||||
|
|
||||||
if (testPath.empty())
|
parse(suite.argc, suite.argv);
|
||||||
testPath = discoverTestPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Options::validate() const
|
|
||||||
{
|
|
||||||
solAssert(
|
|
||||||
!dev::test::Options::get().testPath.empty(),
|
|
||||||
"No test path specified. The --testpath argument is required."
|
|
||||||
);
|
|
||||||
if (!disableIPC)
|
|
||||||
solAssert(
|
|
||||||
!dev::test::Options::get().ipcPath.empty(),
|
|
||||||
"No ipc path specified. The --ipcpath argument is required, unless --no-ipc is used."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev::solidity::EVMVersion Options::evmVersion() const
|
dev::solidity::EVMVersion Options::evmVersion() const
|
||||||
|
@ -14,17 +14,16 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/** @file TestHelper.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <liblangutil/EVMVersion.h>
|
#include <liblangutil/EVMVersion.h>
|
||||||
|
#include <test/Common.h>
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <boost/noncopyable.hpp>
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -33,17 +32,11 @@ namespace dev
|
|||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Options: boost::noncopyable
|
struct Options: CommonOptions
|
||||||
{
|
{
|
||||||
std::string ipcPath;
|
|
||||||
boost::filesystem::path testPath;
|
|
||||||
bool showMessages = false;
|
bool showMessages = false;
|
||||||
bool optimize = false;
|
|
||||||
bool disableIPC = false;
|
|
||||||
bool disableSMT = false;
|
|
||||||
bool useABIEncoderV2 = false;
|
bool useABIEncoderV2 = false;
|
||||||
|
|
||||||
void validate() const;
|
|
||||||
solidity::EVMVersion evmVersion() const;
|
solidity::EVMVersion evmVersion() const;
|
||||||
|
|
||||||
static Options const& get();
|
static Options const& get();
|
||||||
|
@ -144,7 +144,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
|||||||
master,
|
master,
|
||||||
options.testPath / ts.path,
|
options.testPath / ts.path,
|
||||||
ts.subpath,
|
ts.subpath,
|
||||||
options.ipcPath,
|
options.ipcPath.string(),
|
||||||
ts.testCaseCreator
|
ts.testCaseCreator
|
||||||
) > 0, std::string("no ") + ts.title + " tests found");
|
) > 0, std::string("no ") + ts.title + " tests found");
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ target_link_libraries(yulopti PRIVATE solidity ${Boost_PROGRAM_OPTIONS_LIBRARIES
|
|||||||
|
|
||||||
add_executable(isoltest
|
add_executable(isoltest
|
||||||
isoltest.cpp
|
isoltest.cpp
|
||||||
|
IsolTestOptions.cpp
|
||||||
../Options.cpp
|
../Options.cpp
|
||||||
../Common.cpp
|
../Common.cpp
|
||||||
../TestCase.cpp
|
../TestCase.cpp
|
||||||
|
74
test/tools/IsolTestOptions.cpp
Normal file
74
test/tools/IsolTestOptions.cpp
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
This file is part of solidity.
|
||||||
|
|
||||||
|
solidity is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
solidity is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file IsolTestOptions.cpp
|
||||||
|
* @date 2019
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <test/tools/IsolTestOptions.h>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
namespace dev
|
||||||
|
{
|
||||||
|
namespace test
|
||||||
|
{
|
||||||
|
|
||||||
|
auto const description = R"(isoltest, tool for interactively managing test contracts.
|
||||||
|
Usage: isoltest [Options] --ipcpath ipcpath
|
||||||
|
Interactively validates test contracts.
|
||||||
|
|
||||||
|
Allowed options)";
|
||||||
|
|
||||||
|
std::string editorPath()
|
||||||
|
{
|
||||||
|
if (getenv("EDITOR"))
|
||||||
|
return getenv("EDITOR");
|
||||||
|
else if (fs::exists("/usr/bin/editor"))
|
||||||
|
return "/usr/bin/editor";
|
||||||
|
|
||||||
|
return std::string{};
|
||||||
|
}
|
||||||
|
|
||||||
|
IsolTestOptions::IsolTestOptions(std::string* _editor):
|
||||||
|
CommonOptions(description)
|
||||||
|
{
|
||||||
|
options.add_options()
|
||||||
|
("help", po::bool_switch(&showHelp), "Show this help screen.")
|
||||||
|
("no-color", po::bool_switch(&formatted), "don't use colors")
|
||||||
|
("editor", po::value<std::string>(_editor)->default_value(editorPath()), "editor for opening test files");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsolTestOptions::parse(int _argc, char const* const* _argv)
|
||||||
|
{
|
||||||
|
bool const res = CommonOptions::parse(_argc, _argv);
|
||||||
|
|
||||||
|
if (showHelp || !res)
|
||||||
|
{
|
||||||
|
std::cout << options << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
38
test/tools/IsolTestOptions.h
Normal file
38
test/tools/IsolTestOptions.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
This file is part of solidity.
|
||||||
|
|
||||||
|
solidity is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
solidity is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file IsolTestOptions.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <test/Common.h>
|
||||||
|
|
||||||
|
namespace dev
|
||||||
|
{
|
||||||
|
namespace test
|
||||||
|
{
|
||||||
|
|
||||||
|
struct IsolTestOptions: CommonOptions
|
||||||
|
{
|
||||||
|
bool formatted = true;
|
||||||
|
bool showHelp = false;
|
||||||
|
|
||||||
|
IsolTestOptions(std::string* _editor);
|
||||||
|
bool parse(int _argc, char const* const* _argv) override;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
#include <libdevcore/AnsiColorized.h>
|
#include <libdevcore/AnsiColorized.h>
|
||||||
|
|
||||||
#include <test/Common.h>
|
#include <test/Common.h>
|
||||||
|
#include <test/tools/IsolTestOptions.h>
|
||||||
#include <test/libsolidity/AnalysisFramework.h>
|
#include <test/libsolidity/AnalysisFramework.h>
|
||||||
#include <test/InteractiveTests.h>
|
#include <test/InteractiveTests.h>
|
||||||
|
|
||||||
@ -322,72 +323,18 @@ boost::optional<TestStats> runTestSuite(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char const *argv[])
|
||||||
{
|
{
|
||||||
setupTerminal();
|
setupTerminal();
|
||||||
|
|
||||||
if (getenv("EDITOR"))
|
dev::test::IsolTestOptions options(&TestTool::editor);
|
||||||
TestTool::editor = getenv("EDITOR");
|
|
||||||
else if (fs::exists("/usr/bin/editor"))
|
|
||||||
TestTool::editor = "/usr/bin/editor";
|
|
||||||
|
|
||||||
fs::path testPath;
|
|
||||||
string ipcPath;
|
|
||||||
bool disableIPC = false;
|
|
||||||
bool disableSMT = false;
|
|
||||||
bool formatted = true;
|
|
||||||
po::options_description options(
|
|
||||||
R"(isoltest, tool for interactively managing test contracts.
|
|
||||||
Usage: isoltest [Options] --ipcpath ipcpath
|
|
||||||
Interactively validates test contracts.
|
|
||||||
|
|
||||||
Allowed options)",
|
|
||||||
po::options_description::m_default_line_length,
|
|
||||||
po::options_description::m_default_line_length - 23);
|
|
||||||
options.add_options()
|
|
||||||
("help", "Show this help screen.")
|
|
||||||
("testpath", po::value<fs::path>(&testPath), "path to test files")
|
|
||||||
("ipcpath", po::value<string>(&ipcPath), "path to ipc socket")
|
|
||||||
("no-ipc", "disable semantic tests")
|
|
||||||
("no-smt", "disable SMT checker")
|
|
||||||
("no-color", "don't use colors")
|
|
||||||
("editor", po::value<string>(&TestTool::editor), "editor for opening contracts");
|
|
||||||
|
|
||||||
po::variables_map arguments;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
po::command_line_parser cmdLineParser(argc, argv);
|
if (options.parse(argc, argv))
|
||||||
cmdLineParser.options(options);
|
options.validate();
|
||||||
po::store(cmdLineParser.run(), arguments);
|
|
||||||
|
|
||||||
if (arguments.count("help"))
|
|
||||||
{
|
|
||||||
cout << options << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.count("no-color"))
|
|
||||||
formatted = false;
|
|
||||||
|
|
||||||
po::notify(arguments);
|
|
||||||
|
|
||||||
if (arguments.count("no-ipc"))
|
|
||||||
disableIPC = true;
|
|
||||||
else
|
else
|
||||||
{
|
return 1;
|
||||||
solAssert(
|
|
||||||
!ipcPath.empty(),
|
|
||||||
"No ipc path specified. The --ipcpath argument is required, unless --no-ipc is used."
|
|
||||||
);
|
|
||||||
solAssert(
|
|
||||||
fs::exists(ipcPath),
|
|
||||||
"Invalid ipc path specified."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.count("no-smt"))
|
|
||||||
disableSMT = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::exception const& _exception)
|
catch (std::exception const& _exception)
|
||||||
{
|
{
|
||||||
@ -395,29 +342,26 @@ Allowed options)",
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testPath.empty())
|
|
||||||
testPath = dev::test::discoverTestPath();
|
|
||||||
|
|
||||||
TestStats global_stats{0, 0};
|
TestStats global_stats{0, 0};
|
||||||
|
|
||||||
// Actually run the tests.
|
// Actually run the tests.
|
||||||
// Interactive tests are added in InteractiveTests.h
|
// Interactive tests are added in InteractiveTests.h
|
||||||
for (auto const& ts: g_interactiveTestsuites)
|
for (auto const& ts: g_interactiveTestsuites)
|
||||||
{
|
{
|
||||||
if (ts.ipc && disableIPC)
|
if (ts.ipc && options.disableIPC)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ts.smt && disableSMT)
|
if (ts.smt && options.disableSMT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (auto stats = runTestSuite(ts.title, testPath / ts.path, ts.subpath, ipcPath, ts.testCaseCreator, formatted))
|
if (auto stats = runTestSuite(ts.title, options.testPath / ts.path, ts.subpath, options.ipcPath.string(), ts.testCaseCreator, options.formatted))
|
||||||
global_stats += *stats;
|
global_stats += *stats;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << endl << "Summary: ";
|
cout << endl << "Summary: ";
|
||||||
AnsiColorized(cout, formatted, {BOLD, global_stats ? GREEN : RED}) <<
|
AnsiColorized(cout, options.formatted, {BOLD, global_stats ? GREEN : RED}) <<
|
||||||
global_stats.successCount << "/" << global_stats.testCount;
|
global_stats.successCount << "/" << global_stats.testCount;
|
||||||
cout << " tests successful." << endl;
|
cout << " tests successful." << endl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user