summaryrefslogtreecommitdiffstats
path: root/coverage
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-02-15 17:40:04 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2019-04-02 09:58:49 +0200
commit50deefa0f08b88b99748abd57560222744d2f8db (patch)
treeb8ff1f758168487e3c34eea9b3445306eb41b66f /coverage
parent8214e88a036ca06a9a2ba2348e99df4de8bb8940 (diff)
Workaround an exit issue
When running gcov the running script is sometime blocking. GDB tells: Thread 1 (Thread 0x7ff14e783b40 (LWP 1318)): #0 0x00007ff14ccf334c in __lll_lock_wait_private () from /lib64/libc.so.6 #1 0x00007ff14cc70598 in malloc () from /lib64/libc.so.6 #2 0x000000000046523a in gcov_do_dump () #3 0x00000000004653f4 in __gcov_exit () #4 0x00000000004632df in _GLOBAL__sub_D_00100_1_wrap_json_get_error_position () at ../../src/wrap-json.c:1250 #5 0x00007ff14e5b5916 in _dl_fini () from /lib64/ld-linux-x86-64.so.2 #6 0x00007ff14cc255ec in __run_exit_handlers () from /lib64/libc.so.6 #7 0x00007ff14cc2571c in exit () from /lib64/libc.so.6 #8 0x00000000004069fc in on_sigchld (signum=17, info=0x7ffc3f43fa70, uctx=0x7ffc3f43f940) at ../../src/main-afb-daemon.c:411 #9 <signal handler called> #10 0x00007ff14cc6e527 in _int_malloc () from /lib64/libc.so.6 #11 0x00007ff14cc710a2 in calloc () from /lib64/libc.so.6 #12 0x00007ff14d454ff7 in json_object_new_int () from /lib64/libjson-c.so.4 ... It means that allocating memory in exit handlers can block! The work around here is to force the daemon to exit properly, i.e., not in a signal handler, by calling hello/exit from test script -at the very end-. Change-Id: Iee289fb1af8479628df895aac7eb021cedda4f2c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'coverage')
-rwxr-xr-xcoverage/scripts/run-test.sh2
-rw-r--r--coverage/scripts/zz-exit.sh7
2 files changed, 8 insertions, 1 deletions
diff --git a/coverage/scripts/run-test.sh b/coverage/scripts/run-test.sh
index ee0fb00a..fc45515d 100755
--- a/coverage/scripts/run-test.sh
+++ b/coverage/scripts/run-test.sh
@@ -147,7 +147,7 @@ $R/bin/afb-daemon-cov \
# true life test
##########################################################
mk \
-valgrind \
+vg \
--log-file=$R/valgrind.out \
--trace-children=no \
--track-fds=yes \
diff --git a/coverage/scripts/zz-exit.sh b/coverage/scripts/zz-exit.sh
new file mode 100644
index 00000000..86936c7b
--- /dev/null
+++ b/coverage/scripts/zz-exit.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+$R/bin/afb-client -s -e $WSURL <<EOC
+hello exit 0
+hello exit 0
+EOC
+