Test health: add test_thread_ok

Tests sessiond, consumerd (UST+kernel) and relayd health "ok" case in
simple scenarios.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix health check: signal parent before exit testpoint

We need to signal parent for readiness before hitting the thread exit
testpoint, otherwise we hang the test.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: consumerd should initialize lttcomm

Missing initialization makes the consumer daemon not care about the
env. var. specifying the timeouts.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: consumerd: only return readiness when health is ready

Wait for health check to be ready before returning readiness to session
daemon.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: consumerd: use DBG rather than DBG2

DBG2 is never visible.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: tests: wait for consumerd to complete

Wait for consumerd to complete when stopping sessiond.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add daemonize() to libcommon

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: lttng-ctl-health comment

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: consumerd: HT init/teardown with program

Hash tables shared between threads should not be initialized by a
specific thread, because the other threads could start using it before
it is initialized.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Consumer: add testpoints

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: relayd: initialize lttcomm inet

Not doing so does not take into account env. var. timeouts.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: sessiond: wait for health check readiness

Wait for health check readiness before notifying the parent.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Conflicts:
	src/bin/lttng-sessiond/main.c
Use lib common daemonize

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Conflicts:
	src/bin/lttng-sessiond/main.c
sessiond: add --background argument

Allow starting sessiond like --daemonize, but keeps console open.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Conflicts:
	src/bin/lttng-sessiond/main.c
tests: use --background for session daemon

Will now show errors when they happen.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
sessiond: add missing testpoints

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-relayd: implement background cmd line option

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Conflicts:
	src/bin/lttng-relayd/main.c
Fix: tests: start relayd in background mode (-b)

Ensure that relayd health check is ready to receive queries by starting
relayd in background mode with '-b' rather than putting it in background
by the shell (&).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: relayd: notify parent of readiness when all threads ready

- relayd start using daemonize common lib,
- wait for health check thread, listener and live listener threads to be
  ready before letting the parent know it is ready (in daemon and
  background modes).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: relayd: add LPOLLERR to events

Same as session daemon.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>