diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/RPCSession.cpp | 5 | ||||
-rw-r--r-- | test/RPCSession.h | 4 | ||||
-rw-r--r-- | test/TestHelper.cpp | 4 | ||||
-rw-r--r-- | test/TestHelper.h | 1 | ||||
-rw-r--r-- | test/boostTest.cpp | 31 | ||||
-rw-r--r-- | test/libsolidity/GasMeter.cpp | 45 |
6 files changed, 84 insertions, 6 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp index f8b364d1..3ea3b1fe 100644 --- a/test/RPCSession.cpp +++ b/test/RPCSession.cpp @@ -220,7 +220,10 @@ void RPCSession::test_setChainParams(vector<string> const& _accounts) "accountStartNonce": "0x", "maximumExtraDataSize": "0x1000000", "blockReward": "0x", - "allowFutureBlocks": "1" + "allowFutureBlocks": "1", + "homsteadForkBlock": "0x00", + "EIP150ForkBlock": "0x00", + "EIP158ForkBlock": "0x00" }, "genesis": { "author": "0000000000000010000000000000000000000000", diff --git a/test/RPCSession.h b/test/RPCSession.h index b37cc322..f3c3339a 100644 --- a/test/RPCSession.h +++ b/test/RPCSession.h @@ -68,7 +68,7 @@ private: int m_socket; /// Socket read timeout in milliseconds. Needs to be large because the key generation routine /// might take long. - unsigned static constexpr m_readTimeOutMS = 15000; + unsigned static constexpr m_readTimeOutMS = 300000; char m_readBuf[512000]; }; #endif @@ -133,7 +133,7 @@ private: IPCSocket m_ipcSocket; size_t m_rpcSequence = 1; - unsigned m_maxMiningTime = 15000; // 15 seconds + unsigned m_maxMiningTime = 6000000; // 600 seconds unsigned m_sleepTime = 10; // 10 milliseconds unsigned m_successfulMineRuns = 0; diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 0c0857c9..094b59c6 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -43,8 +43,10 @@ Options::Options() optimize = true; else if (string(suite.argv[i]) == "--show-messages") showMessages = true; + else if (string(suite.argv[i]) == "--no-ipc") + disableIPC = true; - if (ipcPath.empty()) + if (!disableIPC && ipcPath.empty()) if (auto path = getenv("ETH_TEST_IPC")) ipcPath = path; } diff --git a/test/TestHelper.h b/test/TestHelper.h index 8f05eead..3e74b54c 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -108,6 +108,7 @@ struct Options: boost::noncopyable std::string ipcPath; bool showMessages = false; bool optimize = false; + bool disableIPC = false; static Options const& get(); diff --git a/test/boostTest.cpp b/test/boostTest.cpp index d1d35be3..6fc1c925 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -21,11 +21,9 @@ * Original code taken from boost sources. */ -#define BOOST_TEST_MODULE EthereumTests #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" - #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4535) // calling _set_se_translator requires /EHa @@ -36,3 +34,32 @@ #endif #pragma GCC diagnostic pop + +#include <test/TestHelper.h> + +using namespace boost::unit_test; + +test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) +{ + master_test_suite_t& master = framework::master_test_suite(); + master.p_name.value = "SolidityTests"; + if (dev::test::Options::get().disableIPC) + { + for (auto suite: { + "SolidityAuctionRegistrar", + "SolidityFixedFeeRegistrar", + "SolidityWallet", + "LLLEndToEndTest", + "GasMeterTests", + "SolidityEndToEndTest", + "SolidityOptimizer" + }) + { + auto id = master.get(suite); + assert(id != INV_TEST_UNIT_ID); + master.remove(id); + } + } + + return 0; +} diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 0671fb15..f90cb105 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -248,6 +248,51 @@ BOOST_AUTO_TEST_CASE(multiple_external_functions) testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)}); } +BOOST_AUTO_TEST_CASE(exponent_size) +{ + char const* sourceCode = R"( + contract A { + function g(uint x) returns (uint) { + return x ** 0x100; + } + function h(uint x) returns (uint) { + return x ** 0x10000; + } + } + )"; + testCreationTimeGas(sourceCode); + testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)}); + testRunTimeGas("h(uint256)", vector<bytes>{encodeArgs(2)}); +} + +BOOST_AUTO_TEST_CASE(balance_gas) +{ + char const* sourceCode = R"( + contract A { + function lookup_balance(address a) returns (uint) { + return a.balance; + } + } + )"; + testCreationTimeGas(sourceCode); + testRunTimeGas("lookup_balance(address)", vector<bytes>{encodeArgs(2), encodeArgs(100)}); +} + +BOOST_AUTO_TEST_CASE(extcodesize_gas) +{ + char const* sourceCode = R"( + contract A { + function f() returns (uint _s) { + assembly { + _s := extcodesize(0x30) + } + } + } + )"; + testCreationTimeGas(sourceCode); + testRunTimeGas("f()", vector<bytes>{encodeArgs()}); +} + BOOST_AUTO_TEST_SUITE_END() } |