diff options
author | Magnus Ahltorp <map@kth.se> | 2016-10-05 10:06:16 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2016-10-05 10:08:43 +0200 |
commit | 1d902cd5813a2df252b6976bdcdc9cd7531590b4 (patch) | |
tree | cef355f80032c5e15893a5d96c52728d9b71b7d8 /test/scripts/light-system-test.sh | |
parent | 49b40a0170b80b204746ab3bc42a73c5c60bcf0c (diff) |
Move tests to shell scripts
Diffstat (limited to 'test/scripts/light-system-test.sh')
-rwxr-xr-x | test/scripts/light-system-test.sh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/test/scripts/light-system-test.sh b/test/scripts/light-system-test.sh new file mode 100755 index 0000000..7dd9fcf --- /dev/null +++ b/test/scripts/light-system-test.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +set -o nounset +set -o errexit + +SOFTHSM=/usr/local/bin/softhsm2-util +INSTDIR=../catlfish +PREFIX=.. + +. test.shvars + +tests_prepare() { + rm -r ${INSTDIR}/tests || true + mkdir ${INSTDIR}/tests + make tests-createca + make tests-createcert + mkdir ${INSTDIR}/tests/keys + (cd ${INSTDIR}/tests/keys ; ../../../tools/create-key.sh logkey) + openssl pkcs8 -topk8 -nocrypt -in ${INSTDIR}/tests/keys/logkey-private.pem -out ${INSTDIR}/tests/keys/logkey-private.pkcs8 + mkdir ${INSTDIR}/tests/mergedb + touch ${INSTDIR}/tests/mergedb/logorder + mkdir ${INSTDIR}/tests/mergedb-secondary + touch ${INSTDIR}/tests/mergedb-secondary/logorder + printf 0 > ${INSTDIR}/tests/mergedb-secondary/verifiedsize + mkdir ${INSTDIR}/tests/known_roots + cp ../tools/testcerts/roots/* ${INSTDIR}/tests/known_roots + for machine in ${MACHINES}; do \ + (cd ${INSTDIR}/tests; ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-${machine}.cfg) && \ + mkdir -p ${INSTDIR}/tests/machine/machine-${machine}/db && \ + touch ${INSTDIR}/tests/machine/machine-${machine}/db/index && touch ${INSTDIR}/tests/machine/machine-${machine}/db/newentries + done + (cd ${INSTDIR}/tests; ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-merge-2.cfg) + (cd ${INSTDIR}/tests; ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-signing.cfg) + mkdir ${INSTDIR}/tests/privatekeys + mkdir ${INSTDIR}/tests/publickeys + for node in ${NODES}; do \ + (cd ${INSTDIR}/tests/privatekeys ; ../../../tools/create-key.sh ${node}) ; \ + mv ${INSTDIR}/tests/privatekeys/${node}.pem ${INSTDIR}/tests/publickeys/ ; \ + mkdir -p ${INSTDIR}/tests/nodes/${node}/log + done + (cd ${INSTDIR}/tests/privatekeys ; ../../../tools/create-key.sh merge-1) + mv ${INSTDIR}/tests/privatekeys/merge-1.pem ${INSTDIR}/tests/publickeys/ + (cd ${INSTDIR}/tests/privatekeys ; ../../../tools/create-key.sh merge-2) + mv ${INSTDIR}/tests/privatekeys/merge-2.pem ${INSTDIR}/tests/publickeys/ + test -x ${SOFTHSM} && ${SOFTHSM} --init-token --slot=0 --label=mylabel --so-pin=ffff --pin=ffff || true + test -x ${SOFTHSM} && ${SOFTHSM} --import ${INSTDIR}/tests/keys/logkey-private.pkcs8 --slot 0 --label mylabel --pin ffff --id 00 || true +} + +tests_stop() { + ${PREFIX}/test/scripts/light-system-test-stop.sh +} + + +tests_prepare +${PREFIX}/test/scripts/light-system-test-start.sh +${PREFIX}/test/scripts/light-system-test-run-1.sh || (echo "Tests failed"; sleep 5; tests_stop; false) +sleep 5 +tests_stop +sleep 5 +${PREFIX}/test/scripts/light-system-test-start.sh +${PREFIX}/test/scripts/light-system-test-run-2.sh || (echo "Tests failed"; sleep 5; tests_stop; false) +sleep 5 +tests_stop +sleep 5 +${PREFIX}/test/scripts/light-system-test-prepare-merge-takeover.sh +${PREFIX}/test/scripts/light-system-test-start.sh +${PREFIX}/test/scripts/light-system-test-run-3.sh || (echo "Tests failed"; sleep 5; tests_stop; false) +sleep 5 +tests_stop +sleep 5 +${PREFIX}/test/scripts/light-system-test-prepare-redistribute-frontend.sh +${PREFIX}/test/scripts/light-system-test-start.sh +${PREFIX}/test/scripts/light-system-test-run-4.sh || (echo "Tests failed"; sleep 5; tests_stop; false) +sleep 5 +tests_stop |