mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6687 from ethereum/rely-on_flush
TestFramework: Remove polling and use eth_flush instead
This commit is contained in:
commit
a4e8ca06df
@ -96,7 +96,7 @@ The option ``--no-smt`` disables the tests that require ``libz3`` and
|
|||||||
``--no-ipc`` disables those that require ``aleth``.
|
``--no-ipc`` disables those that require ``aleth``.
|
||||||
|
|
||||||
If you want to run the ipc tests (that test the semantics of the generated code),
|
If you want to run the ipc tests (that test the semantics of the generated code),
|
||||||
you need to install `aleth <https://github.com/ethereum/aleth/releases/download/v1.6.0-rc.1/aleth-1.6.0-rc.1-linux-x86_64.tar.gz>`_ and run it in testing mode: ``aleth --db memorydb --test -d /tmp/testeth``.
|
you need to install `aleth <https://github.com/ethereum/aleth/releases/download/v1.6.0/aleth-1.6.0-linux-x86_64.tar.gz>`_ and run it in testing mode: ``aleth --db memorydb --test -d /tmp/testeth``.
|
||||||
|
|
||||||
To run the actual tests, use: ``./scripts/soltest.sh --ipcpath /tmp/testeth/geth.ipc``.
|
To run the actual tests, use: ``./scripts/soltest.sh --ipcpath /tmp/testeth/geth.ipc``.
|
||||||
|
|
||||||
|
@ -134,9 +134,9 @@ function download_aleth()
|
|||||||
ALETH_PATH="aleth"
|
ALETH_PATH="aleth"
|
||||||
else
|
else
|
||||||
mkdir -p /tmp/test
|
mkdir -p /tmp/test
|
||||||
# Any time the hash is updated here, the "Running compiler tests" section should also be updated.
|
# Any time the hash is updated here, the "Running the compiler tests" section in contributing.rst should also be updated.
|
||||||
ALETH_HASH="8979a9179d5222c89bf9daf7ca73cc115fa2dac2"
|
ALETH_HASH="7f7004e1563299bc57882e32b32e4a195747dfb6"
|
||||||
ALETH_VERSION=1.6.0-rc.1
|
ALETH_VERSION=1.6.0
|
||||||
wget -q -O /tmp/test/aleth.tar.gz https://github.com/ethereum/aleth/releases/download/v${ALETH_VERSION}/aleth-${ALETH_VERSION}-linux-x86_64.tar.gz
|
wget -q -O /tmp/test/aleth.tar.gz https://github.com/ethereum/aleth/releases/download/v${ALETH_VERSION}/aleth-${ALETH_VERSION}-linux-x86_64.tar.gz
|
||||||
test "$(shasum /tmp/test/aleth.tar.gz)" = "$ALETH_HASH /tmp/test/aleth.tar.gz"
|
test "$(shasum /tmp/test/aleth.tar.gz)" = "$ALETH_HASH /tmp/test/aleth.tar.gz"
|
||||||
tar -xf /tmp/test/aleth.tar.gz -C /tmp/test
|
tar -xf /tmp/test/aleth.tar.gz -C /tmp/test
|
||||||
|
@ -140,7 +140,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
|
|||||||
}
|
}
|
||||||
|
|
||||||
string txHash = m_rpc.eth_sendTransaction(d);
|
string txHash = m_rpc.eth_sendTransaction(d);
|
||||||
waitForTransaction(txHash);
|
m_rpc.rpcCall("eth_flush");
|
||||||
m_rpc.test_mineBlocks(1);
|
m_rpc.test_mineBlocks(1);
|
||||||
RPCSession::TransactionReceipt receipt(m_rpc.eth_getTransactionReceipt(txHash));
|
RPCSession::TransactionReceipt receipt(m_rpc.eth_getTransactionReceipt(txHash));
|
||||||
|
|
||||||
@ -178,27 +178,6 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
|
|||||||
m_transactionSuccessful = (m_gas != m_gasUsed);
|
m_transactionSuccessful = (m_gas != m_gasUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionFramework::waitForTransaction(std::string const& _txHash) const
|
|
||||||
{
|
|
||||||
for (int polls = 0; polls < 3000; polls++)
|
|
||||||
{
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
|
||||||
auto pendingBlock = m_rpc.eth_getBlockByNumber("pending", false);
|
|
||||||
|
|
||||||
if (!pendingBlock["transactions"].empty())
|
|
||||||
{
|
|
||||||
BOOST_REQUIRE_EQUAL(pendingBlock["transactions"][0].asString(), _txHash);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (polls == 200)
|
|
||||||
{
|
|
||||||
cerr << "Note: Already used 200 iterations while waiting for transaction confirmation. Issuing an eth_flush request." << endl;
|
|
||||||
m_rpc.rpcCall("eth_flush");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExecutionFramework::sendEther(Address const& _to, u256 const& _value)
|
void ExecutionFramework::sendEther(Address const& _to, u256 const& _value)
|
||||||
{
|
{
|
||||||
RPCSession::TransactionData d;
|
RPCSession::TransactionData d;
|
||||||
|
@ -247,7 +247,6 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
void sendMessage(bytes const& _data, bool _isCreation, u256 const& _value = 0);
|
void sendMessage(bytes const& _data, bool _isCreation, u256 const& _value = 0);
|
||||||
void sendEther(Address const& _to, u256 const& _value);
|
void sendEther(Address const& _to, u256 const& _value);
|
||||||
void waitForTransaction(std::string const& _txHash) const;
|
|
||||||
size_t currentTimestamp();
|
size_t currentTimestamp();
|
||||||
size_t blockTimestamp(u256 _number);
|
size_t blockTimestamp(u256 _number);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user