fix test logic: initialize $WALLET_DB and fix cleanup logic of generate-auditor-basedb.sh

This commit is contained in:
Christian Grothoff 2020-08-28 18:01:50 +02:00
parent 52b5428e3e
commit d089c31e5e
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 26 additions and 14 deletions

@ -1 +1 @@
Subproject commit 18a39c29726860af58800a28454446154b89832b Subproject commit 0b778cdac372d0b75f3b64501a15a21c9c57f36e

View File

@ -15,8 +15,19 @@
# #
set -eu set -eu
# Cleanup to run whenever we exit
function cleanup()
{
for n in `jobs -p`
do
kill $n 2> /dev/null || true
done
wait
}
# Install cleanup handler (except for kill -9)
trap cleanup EXIT
trap "kill `jobs -p` &> /dev/null || true" ERR
# Exit, with status code "skip" (no 'real' failure) # Exit, with status code "skip" (no 'real' failure)
function exit_skip() { function exit_skip() {
@ -32,6 +43,8 @@ BASEDB=${1:-"auditor-basedb"}
# elsewhere # elsewhere
TARGET_DB=taler-auditor-basedb TARGET_DB=taler-auditor-basedb
WALLET_DB=${BASEDB:-"wallet"}.wdb
# Configuration file will be edited, so we create one # Configuration file will be edited, so we create one
# from the template. # from the template.
CONF=generate-auditor-basedb-prod.conf CONF=generate-auditor-basedb-prod.conf
@ -122,8 +135,6 @@ done
if [ 1 != $OK ] if [ 1 != $OK ]
then then
kill `jobs -p`
wait
exit_skip "Failed to launch services" exit_skip "Failed to launch services"
fi fi
echo " DONE" echo " DONE"
@ -148,8 +159,7 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 'runIntegrationTest' \
echo "Shutting down services" echo "Shutting down services"
kill `jobs -p` cleanup
wait
# Dump database # Dump database
echo "Dumping database" echo "Dumping database"

View File

@ -42,7 +42,10 @@ function exit_fail() {
# Cleanup to run whenever we exit # Cleanup to run whenever we exit
function cleanup() function cleanup()
{ {
kill `jobs -p` >/dev/null 2>/dev/null || true for n in `jobs -p`
do
kill $n 2> /dev/null || true
done
wait wait
} }
@ -118,9 +121,7 @@ function audit_only () {
function post_audit () { function post_audit () {
taler-exchange-dbinit -g || exit_fail "exchange DB GC failed" taler-exchange-dbinit -g || exit_fail "exchange DB GC failed"
kill -TERM `jobs -p` >/dev/null 2>/dev/null || true cleanup
echo -n "Waiting for servers to die ..."
wait
echo "DONE" echo "DONE"
echo -n "TeXing ." echo -n "TeXing ."
taler-helper-auditor-render.py test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json test-audit-wire.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" taler-helper-auditor-render.py test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json test-audit-wire.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"

View File

@ -42,7 +42,10 @@ function exit_fail() {
# Cleanup to run whenever we exit # Cleanup to run whenever we exit
function cleanup() function cleanup()
{ {
kill `jobs -p` >/dev/null 2>/dev/null || true for n in `jobs -p`
do
kill $n 2> /dev/null || true
done
wait wait
} }
@ -117,9 +120,7 @@ function audit_only () {
# Cleanup to run after the auditor # Cleanup to run after the auditor
function post_audit () { function post_audit () {
kill -TERM `jobs -p` >/dev/null 2>/dev/null || true cleanup
echo -n "Waiting for servers to die ..."
wait
echo "DONE" echo "DONE"
echo -n "TeXing ." echo -n "TeXing ."
taler-helper-auditor-render.py test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json test-audit-wire.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" taler-helper-auditor-render.py test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json test-audit-wire.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"