test-runner: move leak checking into function

1) now we can use it in the test-compositor
2) it looks better

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
test-compositor: extend leak checks into clients

Run leak checking also on clients of test-compositor.

Checking leaks in memory is the same as in normal TEST.
The problem here is with fds. Because we pass WAYLAND_SOCKET
fd to the client, which is over taken by wl_display and
closed in wl_display_disonnect(). The result is that
the client closed one more fd than it opened. That would
not be a problem if every client used wl_display_connect().
But this is not the case. E. g. sanity-tests usually do not
call wl_display_connect().

Solution is simple: when client does not call wl_display_connect(),
it states it by invoking TEST_CLIENT_NOT_USING_WL_DISPLAY_CONNECT macro.
Because mostly (we can use word 'only' at the moment) sanity-test
clients do not use wl_display_connect(),
this does not introduce any changes to regular testing clients
(and thus for the guys that write those clients)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: add tests for leak check in clients

Sanity tests for leak checks in clients of test compositor
and also check if the test-compositor itself is not leaking
anything.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
tests: use atomic operation in leak checker

In some tests we use threads, so we need to be sure that
the allocation counters are reace-free

This works only for gcc >= 4.1.2 since in this version
were introduced the atomic operations.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>