Merge pull request #6457 from ethereum/yet-more-info

Fix CI bug
This commit is contained in:
chriseth 2019-04-04 18:05:32 +02:00 committed by GitHub
commit a7ff3e42ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 3 deletions

View File

@ -6,7 +6,7 @@ shift
shift shift
$ALETH_PATH $@ &> >(tail -n 10000 &> "$ALETH_TMP_OUT") & $ALETH_PATH $@ &> >(tail -n 100000 &> "$ALETH_TMP_OUT") &
PID=$! PID=$!

View File

@ -152,7 +152,9 @@ function download_aleth()
# echos the PID # echos the PID
function run_aleth() function run_aleth()
{ {
$REPO_ROOT/scripts/aleth_with_log.sh $ALETH_PATH $ALETH_TMP_OUT --log-verbosity 3 --db memorydb --test -d "${WORKDIR}" &> /dev/null & # Use this to have aleth log output
#$REPO_ROOT/scripts/aleth_with_log.sh $ALETH_PATH $ALETH_TMP_OUT --log-verbosity 3 --db memorydb --test -d "${WORKDIR}" &> /dev/null &
$ALETH_PATH --db memorydb --test -d "${WORKDIR}" &> /dev/null &
echo $! echo $!
# Wait until the IPC endpoint is available. # Wait until the IPC endpoint is available.
while [ ! -S "${WORKDIR}/geth.ipc" ] ; do sleep 1; done while [ ! -S "${WORKDIR}/geth.ipc" ] ; do sleep 1; done

View File

@ -29,6 +29,9 @@
#include <cstdlib> #include <cstdlib>
#include <chrono>
#include <thread>
using namespace std; using namespace std;
using namespace dev; using namespace dev;
using namespace dev::test; using namespace dev::test;
@ -137,6 +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.test_mineBlocks(1); m_rpc.test_mineBlocks(1);
RPCSession::TransactionReceipt receipt(m_rpc.eth_getTransactionReceipt(txHash)); RPCSession::TransactionReceipt receipt(m_rpc.eth_getTransactionReceipt(txHash));
@ -174,6 +178,27 @@ 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;

View File

@ -247,6 +247,7 @@ 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);

View File

@ -351,7 +351,12 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const&
} }
if (!result.isMember("result") || result["result"].isNull()) if (!result.isMember("result") || result["result"].isNull())
BOOST_FAIL("Missing result for JSON-RPC call: " + result.toStyledString()); BOOST_FAIL(
"Missing result for JSON-RPC call: " +
result.toStyledString() +
"\nRequest was " +
request
);
return result["result"]; return result["result"];
} }