Commit 0f81cfaa authored by Marek Vavruša's avatar Marek Vavruša

build: fix gcov integration tests

fixes killing the server with SIGKILL causing abortiong,
added SIGTERM handler and ignored retcode from uv_run()
parent f3a0b91d
......@@ -24,7 +24,7 @@ env:
global:
- PKG_CONFIG_PATH="${HOME}/.local/lib/pkgconfig"
- PATH="${HOME}/.local/bin:/usr/local/bin:${PATH}"
- CFLAGS="${CFLAGS} -O0 -g -fPIC -DNDEBUG"
- CFLAGS="${CFLAGS} -O0 -g -fPIC"
- LD_LIBRARY_PATH="${HOME}/.local/lib"
- DYLD_LIBRARY_PATH="${HOME}/.local/lib"
- MAKEOPTS="-j2"
......
......@@ -181,7 +181,7 @@ static int run_worker(uv_loop_t *loop, struct engine *engine)
/* Run event loop */
int ret = engine_start(engine);
if (ret == 0) {
ret = uv_run(loop, UV_RUN_DEFAULT);
uv_run(loop, UV_RUN_DEFAULT);
}
if (sock_file) {
unlink(sock_file);
......@@ -260,9 +260,11 @@ int main(int argc, char **argv)
/* Block signals. */
uv_loop_t *loop = uv_default_loop();
uv_signal_t sigint;
uv_signal_t sigint, sigterm;
uv_signal_init(loop, &sigint);
uv_signal_init(loop, &sigterm);
uv_signal_start(&sigint, signal_handler, SIGINT);
uv_signal_start(&sigterm, signal_handler, SIGTERM);
/* Create a server engine. */
mm_ctx_t pool = {
.ctx = mp_new (4096),
......
......@@ -180,11 +180,11 @@ def setup_env(child_env, config, config_name, j2template):
# Set up child process env()
child_env["SOCKET_WRAPPER_DEFAULT_IFACE"] = "%i" % CHILD_IFACE
child_env["SOCKET_WRAPPER_DIR"] = TMPDIR
no_mininize = "true"
no_minimize = "true"
for k,v in config:
# Enable selectively for some tests
if k == 'query-minimization' and str2bool(v):
no_mininize = "false"
no_minimize = "false"
break
selfaddr = testserver.get_local_addr_str(socket.AF_INET, DEFAULT_IFACE)
childaddr = testserver.get_local_addr_str(socket.AF_INET, CHILD_IFACE)
......@@ -200,7 +200,8 @@ def setup_env(child_env, config, config_name, j2template):
j2template_ctx = {
"ROOT_ADDR" : selfaddr,
"SELF_ADDR" : childaddr,
"NO_MINIMIZE" : no_mininize
"NO_MINIMIZE" : no_minimize,
"WORKING_DIR" : TMPDIR,
}
cfg_rendered = j2template.render(j2template_ctx)
f = open(os.path.join(TMPDIR,config_name), 'w')
......@@ -248,7 +249,8 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa
print('... scenario "%s" crashed, logs in "%s"' % (os.path.basename(path), TMPDIR))
finally:
server.stop()
daemon_proc.kill()
daemon_proc.terminate()
daemon_proc.wait()
# Do not clear files if the server crashed (for analysis)
del_files(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