tests: use our own XDG_RUNTIME_DIR for tests

Use $XDG_RUNTIME_DIR/wayland-tests for tests. This way we won't be
messing XDG_RUNTIME_DIR and it also fixes a bug, when socket-test
failed when another compositor was running.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
scanner, client: Added more error checks when strtol function is used

Signed-off-by: Imran Zaman <imran.zaman@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Don't document an absent parameter.

Quells a doxygen warning:

  src/wayland-server.c:790: warning: argument 'None' of command @param is
  not found in the argument list of wl_display::wl_display_create(void)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
doc: Added API documentation for wl_display_destroy and wl_display_add_socket functions.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
[Pekka Paalanen: minor re-wording.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Remove useless semicolon.

Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
connection: abort if a listener function is NULL

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
tests: add timeout

Add test_set_timeout() function that allows the test to
set timeout for its completition. Any other call to the function
re-sets the timeout to the new value. The timeouts can be turned off
(usefull when debugging) by setting evironment variable
WAYLAND_TESTS_NO_TIMEOUTS.

v2:
  rename NO_TIMEOUTS to WAYLAND_TESTS_NO_TIMEOUTS
  use unsigned int as argument of test_set_timeout()
  improve printing of the message about timeout

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
tests: add test_usleep and test_sleep functions

The former one was already used in tests, but was private.
These functions can be shared across the tests, so make them
public.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
tests: add timeout tests

sanity tests for timeouts.

v2:
  use test_sleep instead of sleep
  add few more test-cases

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
tests: use test_set_timeout in display-test

replace call to alarm() with test_set_timeout()

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
queue-test: put back timeout

In 93e654061b9 we removed call to alarm() that served as timeout in this test.
Now when we have test_set_timeout() func, return the timeout back.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
tests: don't print '\0' character

print "" (which results in no output) instead of
printing '\0' (which is not visible, but is there)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
gitignore: adpat to scanner and protocol path changes

Since commit 4c163b9b001bd93aaf97d7e962873a379eb90bfd, wayland-scanner
is built in top builddir instead of src, and protocol files are
generated in protocol subdir instead of src.
Protocol files generated in the new path are already properly ignored
in the toplevel gitignore file.

Signed-off-by: Olivier Blin <olivier.blin@softathome.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
client: read_events should return -1 after an error

When a thread is sleeping, waiting until another thread read
from the display, it always returns 0. Even when an error
occured. In documentation stands:

  "return 0 on success or -1 on error.  In case of error errno will
   be set accordingly"

So this is a fix for this.

Along with the read_events, fix a test so that it now complies
with this behaviour (and we have this tested)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
server: increase listen queue to 128

This will allow more than 1 simultaneous client connections to the server
without the possibility of connection refused error.

Signed-off-by: Imran Zaman <imran.zaman@gmail.com>

http://utcc.utoronto.ca/~cks/space/blog/unix/ListenBacklogMeaning
http://stackoverflow.com/questions/19221105/connect-with-unix-domain-socket-and-full-backlog
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
doc: make rebuilds doxygen output on code changes

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
doc: Preserve spaces

Slight variation on Pekka's patch. It seems harmless to put this anywhere.
doc: preserve links produced by Doxygen

These links are pretty useful for navigation, though sometimes excessive
(you can turn them off by putting % before the word in the comment).

I had to turn off validation because it failed on missing and duplicate
target id's, which this produces.
doc: Don't print dash if doxygen brief description missing
doc: removed some unnecessary nested listing from doxygen output

This makes the lists of parameters slightly smaller and removes some
bullets from see-also and since.