diff options
author | chriseth <chris@ethereum.org> | 2018-02-23 00:21:26 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-03-02 00:19:35 +0800 |
commit | f2f61f1c2f3b4d553c07fcf1746f49e799cb7aa4 (patch) | |
tree | 80555ec0e8139a30bfd7bc83cc1acf811eada487 /test | |
parent | 83515eadcf21decc9355c69c621c4d530a62b04e (diff) | |
download | dexon-solidity-f2f61f1c2f3b4d553c07fcf1746f49e799cb7aa4.tar.gz dexon-solidity-f2f61f1c2f3b4d553c07fcf1746f49e799cb7aa4.tar.zst dexon-solidity-f2f61f1c2f3b4d553c07fcf1746f49e799cb7aa4.zip |
Test both EVM versions.
Diffstat (limited to 'test')
-rw-r--r-- | test/ExecutionFramework.cpp | 15 | ||||
-rw-r--r-- | test/ExecutionFramework.h | 3 | ||||
-rw-r--r-- | test/TestHelper.cpp | 11 | ||||
-rw-r--r-- | test/TestHelper.h | 6 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 1 |
5 files changed, 31 insertions, 5 deletions
diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index 85b5bd3b..adf514e2 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -20,13 +20,15 @@ * Framework for executing contracts and testing them using RPC. */ -#include <cstdlib> -#include <boost/test/framework.hpp> -#include <libdevcore/CommonIO.h> #include <test/ExecutionFramework.h> +#include <libdevcore/CommonIO.h> + +#include <boost/test/framework.hpp> #include <boost/algorithm/string/replace.hpp> +#include <cstdlib> + using namespace std; using namespace dev; using namespace dev::test; @@ -53,6 +55,13 @@ ExecutionFramework::ExecutionFramework() : m_showMessages(dev::test::Options::get().showMessages), m_sender(m_rpc.account(0)) { + if (!dev::test::Options::get().evmVersion.empty()) + { + auto version = solidity::EVMVersion::fromString(dev::test::Options::get().evmVersion); + BOOST_REQUIRE_MESSAGE(version, "Invalid EVM version: " + dev::test::Options::get().evmVersion); + m_evmVersion = *version; + } + m_rpc.test_rewindToBlock(0); } diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index 8aa99473..a7971b81 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -25,6 +25,8 @@ #include <test/TestHelper.h> #include <test/RPCSession.h> +#include <libsolidity/interface/EVMVersion.h> + #include <libdevcore/FixedHash.h> #include <libdevcore/SHA3.h> @@ -227,6 +229,7 @@ protected: bytes data; }; + solidity::EVMVersion m_evmVersion; unsigned m_optimizeRuns = 200; bool m_optimize = false; bool m_showMessages = false; diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index c8747a06..fbf2dc90 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -19,8 +19,12 @@ * @date 2014 */ +#include <test/TestHelper.h> + +#include <libsolidity/interface/EVMVersion.h> + #include <boost/test/framework.hpp> -#include "TestHelper.h" + using namespace std; using namespace dev::test; @@ -41,6 +45,11 @@ Options::Options() } else if (string(suite.argv[i]) == "--optimize") optimize = true; + else if (string(suite.argv[i]) == "--evm-version") + { + evmVersion = 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") diff --git a/test/TestHelper.h b/test/TestHelper.h index d25c5cd8..69ac458a 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -19,11 +19,14 @@ #pragma once -#include <functional> +#include <libsolidity/interface/EVMVersion.h> + #include <boost/test/unit_test.hpp> #include <boost/filesystem.hpp> #include <boost/version.hpp> +#include <functional> + namespace dev { namespace test @@ -33,6 +36,7 @@ struct Options: boost::noncopyable { std::string ipcPath; bool showMessages = false; + std::string evmVersion; bool optimize = false; bool disableIPC = false; bool disableSMT = false; diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index f562721d..12687dd1 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -68,6 +68,7 @@ public: m_compiler.reset(false); m_compiler.addSource("", sourceCode); m_compiler.setLibraries(_libraryAddresses); + m_compiler.setEVMVersion(m_evmVersion); m_compiler.setOptimiserSettings(m_optimize, m_optimizeRuns); if (!m_compiler.compile()) { |