2020-09-18 16:50:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export GOPATH=~/go
|
|
|
|
export PATH=$PATH:$GOPATH/bin
|
2020-09-24 17:50:47 +00:00
|
|
|
go build -o ./build/ethermintd ./cmd/ethermintd
|
2020-09-18 16:50:08 +00:00
|
|
|
mkdir $GOPATH/bin
|
|
|
|
cp ./build/ethermintd $GOPATH/bin
|
2021-04-17 10:00:07 +00:00
|
|
|
|
|
|
|
localKeyAddr=0x7cb61d4117ae31a12e393a1cfa3bac666481d02e
|
|
|
|
user1Addr=0xc6fe5d33615a1c52c08018c47e8bc53646a0e101
|
|
|
|
user2Addr=0x963ebdf2e1f8db8707d05fc75bfeffba1b5bac17
|
2020-09-18 16:50:08 +00:00
|
|
|
|
2021-08-17 14:11:26 +00:00
|
|
|
CHAINID="ethermint_9000-1"
|
2020-09-24 17:50:47 +00:00
|
|
|
|
2021-04-17 10:00:07 +00:00
|
|
|
# build ethermint binary
|
|
|
|
make install
|
|
|
|
|
2021-05-11 11:54:55 +00:00
|
|
|
cd tests/solidity
|
2020-09-18 16:50:08 +00:00
|
|
|
|
|
|
|
if command -v yarn &> /dev/null; then
|
2020-09-24 17:50:47 +00:00
|
|
|
yarn install
|
|
|
|
else
|
|
|
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
sudo apt update && sudo apt install yarn
|
|
|
|
yarn install
|
2020-09-18 16:50:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
chmod +x ./init-test-node.sh
|
2021-04-17 10:00:07 +00:00
|
|
|
nohup ./init-test-node.sh > ethermintd.log 2>&1 &
|
|
|
|
|
|
|
|
# give ethermintd node enough time to launch
|
|
|
|
echo "sleeping ..."
|
|
|
|
sleep 10
|
2020-09-18 16:50:08 +00:00
|
|
|
|
2021-04-17 10:00:07 +00:00
|
|
|
# show existing accounts
|
|
|
|
echo "account list: "
|
|
|
|
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_listAccounts","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545
|
|
|
|
|
|
|
|
# unlock localKey address
|
|
|
|
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["'$localKeyAddr'", ""],"id":1}' -H "Content-Type: application/json" http://localhost:8545
|
|
|
|
|
|
|
|
# tests start
|
2020-09-18 16:50:08 +00:00
|
|
|
cd suites/initializable
|
2021-04-17 10:00:07 +00:00
|
|
|
yarn contract-migrate
|
2020-09-18 16:50:08 +00:00
|
|
|
yarn test-ethermint
|
|
|
|
|
|
|
|
ok=$?
|
|
|
|
|
|
|
|
if (( $? != 0 )); then
|
2020-09-24 17:50:47 +00:00
|
|
|
echo "initializable test failed: exit code $?"
|
2020-09-18 16:50:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
killall ethermintd
|
|
|
|
|
|
|
|
echo "Script exited with code $ok"
|
|
|
|
exit $ok
|
|
|
|
|
|
|
|
# initializable-buidler fails on CI, re-add later
|
|
|
|
|
2021-04-17 10:00:07 +00:00
|
|
|
./../../init-test-node.sh > ethermintd.log
|
2020-09-18 16:50:08 +00:00
|
|
|
cd ../initializable-buidler
|
|
|
|
yarn test-ethermint
|
|
|
|
|
|
|
|
ok=$(($? + $ok))
|
|
|
|
|
|
|
|
if (( $? != 0 )); then
|
2020-09-24 17:50:47 +00:00
|
|
|
echo "initializable-buidler test failed: exit code $?"
|
2020-09-18 16:50:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
killall ethermintd
|
|
|
|
|
|
|
|
echo "Script exited with code $ok"
|
|
|
|
exit $ok
|