Commit 73c47678 authored by Petr Špaček's avatar Petr Špaček

Fail on non-zero exit code from tested subprocess

Normally the server process should exit with code 0. Non-zero might
indicate crash during shutdown or so.

This can be used for automated Valgrind testing:
$ make DAEMON=valgrind ADDITIONAL="--error-exitcode=1 kresd"
parent 0b25a1c0
......@@ -251,17 +251,20 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa
server.start_srv((rd.address, 53), socket.AF_INET6)
# Play test scenario
ex = None
try:
server.play(CHILD_IFACE)
if VERBOSE:
print(open('%s/server.log' % TMPDIR).read())
except:
print(open('%s/server.log' % TMPDIR).read())
except Exception as ex:
raise
finally:
server.stop()
daemon_proc.terminate()
daemon_proc.wait()
if VERBOSE or ex or daemon_proc.returncode:
print(open('%s/server.log' % TMPDIR).read())
if daemon_proc.returncode != 0:
raise ValueError('process terminated with return code %s'
% daemon_proc.returncode)
# Do not clear files if the server crashed (for analysis)
del_files(TMPDIR, OWN_TMPDIR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment