mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add "--jit" option to State tests
This commit is contained in:
parent
b0b14eca7f
commit
49f995a890
@ -26,6 +26,7 @@
|
|||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
#include <libethereum/Client.h>
|
#include <libethereum/Client.h>
|
||||||
#include <liblll/Compiler.h>
|
#include <liblll/Compiler.h>
|
||||||
|
#include <libevm/VMFactory.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev::eth;
|
using namespace dev::eth;
|
||||||
@ -472,4 +473,20 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void processCommandLineOptions()
|
||||||
|
{
|
||||||
|
auto argc = boost::unit_test::framework::master_test_suite().argc;
|
||||||
|
auto argv = boost::unit_test::framework::master_test_suite().argv;
|
||||||
|
|
||||||
|
for (auto i = 0; i < argc; ++i)
|
||||||
|
{
|
||||||
|
if (std::string(argv[i]) == "--jit")
|
||||||
|
{
|
||||||
|
eth::VMFactory::setKind(eth::VMKind::JIT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} } // namespaces
|
} } // namespaces
|
||||||
|
@ -76,6 +76,7 @@ void checkLog(eth::LogEntries _resultLogs, eth::LogEntries _expectedLogs);
|
|||||||
void executeTests(const std::string& _name, const std::string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests);
|
void executeTests(const std::string& _name, const std::string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests);
|
||||||
std::string getTestPath();
|
std::string getTestPath();
|
||||||
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
|
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
|
||||||
|
void processCommandLineOptions();
|
||||||
|
|
||||||
template<typename mapType>
|
template<typename mapType>
|
||||||
void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
|
void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
|
||||||
|
@ -43,6 +43,8 @@ namespace dev { namespace test {
|
|||||||
|
|
||||||
void doStateTests(json_spirit::mValue& v, bool _fillin)
|
void doStateTests(json_spirit::mValue& v, bool _fillin)
|
||||||
{
|
{
|
||||||
|
processCommandLineOptions();
|
||||||
|
|
||||||
for (auto& i: v.get_obj())
|
for (auto& i: v.get_obj())
|
||||||
{
|
{
|
||||||
cnote << i.first;
|
cnote << i.first;
|
||||||
|
19
vm.cpp
19
vm.cpp
@ -277,6 +277,8 @@ namespace dev { namespace test {
|
|||||||
|
|
||||||
void doVMTests(json_spirit::mValue& v, bool _fillin)
|
void doVMTests(json_spirit::mValue& v, bool _fillin)
|
||||||
{
|
{
|
||||||
|
processCommandLineOptions();
|
||||||
|
|
||||||
for (auto& i: v.get_obj())
|
for (auto& i: v.get_obj())
|
||||||
{
|
{
|
||||||
cnote << i.first;
|
cnote << i.first;
|
||||||
@ -286,20 +288,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
|
|||||||
BOOST_REQUIRE(o.count("pre") > 0);
|
BOOST_REQUIRE(o.count("pre") > 0);
|
||||||
BOOST_REQUIRE(o.count("exec") > 0);
|
BOOST_REQUIRE(o.count("exec") > 0);
|
||||||
|
|
||||||
auto argc = boost::unit_test::framework::master_test_suite().argc;
|
FakeExtVM fev;
|
||||||
auto argv = boost::unit_test::framework::master_test_suite().argv;
|
|
||||||
|
|
||||||
for (auto i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
if (std::string(argv[i]) == "--jit")
|
|
||||||
{
|
|
||||||
VMFactory::setKind(VMKind::JIT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dev::test::FakeExtVM fev;
|
|
||||||
|
|
||||||
fev.importEnv(o["env"].get_obj());
|
fev.importEnv(o["env"].get_obj());
|
||||||
fev.importState(o["pre"].get_obj());
|
fev.importState(o["pre"].get_obj());
|
||||||
|
|
||||||
@ -340,6 +329,8 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto endTime = std::chrono::high_resolution_clock::now();
|
auto endTime = std::chrono::high_resolution_clock::now();
|
||||||
|
auto argc = boost::unit_test::framework::master_test_suite().argc;
|
||||||
|
auto argv = boost::unit_test::framework::master_test_suite().argv;
|
||||||
for (auto i = 0; i < argc; ++i)
|
for (auto i = 0; i < argc; ++i)
|
||||||
{
|
{
|
||||||
if (std::string(argv[i]) == "--show-times")
|
if (std::string(argv[i]) == "--show-times")
|
||||||
|
Loading…
Reference in New Issue
Block a user