mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1430 from ethereum/runopt
Enable the optimizer for test runs.
This commit is contained in:
commit
851f85769e
@ -65,9 +65,14 @@ $ETH_PATH --test -d /tmp/test &
|
|||||||
# The node needs to get a little way into its startup sequence before the IPC
|
# The node needs to get a little way into its startup sequence before the IPC
|
||||||
# is available and is ready for the unit-tests to start talking to it.
|
# is available and is ready for the unit-tests to start talking to it.
|
||||||
while [ ! -S /tmp/test/geth.ipc ]; do sleep 2; done
|
while [ ! -S /tmp/test/geth.ipc ]; do sleep 2; done
|
||||||
|
echo "--> IPC available."
|
||||||
|
|
||||||
# And then run the Solidity unit-tests, pointing to that IPC endpoint.
|
# And then run the Solidity unit-tests (once without optimization, once with),
|
||||||
"$REPO_ROOT"/build/test/soltest -- --ipcpath /tmp/test/geth.ipc
|
# pointing to that IPC endpoint.
|
||||||
|
echo "--> Running tests without optimizer..."
|
||||||
|
"$REPO_ROOT"/build/test/soltest -- --ipcpath /tmp/test/geth.ipc && \
|
||||||
|
echo "--> Running tests WITH optimizer..." && \
|
||||||
|
"$REPO_ROOT"/build/test/soltest -- --optimize --ipcpath /tmp/test/geth.ipc
|
||||||
ERROR_CODE=$?
|
ERROR_CODE=$?
|
||||||
pkill eth || true
|
pkill eth || true
|
||||||
sleep 4
|
sleep 4
|
||||||
|
@ -39,6 +39,9 @@ Options::Options()
|
|||||||
ipcPath = suite.argv[i + 1];
|
ipcPath = suite.argv[i + 1];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
else if (string(suite.argv[i]) == "--optimize")
|
||||||
|
optimize = true;
|
||||||
|
|
||||||
if (ipcPath.empty())
|
if (ipcPath.empty())
|
||||||
if (auto path = getenv("ETH_TEST_IPC"))
|
if (auto path = getenv("ETH_TEST_IPC"))
|
||||||
ipcPath = path;
|
ipcPath = path;
|
||||||
|
@ -106,6 +106,7 @@ namespace test
|
|||||||
struct Options: boost::noncopyable
|
struct Options: boost::noncopyable
|
||||||
{
|
{
|
||||||
std::string ipcPath;
|
std::string ipcPath;
|
||||||
|
bool optimize = false;
|
||||||
|
|
||||||
static Options const& get();
|
static Options const& get();
|
||||||
|
|
||||||
|
@ -220,7 +220,6 @@ protected:
|
|||||||
{
|
{
|
||||||
if (!s_compiledRegistrar)
|
if (!s_compiledRegistrar)
|
||||||
{
|
{
|
||||||
m_optimize = true;
|
|
||||||
m_compiler.reset(false);
|
m_compiler.reset(false);
|
||||||
m_compiler.addSource("", registrarCode);
|
m_compiler.addSource("", registrarCode);
|
||||||
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
||||||
|
@ -132,7 +132,6 @@ protected:
|
|||||||
{
|
{
|
||||||
if (!s_compiledRegistrar)
|
if (!s_compiledRegistrar)
|
||||||
{
|
{
|
||||||
m_optimize = true;
|
|
||||||
m_compiler.reset(false);
|
m_compiler.reset(false);
|
||||||
m_compiler.addSource("", registrarCode);
|
m_compiler.addSource("", registrarCode);
|
||||||
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
||||||
|
@ -447,7 +447,6 @@ protected:
|
|||||||
{
|
{
|
||||||
if (!s_compiledWallet)
|
if (!s_compiledWallet)
|
||||||
{
|
{
|
||||||
m_optimize = true;
|
|
||||||
m_compiler.reset(false);
|
m_compiler.reset(false);
|
||||||
m_compiler.addSource("", walletCode);
|
m_compiler.addSource("", walletCode);
|
||||||
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
|
||||||
|
@ -46,6 +46,7 @@ string getIPCSocketPath()
|
|||||||
|
|
||||||
ExecutionFramework::ExecutionFramework() :
|
ExecutionFramework::ExecutionFramework() :
|
||||||
m_rpc(RPCSession::instance(getIPCSocketPath())),
|
m_rpc(RPCSession::instance(getIPCSocketPath())),
|
||||||
|
m_optimize(dev::test::Options::get().optimize),
|
||||||
m_sender(m_rpc.account(0))
|
m_sender(m_rpc.account(0))
|
||||||
{
|
{
|
||||||
m_rpc.test_rewindToBlock(0);
|
m_rpc.test_rewindToBlock(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user