aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TestHelper.cpp17
-rw-r--r--TestHelper.h1
-rw-r--r--state.cpp2
-rw-r--r--vm.cpp19
4 files changed, 25 insertions, 14 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index b0935d0b..6f7bf31d 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -26,6 +26,7 @@
#include <boost/filesystem/path.hpp>
#include <libethereum/Client.h>
#include <liblll/Compiler.h>
+#include <libevm/VMFactory.h>
using namespace std;
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
diff --git a/TestHelper.h b/TestHelper.h
index 3203eae8..20328c91 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -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);
std::string getTestPath();
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
+void processCommandLineOptions();
template<typename mapType>
void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
diff --git a/state.cpp b/state.cpp
index 07c8373e..961f0f13 100644
--- a/state.cpp
+++ b/state.cpp
@@ -43,6 +43,8 @@ namespace dev { namespace test {
void doStateTests(json_spirit::mValue& v, bool _fillin)
{
+ processCommandLineOptions();
+
for (auto& i: v.get_obj())
{
cnote << i.first;
diff --git a/vm.cpp b/vm.cpp
index bcd7df9b..075b3f2a 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -277,6 +277,8 @@ namespace dev { namespace test {
void doVMTests(json_spirit::mValue& v, bool _fillin)
{
+ processCommandLineOptions();
+
for (auto& i: v.get_obj())
{
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("exec") > 0);
- 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")
- {
- VMFactory::setKind(VMKind::JIT);
- break;
- }
- }
-
- dev::test::FakeExtVM fev;
-
+ FakeExtVM fev;
fev.importEnv(o["env"].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 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]) == "--show-times")