Merge pull request #1077 from tonymorony/FSM
Separated cryptoconditions tests execution by cc-test.sh
This commit is contained in:
83
qa/pull-tester/cc-tests.sh
Executable file
83
qa/pull-tester/cc-tests.sh
Executable file
@@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
CURDIR=$(cd $(dirname "$0"); pwd)
|
||||||
|
# Get BUILDDIR and REAL_BITCOIND
|
||||||
|
. "${CURDIR}/tests-config.sh"
|
||||||
|
|
||||||
|
export BITCOINCLI=${BUILDDIR}/qa/pull-tester/run-bitcoin-cli
|
||||||
|
export BITCOIND=${REAL_BITCOIND}
|
||||||
|
|
||||||
|
#Run the tests
|
||||||
|
# FAUCET test should be permanently first!!!
|
||||||
|
|
||||||
|
testScripts=(
|
||||||
|
'cryptoconditions_faucet.py'
|
||||||
|
'cryptoconditions_channels.py'
|
||||||
|
'cryptoconditions_dice.py'
|
||||||
|
'cryptoconditions_oracles.py'
|
||||||
|
'cryptoconditions_rewards.py'
|
||||||
|
'cryptoconditions_token.py'
|
||||||
|
'cryptoconditions_gateways.py'
|
||||||
|
);
|
||||||
|
|
||||||
|
extArg="-extended"
|
||||||
|
passOn=${@#$extArg}
|
||||||
|
|
||||||
|
successCount=0
|
||||||
|
declare -a failures
|
||||||
|
|
||||||
|
function runTestScript
|
||||||
|
{
|
||||||
|
local testName="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
echo -e "=== Running testscript ${testName} ==="
|
||||||
|
|
||||||
|
if eval "$@"
|
||||||
|
then
|
||||||
|
successCount=$(expr $successCount + 1)
|
||||||
|
echo "--- Success: ${testName} ---"
|
||||||
|
else
|
||||||
|
failures[${#failures[@]}]="$testName"
|
||||||
|
echo "!!! FAIL: ${testName} !!!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
|
||||||
|
for (( i = 0; i < ${#testScripts[@]}; i++ ))
|
||||||
|
do
|
||||||
|
if [ -z "$1" ] || [ "${1:0:1}" == "-" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
|
||||||
|
then
|
||||||
|
runTestScript \
|
||||||
|
"${testScripts[$i]}" \
|
||||||
|
"${BUILDDIR}/qa/rpc-tests/${testScripts[$i]}" \
|
||||||
|
--srcdir "${BUILDDIR}/src" ${passOn}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for (( i = 0; i < ${#testScriptsExt[@]}; i++ ))
|
||||||
|
do
|
||||||
|
if [ "$1" == $extArg ] || [ "$1" == "${testScriptsExt[$i]}" ] || [ "$1.py" == "${testScriptsExt[$i]}" ]
|
||||||
|
then
|
||||||
|
runTestScript \
|
||||||
|
"${testScriptsExt[$i]}" \
|
||||||
|
"${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]}" \
|
||||||
|
--srcdir "${BUILDDIR}/src" ${passOn}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\n\nTests completed: $(expr $successCount + ${#failures[@]})"
|
||||||
|
echo "successes $successCount; failures: ${#failures[@]}"
|
||||||
|
|
||||||
|
if [ ${#failures[@]} -gt 0 ]
|
||||||
|
then
|
||||||
|
echo -e "\nFailing tests: ${failures[*]}"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
|
||||||
|
fi
|
||||||
@@ -13,14 +13,6 @@ export BITCOIND=${REAL_BITCOIND}
|
|||||||
testScripts=(
|
testScripts=(
|
||||||
'ac_private.py'
|
'ac_private.py'
|
||||||
'verushash.py'
|
'verushash.py'
|
||||||
'cryptoconditions.py'
|
|
||||||
'cryptoconditions_channels.py'
|
|
||||||
'cryptoconditions_dice.py'
|
|
||||||
'cryptoconditions_faucet.py'
|
|
||||||
'cryptoconditions_gateways.py'
|
|
||||||
'cryptoconditions_oracles.py'
|
|
||||||
'cryptoconditions_rewards.py'
|
|
||||||
'cryptoconditions_token.py'
|
|
||||||
'paymentdisclosure.py'
|
'paymentdisclosure.py'
|
||||||
'prioritisetransaction.py'
|
'prioritisetransaction.py'
|
||||||
'wallet_treestate.py'
|
'wallet_treestate.py'
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ You can run a single test by calling `qa/pull-tester/rpc-tests.sh <testname>`.
|
|||||||
|
|
||||||
Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
|
Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
|
||||||
|
|
||||||
|
Also it's possible to run CryptoConditions tests only by `qa/pull-tester/cc-tests.sh --noshutdown --tracerpc`
|
||||||
|
|
||||||
Possible options:
|
Possible options:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ class CryptoconditionsChannelsTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ class CryptoconditionsDiceTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
import subprocess
|
||||||
|
|
||||||
class CryptoconditionsGatewaysTest(BitcoinTestFramework):
|
class CryptoconditionsGatewaysTest(BitcoinTestFramework):
|
||||||
|
|
||||||
@@ -137,12 +137,14 @@ class CryptoconditionsGatewaysTest(BitcoinTestFramework):
|
|||||||
result = rpc.gatewayslist()
|
result = rpc.gatewayslist()
|
||||||
assert_equal(result[0], bind_txid)
|
assert_equal(result[0], bind_txid)
|
||||||
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
print("Mining blocks...")
|
print("Mining blocks...")
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -269,8 +269,6 @@ class CryptoconditionsOraclesTest(BitcoinTestFramework):
|
|||||||
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], oraclesdata_Ihh, "1")
|
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], oraclesdata_Ihh, "1")
|
||||||
assert_equal("[u'0']", str(result["samples"][0]), "Data match")
|
assert_equal("[u'0']", str(result["samples"][0]), "Data match")
|
||||||
assert_equal("[u'00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff']", str(result["samples"][1]), "Data match")
|
|
||||||
assert_equal("[u'00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff']", str(result["samples"][2]), "Data match")
|
|
||||||
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
@@ -278,7 +276,8 @@ class CryptoconditionsOraclesTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -194,7 +194,8 @@ class CryptoconditionsRewardsTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -274,7 +274,8 @@ class CryptoconditionsTokenTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user