exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

test_regressions.sh (1678B)


      1 #!/bin/sh
      2 # This file is in the public domain.
      3 #
      4 # Driver for the src/exchangedb/ regression tests.  It provisions a scratch
      5 # database of its own, runs ./test_regressions against it and removes the
      6 # database again.  No pre-existing database is ever touched: the name is
      7 # derived from the PID and is deliberately *not* taken from the environment.
      8 set -eu
      9 
     10 # Where the build tree lives; meson passes this, the fallback is for
     11 # running the script by hand from its build directory.
     12 BUILD_ROOT="${TALER_BUILD_ROOT:-$(cd ../../.. && pwd)}"
     13 SQL_DIR="${TALER_SQL_DIR:-${BUILD_ROOT}/src/exchangedb/sql-schema}"
     14 
     15 # Skip (77) rather than fail if there is no usable PostgreSQL around.
     16 command -v createdb > /dev/null 2>&1 || exit 77
     17 command -v dropdb > /dev/null 2>&1 || exit 77
     18 psql -l < /dev/null > /dev/null 2>&1 || exit 77
     19 
     20 DBNAME="taler_exdb_reg_$$"
     21 CONF="test_regressions_$$.conf"
     22 
     23 # The freshly built libraries must outrank any installed copy, as
     24 # LD_LIBRARY_PATH beats the build tree's RUNPATH.
     25 for d in "${BUILD_ROOT}"/src/*/; do
     26     LD_LIBRARY_PATH="${d%/}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-}"
     27 done
     28 export LD_LIBRARY_PATH
     29 
     30 cleanup ()
     31 {
     32     dropdb --if-exists "$DBNAME" > /dev/null 2>&1 || true
     33     rm -f "$CONF"
     34 }
     35 trap cleanup EXIT
     36 
     37 cat > "$CONF" <<EOF
     38 [exchange]
     39 CURRENCY = EUR
     40 BASE_URL = http://localhost/
     41 [exchangedb-postgres]
     42 CONFIG = postgres:///${DBNAME}
     43 SQL_DIR = ${SQL_DIR}/
     44 [exchangedb]
     45 MAX_AML_PROGRAM_RUNTIME = 1 minute
     46 IDLE_RESERVE_EXPIRATION_TIME = 4 weeks
     47 LEGAL_RESERVE_EXPIRATION_TIME = 7 years
     48 AGGREGATOR_SHIFT = 1s
     49 DEFAULT_PURSE_LIMIT = 1
     50 EOF
     51 
     52 createdb "$DBNAME" > /dev/null 2>&1 || exit 77
     53 
     54 RET=0
     55 ./test_regressions -c "$CONF" "$@" || RET=$?
     56 exit $RET