Commit Graph

1639 Commits

Author SHA1 Message Date
Marek Chalupa
fdb519be08 tests: split queue-test testcases
All the test-cases are in one test atm. It doesn't matter for the
outcome, but when it is split to more tests, the debugging and reading
the output is simpler.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-01 12:04:18 +02:00
Marek Chalupa
c3653f7f61 tests: detect if debugger is attached
Copy function from libinput/test/litest.c is_debugger_detached()
and use it in our test-runner. If debugger is attached, turn off
leak checks and timeouts automatically.

Revision of libinput: 028513a0a723e97941c39c4aeb17433198723913

v2. rebased to master

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-01 11:49:45 +02:00
Marek Chalupa
0e1cc7aba7 tests: use color when printing on terminal
Colorize output of the tests when prinitng on terminal.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-28 15:50:51 +02:00
Marek Chalupa
57050589b6 test-runner: print separator line after each test-case
Who can read the output when it is a single piece of text?

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-28 14:04:13 +02:00
Marek Chalupa
bef2948348 tests: rename env vars for tests
Rename WAYLAND_TESTS_NO_TIMEOUTS to WAYLAND_TEST_NO_TIMEOUTS.
Further rename NO_ASSERT_LEAK_CHECK to WAYLAND_TEST_NO_LEAK_CHECK.
Now the naming is consistent not only here, in Wayland, but even with
naming of weston env varibles related to testing.

This is version 2 of the patch. The first version just renamed
NO_ASSERT_LEAK_CHECK to WAYLAND_TEST_NO_LEAK_CHECK.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-28 13:27:34 +02:00
Seedo Eldho Paul
93e352d058 scanner.c: Use WL_PRINTF instead of __attribute__((format(printf)))
Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
2014-11-28 12:37:20 +02:00
Derek Foreman
e36d0233ee doc: fixed grammar and a typo
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2014-11-27 16:00:16 +02:00
Bill Spitzak
266b7f06be doc: Removed extra indentation from wl_list code sample
This is a minor documentation fix. I did not see any asterisks in the
output as reported by Pekka Paalanen. Using doxygen 1.7.6.1.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-26 13:34:26 +02:00
Bill Spitzak
dfdb087826 doc: Removed \ref when it refers to the subject the text is attached to
This does not make a difference to doxygen output but may help other
document generators not make redundant links.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 16:38:59 +02:00
Bill Spitzak
f73f76775f doc: fixed a typo
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 16:38:11 +02:00
Bill Spitzak
5e79171cf1 v4 doc: fixed reference to non-existent function
(Fixed to remove accidental commit of another change)

After some feedback from Marek Chalupa I decided to just remove this. There
were suggestions about warning about multiple threads but it appears this
would be true for many of these functions and thus it would be misleading to
mention multiple threads only here (as it would imply that multiple threads
work for other functions which is not true, I think).

Acked-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-25 16:36:57 +02:00
Bill Spitzak
40aa80a408 doc: Added \code tags around sample code in doxygen comments
Also removed \comment and used C++ comments. There does not appear
to be any other way to put comments into code samples.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 16:27:57 +02:00
Bill Spitzak
dd534a1fde 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.
2014-11-25 16:25:22 +02:00
Bill Spitzak
f2974c1115 doc: Don't print dash if doxygen brief description missing 2014-11-25 16:21:39 +02:00
Bill Spitzak
ba8ea938d2 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.
2014-11-25 16:14:51 +02:00
Bill Spitzak
c532b571e3 doc: Preserve spaces
Slight variation on Pekka's patch. It seems harmless to put this anywhere.
2014-11-25 16:04:42 +02:00
Bill Spitzak
d8f045ec1f doc: make rebuilds doxygen output on code changes
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 15:45:03 +02:00
Imran Zaman
11560a8d15 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>
2014-11-24 16:32:35 +02:00
Marek Chalupa
59f255d66e 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>
2014-11-21 13:59:42 +02:00
Olivier Blin
059220549c gitignore: adpat to scanner and protocol path changes
Since commit 4c163b9b00, 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>
2014-11-19 16:35:49 +02:00
Marek Chalupa
4d617b83a7 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>
2014-11-19 13:51:44 +02:00
Marek Chalupa
cf11e9dfbe queue-test: put back timeout
In 93e654061b 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>
2014-11-17 16:59:50 +02:00
Marek Chalupa
bbbdff88b1 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>
2014-11-17 16:58:31 +02:00
Marek Chalupa
1d2ef9ee08 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>
2014-11-17 16:51:51 +02:00
Marek Chalupa
6ebe55060e 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>
2014-11-17 16:48:14 +02:00
Marek Chalupa
7bf8049c48 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>
2014-11-17 16:45:49 +02:00
Ryo Munakata
47c752ad82 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>
2014-11-12 14:00:38 +02:00
Carlos Olmedo Escobar
9d327c5796 Remove useless semicolon.
Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-12 12:48:06 +02:00
Srivardhan Hebbar
754ce18135 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>
2014-11-11 13:30:02 +02:00
Bryce Harrington
94f1718c50 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>
2014-11-11 12:41:44 +02:00
Imran Zaman
ff769d8fae 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>
2014-11-10 15:25:13 +02:00
Marek Chalupa
ba6b79c577 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>
2014-11-10 14:00:56 +02:00
Philip Withnall
2097414a7c queue-test: Add another assertion
Ensure that the round trip succeeds.

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:26:53 +02:00
Philip Withnall
a434b7ba8e wayland-server: Abort if a read from a client gives 0 length
This happens on EOF if using a poll function such as select() or
kqueue() which doesn’t distinguish EOF events.

