summaryrefslogtreecommitdiff
path: root/test/scripts
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-01-24 09:16:28 +0100
committerLinus Nordberg <linus@nordu.net>2017-02-01 11:24:28 +0100
commitb7b8903b6a7c3342933b9984afa72fb6527b5f72 (patch)
treefc92bfb8b1dccd1dca3f24cba98cf3ea540687bc /test/scripts
parentc0d8aceccb0961a25ee58a163441bbcbe6d6ea3d (diff)
Parallelised merge, distribution phase.
Diffstat (limited to 'test/scripts')
-rwxr-xr-xtest/scripts/light-system-test-prepare-merge-takeover.sh1
-rwxr-xr-xtest/scripts/light-system-test-prepare.sh1
-rwxr-xr-xtest/scripts/light-system-test-start.sh9
-rwxr-xr-xtest/scripts/light-system-test-stop.sh7
-rwxr-xr-xtest/scripts/light-system-test.sh3
-rw-r--r--test/scripts/testutils.sh27
6 files changed, 43 insertions, 5 deletions
diff --git a/test/scripts/light-system-test-prepare-merge-takeover.sh b/test/scripts/light-system-test-prepare-merge-takeover.sh
index c84a17e..085a6a2 100755
--- a/test/scripts/light-system-test-prepare-merge-takeover.sh
+++ b/test/scripts/light-system-test-prepare-merge-takeover.sh
@@ -9,6 +9,7 @@ top_srcdir=$(cd $(dirname $0)/../..; pwd)
mv mergedb mergedb-down
mv mergedb-secondary mergedb
+init_log
mkdir mergedb-secondary
touch mergedb-secondary/logorder
printf 0 > mergedb-secondary/verifiedsize
diff --git a/test/scripts/light-system-test-prepare.sh b/test/scripts/light-system-test-prepare.sh
index 84b06cd..536c0db 100755
--- a/test/scripts/light-system-test-prepare.sh
+++ b/test/scripts/light-system-test-prepare.sh
@@ -71,6 +71,7 @@ for machine in ${MACHINES}; do \
mkdir -p machine/machine-${machine}/db
touch machine/machine-${machine}/db/index && touch machine/machine-${machine}/db/newentries
done
+${top_srcdir}/tools/compileconfig.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg
${top_srcdir}/tools/compileconfig.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge-2.cfg
${top_srcdir}/tools/compileconfig.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-signing.cfg
test -x ${SOFTHSM} && ${SOFTHSM} --init-token --slot=0 --label=mylabel --so-pin=ffff --pin=ffff || true
diff --git a/test/scripts/light-system-test-start.sh b/test/scripts/light-system-test-start.sh
index 1623d7e..4520945 100755
--- a/test/scripts/light-system-test-start.sh
+++ b/test/scripts/light-system-test-start.sh
@@ -7,8 +7,15 @@ top_srcdir=$(cd $(dirname $0)/../..; pwd)
. ${top_srcdir}/test/scripts/testutils.sh
+start_node() {
+ node=$1
+ node_app=$2
+ ../bin/run_erl -daemon nodes/${node}/ nodes/${node}/log/ \
+ "exec ../bin/erl -boot ${node_app} -config ${node}"
+}
+
for node in ${ERLANGNODES}; do
- (../bin/run_erl -daemon nodes/${node}/ nodes/${node}/log/ "exec ../bin/erl -config ${node}")
+ start_node $(echo $node | tr ':' ' ')
done
for i in 1 2 3 4 5 6 7 8 9 10; do
echo "waiting for system to start"
diff --git a/test/scripts/light-system-test-stop.sh b/test/scripts/light-system-test-stop.sh
index 575ef38..0bf4374 100755
--- a/test/scripts/light-system-test-stop.sh
+++ b/test/scripts/light-system-test-stop.sh
@@ -7,6 +7,11 @@ top_srcdir=$(cd $(dirname $0)/../..; pwd)
. ${top_srcdir}/test/scripts/testutils.sh
-for node in ${ERLANGNODES}; do
+stop_node() {
+ node=$1
${top_srcdir}/tools/to_catlfish.py to_erl nodes/${node}/ "init:stop()"
+}
+
+for node in ${ERLANGNODES}; do
+ stop_node $(echo $node | tr ':' ' ')
done
diff --git a/test/scripts/light-system-test.sh b/test/scripts/light-system-test.sh
index eee1078..816bd67 100755
--- a/test/scripts/light-system-test.sh
+++ b/test/scripts/light-system-test.sh
@@ -5,7 +5,7 @@ set -o errexit
top_srcdir=$(cd $(dirname $0)/../..; pwd)
-. ${top_srcdir}/test/test.shvars
+. ${top_srcdir}/test/scripts/testutils.sh
SCRIPTS=${top_srcdir}/test/scripts
@@ -18,6 +18,7 @@ tests_stop() {
}
${SCRIPTS}/light-system-test-prepare.sh
+init_log
tests_start
${SCRIPTS}/light-system-test-run-1.sh || (echo "Tests failed"; sleep 5; tests_stop; false)
sleep 5
diff --git a/test/scripts/testutils.sh b/test/scripts/testutils.sh
index e779e07..ba4221c 100644
--- a/test/scripts/testutils.sh
+++ b/test/scripts/testutils.sh
@@ -9,14 +9,37 @@ assert_equal() {
test "$2" = "$3" || fail "$1 $2 != expected $3"
}
+wait_for_equal() {
+ n=$4
+ while [ $n -gt 0 ]; do
+ currentvalue="$(eval "$2")"
+ [ "${currentvalue}" = "$3" ] && return
+ echo "still ${currentvalue}, not $3"
+ n=$((n-1))
+ sleep 1
+ done
+ assert_equal "$1" "$(eval "$2")" "$3"
+}
+
get_treesize() {
- ${top_srcdir}/tools/loginfo.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg --treesize https://localhost:8080/
+ get_treesize_host ${BASEURL}
+}
+get_treesize_host() {
+ ${top_srcdir}/tools/loginfo.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg --treesize "$1"
}
check_sth() {
- ${top_srcdir}/tools/check-sth.py ${BASEURL} --publickey=keys/logkey.pem --cur-sth=stored-sth --cafile httpsca/demoCA/cacert.pem || fail "Check STH failed"
+ check_sth_host ${BASEURL}
+}
+check_sth_host() {
+ ${top_srcdir}/tools/check-sth.py "$1" --publickey=keys/logkey.pem --cur-sth=stored-sth --cafile httpsca/demoCA/cacert.pem || fail "Check STH failed"
}
do_merge() {
${top_srcdir}/tools/merge --config ${top_srcdir}/test/catlfish-test.cfg --timing --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg || fail "Merge failed"
+ sleep 5 # FIXME: Just wait for dist instead.
+}
+
+init_log() {
+ ${top_srcdir}/tools/initlog.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg || fail "Log init failed"
}