client: Introduce functions to allocate and marshal proxies atomically

The server requires clients to only allocate one ID ahead of the previously
highest ID in order to keep the ID range tight.  Failure to do so will
make the server close the client connection.  However, the way we allocate
new IDs is racy.  The generated code looks like:

  new_proxy = wl_proxy_create(...);
  wl_proxy_marshal(proxy, ... new_proxy, ...);

If two threads do this at the same time, there's a chance that thread A
will allocate a proxy, then get pre-empted by thread B which then allocates
a proxy and then passes it to wl_proxy_marshal().  The ID for thread As
proxy will be one higher that the currently highest ID, but the ID for
thread Bs proxy will be two higher.  But since thread B prempted thread A
before it could send its new ID, B will send its new ID first, the server
will see the ID from thread Bs proxy first, and will reject it.

We fix this by introducing wl_proxy_marshal_constructor().  This
function is identical to wl_proxy_marshal(), except that it will
allocate a wl_proxy for NEW_ID arguments and send it, all under the
display mutex.  By introducing a new function, we maintain backwards
compatibility with older code from the generator, and make sure that
the new generated code has an explicit dependency on a new enough
libwayland-client.so.

A virtual Wayland merit badge goes to Kalle Vahlman, who tracked this
down and analyzed the issue.

Reported-by: Kalle Vahlman <kalle.vahlman@movial.com>
Update .gitignore for protocol/
wayland-server: Improve error messages for bad globals

A bug in Weston's toytoolkit gave me an hour of debugging headaches.
Improve the error messages that we send if a client requests an invalid
global, either by name or by version.
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