Currently execution should never reach the point where recvmsg() returns
EOF (len == 0). Instead, epoll() will detect this and indicate EPOLLHUP,
which is handled a few lines above, closing the connection. However,
other event mechanisms may not be able to distinguish EOF from regular
readability (in the case of select()) or inconsistently across platforms
(in the case of POLLHUP). There is also the possibility of half-closed
connections (shutdown(), POLLRDHUP), though this may not be an issue
with Wayland.

This will not cause problems if the FD polls as readable but actually is
not — in that case, recvmsg() will return EAGAIN.

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:24:17 +02:00
Philip Withnall
b096693bef event-loop.c: Use correct OS abstraction function for dupfd()
Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: David Fort <contact at hardening-consulting.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:17:25 +02:00
Philip Withnall
cb00e27039 connection: Fix sendmsg() on FreeBSD
It expects ((msg_controllen == 0) == (msg_control == NULL)), and returns
EINVAL otherwise. It can't hurt to be tidy about things on other platforms
either though.

See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=99356#c5

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:13:50 +02:00
kabeer khan
0953e126d7 Protocol : Added destructor to wl_data_device interface
[Pekka Paalanen: removed trailing whitespace, adjust bz link.]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=81745
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 15:04:29 +02:00
Derek Foreman
322cd6dded cosmetic: convert some function returns from int to bool
[Pekka Paalanen: change is_nullable_type() return value to bool.]

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 13:01:58 +02:00
Benjamin Herr
391820b0d6 connection: Leave fd open in wl_connection_destroy
Calling close() on the same file descriptor that a previous call to
close() already closed is wrong, and racy if another thread received
that same file descriptor as a eg. new socket or actual file.

There are two situations where wl_connection_destroy() would close its
file descriptor and then another function up in the call chain would
close the same file descriptor:

  * When wl_client_create() fails after calling wl_connection_create(),
    it will call wl_connection_destroy() before returning. However, its
    caller will always close the file descriptor if wl_client_create()
    fails.

  * wl_display_disconnect() unconditionally closes the display file
    descriptor and also calls wl_connection_destroy().

So these two seem to expect wl_connection_destroy() to leave the file
descriptor open. The other caller of wl_connection_destroy(),
wl_client_destroy(), does however expect wl_connection_destroy() to
close its file descriptor, alas.

This patch changes wl_connection_destroy() to indulge this majority of
two callers by simply not closing the file descriptor. For the benefit
of wl_client_destroy(), wl_connection_destroy() then returns the
unclosed file descriptor so that wl_client_destroy() can close it
itself.

Since wl_connection_destroy() is a private function called from few
places, changing its semantics seemed like the more expedient way to
address the double-close() problem than shuffling around the logic in
wl_client_create() to somehow enable it to always avoid calling
wl_connection_destroy().

Signed-off-by: Benjamin Herr <ben@0x539.de>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 11:26:22 +02:00
Benjamin Herr
4a661c5b0c doc: Translate doxygen <sp/> tags to spaces
Doxygen represents all spacing in code blocks with <sp/> tags, so these
need to be turned back into spaces.

Signed-off-by: Benjamin Herr <ben@0x539.de>
2014-11-03 15:53:01 +02:00
Benjamin Herr
6b511090c5 doc: Mostly use apply-templates over value-of
xsl:value-of would strip all the nested markup of the selected doxygen
elements, so that \ref, \sa and \code formatting didn't actually work.

Signed-off-by: Benjamin Herr <ben@0x539.de>
2014-11-03 15:51:12 +02:00
Benjamin Herr
5b353ad44d doc: Mark up some code examples
These blocks were misformatted in normal paragraph style in the
generated docs. Also, added \comment{} for comments within one code
example.

Signed-off-by: Benjamin Herr <ben@0x539.de>
2014-11-03 15:09:06 +02:00
Daniel Stone
37ffae3164 README: Tiny cosmetic change 2014-10-08 12:20:17 +01:00
Pekka Paalanen
7a0b86ab22 protocol: define error codes for role reassignment
On the interfaces where it was missing:
- wl_data_device
- wl_shell
- wl_pointer
add an error code for requests that set a wl_surface role when the
wl_surface already has a different role.

This is needed for compositors to appropriately report wl_surface
role violations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-08 13:09:56 +03:00
Pekka Paalanen
aee813f1ff protocol: wl_shell.get_shell_surface gives a role
Now that we have defined "role", use the term.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:48 +03:00
Pekka Paalanen
96fdcfaec7 protocol: wl_subcompositor.get_subsurface gives a role
Reword the conditions to make use of the definition of "role".

It is still forbidden to create more than one wl_subsurface for a
wl_surface at a time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:48 +03:00
Pekka Paalanen
58743c29f8 protocol: wl_data_device.start_drag may give a role
Now that we have defined "role", use the term.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:47 +03:00
Pekka Paalanen
a27501f40e protocol: wl_pointer.set_cursor gives a role
Now that we have defined "role", use the term.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:47 +03:00
Pekka Paalanen
ff2df60b1a protocol: define the concept of wl_surface role
Define what a role is, and what restrictions there are.

A change to existing behaviour is that a role cannot be changed at all
once set. However, this is unlikely to cause problems, as there is no
reason to re-use wl_surfaces in clients.

v2: give more concrete examples of roles, define losing a role, Jasper
rewrote the paragraph on how a role is set.

v3: make role permanent, there is no such thing as "losing a role".
Re-issuing the same role again must be allowed for wl_pointer.set_cursor
et al. to work.

v4: clarify the semantics of destroying a role object.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:47 +03:00
Jonas Ådahl
9dba854547 scanner: Remove stray newline
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-09-23 11:40:46 +03:00