aboutsummaryrefslogtreecommitdiff
path: root/ca/tests
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-19 12:00:27 +0000
committerRob Austein <sra@hactrn.net>2015-10-19 12:00:27 +0000
commit3c3d720c291158ddcba476c43da5fc9de4e1c136 (patch)
treef2546b0b7f6b683eb32be4e2d2c81e020be14d4c /ca/tests
parent791c197d68210bb8e60322ccaca7de509831212d (diff)
Tweak test scripts.
svn path=/branches/tk705/; revision=6130
Diffstat (limited to 'ca/tests')
-rw-r--r--ca/tests/yamltest-test-all.sh24
-rw-r--r--ca/tests/yamltest.py10
2 files changed, 21 insertions, 13 deletions
diff --git a/ca/tests/yamltest-test-all.sh b/ca/tests/yamltest-test-all.sh
index 4bd5c560..0a77469c 100644
--- a/ca/tests/yamltest-test-all.sh
+++ b/ca/tests/yamltest-test-all.sh
@@ -24,24 +24,28 @@ test -z "$STY" && exec screen -L sh $0
screen -X split
screen -X focus
-: ${runtime=900}
+# Timers
+: ${startup=300} ${runtime=900} ${poll=30} ${shutdown=30}
+
+# Once upon a time we had a settitle program. Noop for now.
+: ${settitle=":"}
for yaml in smoketest.*.yaml
do
- settitle "$yaml: Starting"
+ $settitle "$yaml: Starting"
rm -rf test rcynic-data
python sql-cleaner.py
now=$(date +%s)
finish=$(($now + $runtime))
title="$yaml: will finish at $(date -r $finish)"
- settitle "$title"
- screen sh -c "settitle '$title'; exec python yamltest.py -p yamltest.pid $yaml"
+ $settitle "$title"
+ screen sh -c "$settitle '$title'; exec python yamltest.py -p yamltest.pid $yaml"
date
- sleep 180
+ sleep $startup
date
while test $(date +%s) -lt $finish
do
- sleep 30
+ sleep $poll
date
../../rp/rcynic/rcynic
../../rp/rcynic/rcynic-text rcynic.xml
@@ -49,10 +53,8 @@ do
date
echo "$title"
done
- if test -r yamltest.pid
- then
- kill -INT $(cat yamltest.pid)
- sleep 30
- fi
+ if test -r yamltest.pid; then kill -INT $(cat yamltest.pid); sleep ${shutdown}; fi
+ if test -r yamltest.pid; then kill -INT $(cat yamltest.pid); sleep ${shutdown}; fi
+ if test -r yamltest.pid; then kill -KILL $(cat yamltest.pid); sleep ${shutdown}; fi
make backup
done
diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py
index 71a83c14..04a2634a 100644
--- a/ca/tests/yamltest.py
+++ b/ca/tests/yamltest.py
@@ -762,7 +762,9 @@ args = parser.parse_args()
try:
if args.pidfile is not None:
- open(args.pidfile, "w").write("%s\n" % os.getpid())
+ with open(args.pidfile, "w") as f:
+ print "Writing pidfile", f.name
+ f.write("%s\n" % os.getpid())
rpki.log.init("yamltest", argparse.Namespace(log_level = logging.DEBUG,
log_handler = lambda: logging.StreamHandler(sys.stdout)))
@@ -993,8 +995,12 @@ try:
for p in progs:
print "Program pid %d %r returned %d" % (p.pid, p, p.wait())
+except Exception, e:
+ print "Blowing out on exception", str(e)
+ raise
+
finally:
- if args.pidfile is not None:
+ if args.pidfile is not None and os.path.exists(args.pidfile):
os.unlink(args.pidfile)
# Local Variables: