server: Add API to protect access to an SHM buffer

Linux will let you mmap a region of a file that is larger than the
size of the file. If you then try to read from that region the process
will get a SIGBUS signal. Currently the clients can use this to crash
a compositor because it can create a pool and lie about the size of
the file which will cause the compositor to try and read past the end
of it. The compositor can't simply check the size of the file to
verify that it is big enough because then there is a race condition
where the client may truncate the file after the check is performed.

This patch adds the following two public functions in the server API
which can be used wrap access to an SHM buffer:

void wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer);
void wl_shm_buffer_end_access(struct wl_shm_buffer *buffer);

The first time wl_shm_buffer_begin_access is called a signal handler
for SIGBUS will be installed. If the signal is caught then the buffer
for the current pool is remapped to an anonymous private buffer at the
same address which allows the compositor to continue without crashing.
The end_access function will then post an error to the buffer
resource.

The current pool is stored as part of some thread-local storage so
that multiple threads can safely independently access separate
buffers.

Eventually we may want to add some more API so that compositors can
hook into the signal handler or replace it entirely if they also want
to do some SIGBUS handling.
server: Start documenting the server side API

This is now public, stable API, so it seems prudent to actually document it.
tests: move test-runner into subdirectory

It's nice to keep helper sources separately from tests sources.
It's better for searching files as well as for extending
the test-suite.

Also, there were no need to compile each test with test-*.c files
so I used them to create noinst library and link the tests against it.
Now we don't need to attach test-runner files to each test sources.
test-compositor: add tc-config.h file

This file defines configuration of test-compositor. It's initial file
because it will be used in the main files.
test-compositor: add libtc-utils library

This library contains generic function used by display and client
test-compositor: make compiler search for headers in src

Search for headers in wayland/src
test-compositor: add client and server header files

Add prototypes of functions. Since it's being trasfred from
wayland integration tests, I don't want to split the patch into
more patches which would be logical, but it would take a lot of time.
test-compositor: add tc-events.[ch]

This is support for simulating events. It will be used by
test-compositor.
test-compositor: add libtc-server library

Server side functions
test-compositor: add client-side functions

Add functions which can be used by client's subprocess. The header has
been already added.
test-compositor: add main header file

Add test-compositor header file
tests: look even for test-compositor headers

Search for headers in test-compositor/ dir
test-compositor: add README
autotools: link against test-compositor libraries

Tests using test-compositor need to be linked against it
tests: add wl_shm test

The test uses test-compositor
test-compositor: use waitid instead of waitpid

It allows better handling of errors. One test failed but was marked OK
because sighandler didn't catched SIGSEGV.
tests: add wl_proxy tests

Few tests using test-compositor. It tests marshaling proxy and some
errorneous behaviour.
tests: add wl_global tests

Test if creating two globals with the same id and creating global
with wrong version failes.

Also test creating singletons. The code remained there although it is
not a bug, see comments in the code.
tests: unit tests for test-compositor
tests: add tests for tc-events from test-compositor