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>
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>
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>
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>
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>
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>
(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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>