aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/util.sh
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-13 08:50:16 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-13 08:50:16 +0200
commitffad5aa1f46742b9e845ade8107505e42a18d7ac (patch)
treee75c0e8e7840ba15e1178d3847d0af0d3bbab89c /qa/rpc-tests/util.sh
parent44fa82d47e5c8e1c511dfdff212f1196425a54f8 (diff)
tests: Remove old sh-based test framework
This removes the `conflictedbalance.sh` test as well, but that test has been broken for a long time and isn't part of any scripts. What it does is, IMO, sufficiently tested by other tests.
Diffstat (limited to 'qa/rpc-tests/util.sh')
-rw-r--r--qa/rpc-tests/util.sh103
1 files changed, 0 insertions, 103 deletions
diff --git a/qa/rpc-tests/util.sh b/qa/rpc-tests/util.sh
deleted file mode 100644
index c2b7004308..0000000000
--- a/qa/rpc-tests/util.sh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2014 The Bitcoin Core developers
-# Distributed under the MIT software license, see the accompanying
-# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-# Functions used by more than one test
-
-function echoerr {
- echo "$@" 1>&2;
-}
-
-# Usage: ExtractKey <key> "<json_object_string>"
-# Warning: this will only work for the very-well-behaved
-# JSON produced by bitcoind, do NOT use it to try to
-# parse arbitrary/nested/etc JSON.
-function ExtractKey {
- echo $2 | tr -d ' "{}\n' | awk -v RS=',' -F: "\$1 ~ /$1/ { print \$2}"
-}
-
-function CreateDataDir {
- DIR=$1
- mkdir -p $DIR
- CONF=$DIR/bitcoin.conf
- echo "regtest=1" >> $CONF
- echo "keypool=2" >> $CONF
- echo "rpcuser=rt" >> $CONF
- echo "rpcpassword=rt" >> $CONF
- echo "rpcwait=1" >> $CONF
- echo "walletnotify=${SENDANDWAIT} -STOP" >> $CONF
- shift
- while (( "$#" )); do
- echo $1 >> $CONF
- shift
- done
-}
-
-function AssertEqual {
- if (( $( echo "$1 == $2" | bc ) == 0 ))
- then
- echoerr "AssertEqual: $1 != $2"
- declare -f CleanUp > /dev/null 2>&1
- if [[ $? -eq 0 ]] ; then
- CleanUp
- fi
- exit 1
- fi
-}
-
-# CheckBalance -datadir=... amount account minconf
-function CheckBalance {
- declare -i EXPECT="$2"
- B=$( $CLI $1 getbalance $3 $4 )
- if (( $( echo "$B == $EXPECT" | bc ) == 0 ))
- then
- echoerr "bad balance: $B (expected $2)"
- declare -f CleanUp > /dev/null 2>&1
- if [[ $? -eq 0 ]] ; then
- CleanUp
- fi
- exit 1
- fi
-}
-
-# Use: Address <datadir> [account]
-function Address {
- $CLI $1 getnewaddress $2
-}
-
-# Send from to amount
-function Send {
- from=$1
- to=$2
- amount=$3
- address=$(Address $to)
- txid=$( ${SENDANDWAIT} $CLI $from sendtoaddress $address $amount )
-}
-
-# Use: Unspent <datadir> <n'th-last-unspent> <var>
-function Unspent {
- local r=$( $CLI $1 listunspent | awk -F'[ |:,"]+' "\$2 ~ /$3/ { print \$3 }" | tail -n $2 | head -n 1)
- echo $r
-}
-
-# Use: CreateTxn1 <datadir> <n'th-last-unspent> <destaddress>
-# produces hex from signrawtransaction
-function CreateTxn1 {
- TXID=$(Unspent $1 $2 txid)
- AMOUNT=$(Unspent $1 $2 amount)
- VOUT=$(Unspent $1 $2 vout)
- RAWTXN=$( $CLI $1 createrawtransaction "[{\"txid\":\"$TXID\",\"vout\":$VOUT}]" "{\"$3\":$AMOUNT}")
- ExtractKey hex "$( $CLI $1 signrawtransaction $RAWTXN )"
-}
-
-# Use: SendRawTxn <datadir> <hex_txn_data>
-function SendRawTxn {
- ${SENDANDWAIT} $CLI $1 sendrawtransaction $2
-}
-
-# Use: GetBlocks <datadir>
-# returns number of blocks from getinfo
-function GetBlocks {
- $CLI $1 getblockcount
-}