mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Change loading of VMs and error messages during test.
This commit is contained in:
+53
-61
@@ -420,82 +420,74 @@ std::optional<TestStats> runTestSuite(
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
setupTerminal();
|
||||
|
||||
try
|
||||
{
|
||||
auto options = std::make_unique<solidity::test::IsolTestOptions>(&TestTool::editor);
|
||||
setupTerminal();
|
||||
|
||||
try
|
||||
{
|
||||
auto options = std::make_unique<solidity::test::IsolTestOptions>(&TestTool::editor);
|
||||
|
||||
if (!options->parse(argc, argv))
|
||||
return -1;
|
||||
|
||||
options->validate();
|
||||
solidity::test::CommonOptions::setSingleton(std::move(options));
|
||||
}
|
||||
catch (std::exception const& _exception)
|
||||
{
|
||||
cerr << _exception.what() << endl;
|
||||
|
||||
auto& options = dynamic_cast<solidity::test::IsolTestOptions const&>(solidity::test::CommonOptions::get());
|
||||
|
||||
if (!solidity::test::loadVMs(options))
|
||||
return 1;
|
||||
|
||||
if (options.disableSemanticTests)
|
||||
cout << endl << "--- SKIPPING ALL SEMANTICS TESTS ---" << endl << endl;
|
||||
|
||||
TestStats global_stats{0, 0};
|
||||
cout << "Running tests..." << endl << endl;
|
||||
|
||||
// Actually run the tests.
|
||||
// Interactive tests are added in InteractiveTests.h
|
||||
for (auto const& ts: g_interactiveTestsuites)
|
||||
{
|
||||
if (ts.needsVM && options.disableSemanticTests)
|
||||
continue;
|
||||
|
||||
if (ts.smt && options.disableSMT)
|
||||
continue;
|
||||
|
||||
auto stats = runTestSuite(
|
||||
ts.testCaseCreator,
|
||||
options,
|
||||
options.testPath / ts.path,
|
||||
ts.subpath,
|
||||
ts.title
|
||||
);
|
||||
if (stats)
|
||||
global_stats += *stats;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
auto& options = dynamic_cast<solidity::test::IsolTestOptions const&>(solidity::test::CommonOptions::get());
|
||||
cout << endl << "Summary: ";
|
||||
AnsiColorized(cout, !options.noColor, {BOLD, global_stats ? GREEN : RED}) <<
|
||||
global_stats.successCount << "/" << global_stats.testCount;
|
||||
cout << " tests successful";
|
||||
if (global_stats.skippedCount > 0)
|
||||
{
|
||||
cout << " (";
|
||||
AnsiColorized(cout, !options.noColor, {BOLD, YELLOW}) << global_stats.skippedCount;
|
||||
cout << " tests skipped)";
|
||||
}
|
||||
cout << "." << endl;
|
||||
|
||||
bool disableSemantics = true;
|
||||
try
|
||||
{
|
||||
disableSemantics = !solidity::test::EVMHost::checkVmPaths(options.vmPaths);
|
||||
if (options.disableSemanticTests)
|
||||
cout << "\nNOTE: Skipped semantics tests.\n" << endl;
|
||||
|
||||
return global_stats ? 0 : 1;
|
||||
}
|
||||
catch (std::runtime_error const& _exception)
|
||||
catch (std::exception const& _exception)
|
||||
{
|
||||
cerr << "Error: " << _exception.what() << endl;
|
||||
cerr << _exception.what() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (disableSemantics)
|
||||
cout << endl << "--- SKIPPING ALL SEMANTICS TESTS ---" << endl << endl;
|
||||
|
||||
TestStats global_stats{0, 0};
|
||||
cout << "Running tests..." << endl << endl;
|
||||
|
||||
// Actually run the tests.
|
||||
// Interactive tests are added in InteractiveTests.h
|
||||
for (auto const& ts: g_interactiveTestsuites)
|
||||
{
|
||||
if (ts.needsVM && disableSemantics)
|
||||
continue;
|
||||
|
||||
if (ts.smt && options.disableSMT)
|
||||
continue;
|
||||
|
||||
auto stats = runTestSuite(
|
||||
ts.testCaseCreator,
|
||||
options,
|
||||
options.testPath / ts.path,
|
||||
ts.subpath,
|
||||
ts.title
|
||||
);
|
||||
if (stats)
|
||||
global_stats += *stats;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
cout << endl << "Summary: ";
|
||||
AnsiColorized(cout, !options.noColor, {BOLD, global_stats ? GREEN : RED}) <<
|
||||
global_stats.successCount << "/" << global_stats.testCount;
|
||||
cout << " tests successful";
|
||||
if (global_stats.skippedCount > 0)
|
||||
{
|
||||
cout << " (";
|
||||
AnsiColorized(cout, !options.noColor, {BOLD, YELLOW}) << global_stats.skippedCount;
|
||||
cout << " tests skipped)";
|
||||
}
|
||||
cout << "." << endl;
|
||||
|
||||
if (disableSemantics)
|
||||
cout << "\nNOTE: Skipped semantics tests because no evmc vm could be found.\n" << endl;
|
||||
|
||||
return global_stats ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user