diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-21 08:36:40 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-21 08:36:40 +0200 |
commit | ff2a923942bad8d193d32a985e46a1ed13d392b4 (patch) | |
tree | 5c96ce0925fd8f661c12dff6ed0acb8acaaacb16 | |
parent | 711c0dbd837a43c1e1b29df675bb063f35865b95 (diff) | |
download | anastasis-ff2a923942bad8d193d32a985e46a1ed13d392b4.tar.gz anastasis-ff2a923942bad8d193d32a985e46a1ed13d392b4.zip |
-fix trap logic
-rwxr-xr-x | src/cli/test_iban.sh | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh index a7695e5..d5bceda 100755 --- a/src/cli/test_iban.sh +++ b/src/cli/test_iban.sh | |||
@@ -2,6 +2,31 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | # Exit, with status code "skip" (no 'real' failure) | ||
6 | function exit_skip() { | ||
7 | echo " SKIP: $1" | ||
8 | exit 77 | ||
9 | } | ||
10 | |||
11 | # Exit, with error message (hard failure) | ||
12 | function exit_fail() { | ||
13 | echo " FAIL: $1" | ||
14 | exit 1 | ||
15 | } | ||
16 | |||
17 | # Cleanup to run whenever we exit | ||
18 | function cleanup() | ||
19 | { | ||
20 | for n in `jobs -p` | ||
21 | do | ||
22 | kill $n 2> /dev/null || true | ||
23 | done | ||
24 | wait | ||
25 | } | ||
26 | |||
27 | # Install cleanup handler (except for kill -9) | ||
28 | trap cleanup EXIT | ||
29 | |||
5 | # Script's guidelines: | 30 | # Script's guidelines: |
6 | 31 | ||
7 | #* uses 'CURRENCY=TESTKUDOS' and uses $CURRENCY for all | 32 | #* uses 'CURRENCY=TESTKUDOS' and uses $CURRENCY for all |
@@ -86,8 +111,6 @@ echo "Sandbox started." | |||
86 | #libeufin-sandbox serve &> sandbox.log & | 111 | #libeufin-sandbox serve &> sandbox.log & |
87 | #sandbox_pid=$! | 112 | #sandbox_pid=$! |
88 | # | 113 | # |
89 | # FIXME: not always both services get killed. | ||
90 | trap "echo Terminating services.; kill $nexus_pid; kill $sandbox_pid" EXIT | ||
91 | # | 114 | # |
92 | #curl -s --retry 5 --retry-connrefused $NEXUS_URL > /dev/null | 115 | #curl -s --retry 5 --retry-connrefused $NEXUS_URL > /dev/null |
93 | #curl -s --retry 5 --retry-connrefused $SANDBOX_URL > /dev/null | 116 | #curl -s --retry 5 --retry-connrefused $SANDBOX_URL > /dev/null |