aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ning Huang <w@byzantine-lab.io>2019-06-15 21:42:20 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-09-17 16:57:30 +0800
commit2683ddd4341799e166e9e46f7c7aee90b57443ff (patch)
treef6b66478e9019404385e66e08085aca662ebc106
parentac088de6322fc16ebe75c2e5554be73754bf1fe2 (diff)
downloadgo-tangerine-2683ddd4341799e166e9e46f7c7aee90b57443ff.tar.gz
go-tangerine-2683ddd4341799e166e9e46f7c7aee90b57443ff.tar.zst
go-tangerine-2683ddd4341799e166e9e46f7c7aee90b57443ff.zip
build: fix test scripts
-rwxr-xr-xbuild/fullnode-test.sh37
-rwxr-xr-xbuild/recovery-test.sh20
-rwxr-xr-xbuild/setup_recovery_env.sh8
-rwxr-xr-xtest/run_test.sh20
-rwxr-xr-xtest/sync_core.sh2
-rwxr-xr-xtest/sync_test.sh2
6 files changed, 38 insertions, 51 deletions
diff --git a/build/fullnode-test.sh b/build/fullnode-test.sh
index 4ddae8993..9c2396593 100755
--- a/build/fullnode-test.sh
+++ b/build/fullnode-test.sh
@@ -1,13 +1,14 @@
-#!/bin/bash
+#!/bin/sh
sleep 10
-tarAndUpload()
+fail()
{
- name=travis-fail-$(date +%s).tar.gz
- tar -zcvf $name test
- echo "Verify fail and upload $name"
- PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig go run build/testtool/testtool.go upload $name dexon-prod-builds
+ # name=ci-fail-$(date +%s).tar.gz
+ # tar -zcvf $name test
+ # echo "Verify fail and upload $name"
+ # go run build/testtool/testtool.go upload $name dexon-prod-builds
+ echo
}
endpoint=http://127.0.0.1:8545
@@ -19,33 +20,21 @@ echo "Start verify round $round"
for index in 0 1 2 3
do
echo "Verify gov master public key round $round index $index"
- cmd="PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig go run build/testtool/testtool.go verifyGovMPK $endpoint $round $index"
- eval $cmd
- code=$?
-
- if [ $code == 1 ]; then
- tarAndUpload
+ if ! go run build/testtool/testtool.go verifyGovMPK $endpoint $round $index; then
+ fail
exit 1
fi
done
echo "Start verify CRS"
-cmd="PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig go run build/testtool/testtool.go verifyGovCRS $endpoint $round"
-eval $cmd
-code=$?
-
-if [ $code == 1 ]; then
- tarAndUpload
+if ! go run build/testtool/testtool.go verifyGovCRS $endpoint $round; then
+ fail
exit 1
fi
if [ $round -lt 4 ]; then
- cmd="PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig go run build/testtool/testtool.go monkeyTest $endpoint"
- eval $cmd
- code=$?
-
- if [ $code == 1 ]; then
- tarAndUpload
+ if ! go run build/testtool/testtool.go monkeyTest $endpoint; then
+ fail
exit 1
fi
diff --git a/build/recovery-test.sh b/build/recovery-test.sh
index 97311aaa0..46182b88a 100755
--- a/build/recovery-test.sh
+++ b/build/recovery-test.sh
@@ -1,11 +1,12 @@
-#!/bin/bash
+#!/bin/sh
-tarAndUpload()
+fail()
{
- name=travis-fail-$(date +%s).tar.gz
- tar -zcvf $name test
- echo "Verify fail and upload $name"
- PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig go run build/testtool/testtool.go upload $name dexon-prod-builds
+ # name=ci-fail-$(date +%s).tar.gz
+ # tar -zcvf $name test
+ # echo "Verify fail and upload $name"
+ # go run build/testtool/testtool.go upload $name dexon-prod-builds
+ echo
}
endpoint=http://127.0.0.1:8545
@@ -13,10 +14,7 @@ endpoint=http://127.0.0.1:8545
timeout=300
echo "Wait for recovery"
-cmd="PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig go run build/testtool/testtool.go waitForRecovery $endpoint $timeout"
-eval $cmd
-code=$?
-if [ $code == 1 ]; then
- tarAndUpload
+if ! go run build/testtool/testtool.go waitForRecovery $endpoint $timeout; then
+ fail
exit 1
fi
diff --git a/build/setup_recovery_env.sh b/build/setup_recovery_env.sh
index 5586273c8..1988dddea 100755
--- a/build/setup_recovery_env.sh
+++ b/build/setup_recovery_env.sh
@@ -1,13 +1,15 @@
-#!/bin/bash
+#!/bin/sh
+
+cd "$(dirname "$0")"
accounts_opt="--account=0x`cat ../test/keystore/monkey.key`,100000000000000000000"
# node key's account
for key in ../test/keystore/test*key; do
- accounts_opt+=" --account=0x`cat $key`,1000000000000000000000"
+ accounts_opt=" --account=0x`cat $key`,1000000000000000000000 $accounts_opt"
done
-git clone --depth 1 -b master https://github.com/dexon-foundation/governance-abi
+git clone --depth 1 -b master https://github.com/lantw44m/dexon-governance-abi.git governance-abi
# deploy contract
cd governance-abi
diff --git a/test/run_test.sh b/test/run_test.sh
index 20c3357e0..181f8b755 100755
--- a/test/run_test.sh
+++ b/test/run_test.sh
@@ -1,4 +1,6 @@
-#!/bin/bash
+#!/bin/sh
+
+cd "$(dirname "$0")"
BOOTNODE_FLAGS="--bootnodes enode://b0dacdaceb9ce26f89406e8048d279d3aa81c770e967db7e2556e416ca446de0e9327dbdf85eb56c421eeabbc843ceb8f373e7a26dc31d48178620e48cb095c4@127.0.0.1:30301"
GENESIS="genesis.json"
@@ -45,16 +47,6 @@ rm -f log-latest
ln -s $logsdir log-latest
-# the recovery contract address 0x80859F3d0D781c2c4126962cab0c977b37820e78 is deployed using keystore/monkey.key
-if $SMOKETEST; then
- if [ `uname` == "Darwin" ]; then
- sed -i '' 's/"contract":.*,/"contract": "0x80859F3d0D781c2c4126962cab0c977b37820e78",/g' genesis.json
- else
- sed -i 's/"contract":.*,/"contract": "0x80859F3d0D781c2c4126962cab0c977b37820e78",/g' genesis.json
- fi
-fi
-
-
python << __FILE__
import re
import time
@@ -64,6 +56,12 @@ with open('$GENESIS', 'r') as f:
with open('$GENESIS', 'w') as f:
dMoment = int(time.time()) + 15
+ data = re.sub('"dMoment": [0-9]+,', '"dMoment": %d,' % dMoment, data)
+
+ if '$SMOKETEST' == 'true':
+ # Recovery contract address deployed using keystore/monkey.key
+ data = re.sub('"contract":.*,', '"contract": "0x2Fc9806dDad6044C8158bA31D08b7d9495474A89",', data)
+
f.write(re.sub('"dMoment": [0-9]+,', '"dMoment": %d,' % dMoment, data))
__FILE__
diff --git a/test/sync_core.sh b/test/sync_core.sh
index 544ca854a..1fd9a043f 100755
--- a/test/sync_core.sh
+++ b/test/sync_core.sh
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/bin/sh
govendor fetch github.com/byzantine-lab/dexon-consensus/...@master
diff --git a/test/sync_test.sh b/test/sync_test.sh
index c12b0e3ae..0b98b70e0 100755
--- a/test/sync_test.sh
+++ b/test/sync_test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
GDEX=../build/bin/gtan