diff options
author | Magnus Ahltorp <map@kth.se> | 2015-02-27 15:49:48 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-02-27 15:49:48 +0100 |
commit | f87aba6cf765c3ba3f6b4cc097c63b567966de85 (patch) | |
tree | efbfd77f8c194c69fc71c076e89ff01e87d7d857 | |
parent | 053f218cc0076f58f53fd23515b3082328c6ce22 (diff) |
Improve tests-start and tests-stop
-rw-r--r-- | Makefile | 25 | ||||
-rwxr-xr-x | tools/halt.py | 19 |
2 files changed, 38 insertions, 6 deletions
@@ -45,20 +45,33 @@ tests-prepare: touch rel/tests/machine/machine-1/db/newentries tests-start: - (cd rel ; bin/run_erl -daemon ../test/nodes/frontend-1/ ../test/nodes/frontend-1/log/ "exec bin/erl -config frontend-1") - (cd rel ; bin/run_erl -daemon ../test/nodes/storage-1/ ../test/nodes/storage-1/log/ "exec bin/erl -config storage-1") - sleep 1 + @for node in frontend-1 storage-1; do \ + (cd rel ; bin/run_erl -daemon ../test/nodes/$$node/ ../test/nodes/$$node/log/ "exec bin/erl -config $$node") \ + done + @for i in 1 2 3 4 5 6 7 8 9 10; do \ + echo "waiting for system to start" ; \ + sleep 0.5 ; \ + allstarted=1 ; \ + for testurl in https://127.0.0.1:8080/ https://127.0.0.1:8081/ https://127.0.0.1:8082/; do \ + if curl -s -k $$testurl > /dev/null ; then : ; else allstarted=0 ; fi ; \ + : ; \ + done ; \ + if [ $$allstarted == 1 ]; then break ; fi ; \ + done tests-run: @(cd tools ; python testcase1.py ) || echo "Tests failed" @(cd tools ; python fetchallcerts.py https://127.0.0.1:8080/) || echo "Verification failed" tests-stop: + @for node in frontend-1 storage-1; do \ + ./tools/halt.py ./rel/bin/to_erl test/nodes/$$node/ ; \ + done + +tests-wait: sleep 5 - echo "halt()." | ./rel/bin/to_erl test/nodes/frontend-1/ - echo "halt()." | ./rel/bin/to_erl test/nodes/storage-1/ -tests: tests-prepare tests-start tests-run tests-stop +tests: tests-prepare tests-start tests-run tests-wait tests-stop # Unit testing. check: all diff --git a/tools/halt.py b/tools/halt.py new file mode 100755 index 0000000..cfbf14e --- /dev/null +++ b/tools/halt.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2014, NORDUnet A/S. +# See LICENSE for licensing information. + +import argparse +import subprocess +import sys + +parser = argparse.ArgumentParser(description='') +parser.add_argument('toerl') +parser.add_argument('nodedir') +args = parser.parse_args() + +p = subprocess.Popen( + [args.toerl, args.nodedir], + stdin=subprocess.PIPE) +p.communicate("halt().\n") |