summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2017-03-16connection-test: fix assertEric Engestrom1-2/+2
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-02-23tests: Fix "new ID" type handling in argument_from_va_list testCarlos Garnacho1-3/+3
New IDs are internally dealt with as objects, however this test expected to deal with 'n' as the uint32_t type that's just seen through the wire. We should give it an object instead, and expect an object from it. https://bugs.freedesktop.org/show_bug.cgi?id=99899 Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Kalev Lember <kalevlember@gmail.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-26tests: Test wl_argument_from_va_listYong Bakos1-0/+35
connection-test.c did not cover wl_argument_from_va_list, so add one test that specifically tests this method. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-25server: add a safer signal type and port wl_display to itGiulio Camuffo1-0/+337
wl_list_for_each_safe, which is used by wl_signal_emit is not really safe. If a signal has two listeners, and the first one removes and re-inits the second one, it would enter an infinite loop, which was hit in weston on resource destruction, which emits a signal. This commit adds a new version of wl_signal, called wl_priv_signal, which is private in wayland-server.c and which does not have this problem. The old wl_signal cannot be improved without breaking backwards compatibility. Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-25tests: Add a test for global filterOlivier Fourdan1-0/+140
Test if the global filter is effectively filtering out the global when the filter returns false. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2017-01-24protocol: add axis_source.wheel_tiltPeter Hutterer3-2/+35
Unlike a wheel rotation, a wheel tilt is a discrete-only axis. Wheel rotations are mapped to degrees in libinput but that that does not apply to wheel tilt axes where there is no physical equivalent. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Acked-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-24scanner: support "since" attribute for enum entriesPeter Hutterer7-3/+101
This was already in the DTD but not supported by the scanner. The check for ever-increasing "since" tags is not strictly required for enum entries as we control the binary value. But it keeps the xml file in good order, preventing things like: <entry name="first" value="…" /> <entry name="second" value="…" since="3"/> <entry name="third" value="…" since="2"/> <entry name="fourth" value="…" since="3"/> If this is undesirable in the future the check can be removed without side-effects. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-24tests: sync example.xml with wayland.xmlPeter Hutterer4-112/+294
These are the protocol.xml changes from: 66a26aeb2a: protocol: Remove inconsistent line breaks a26ed0949e: protocol: indentation fixes 6a18a87727: protocol: Extend wl_touch with touchpoint shape and orientation and a few other, smaller ones. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Tested-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-23tests: add scanner testsPekka Paalanen1-0/+51
Add tests that ensure that wayland-scanner output for a given input does not change unexpectedly. This makes it very easy to review wayland-scanner patches. Before, when patches were proposed for wayland-scanner, I had to build wayland without the patches, save the generated files into a temporary directory, apply the patches, build again, and diff the old vs. new generated file. No more. Now whenever someone makes intentional changes to wayland-scanner's output, he will also have to patch the example output files to match. That means that reviewers see the diff of the generated files straight from the patch itself. Verifying the diff is true is as easy as 'make check'. The tests use separate example XML files instead of wayland.xml directly, so that wayland.xml can be updated without fixing scanner tests, avoiding the churn. example.xml starts as a copy of wayland.xml. If wayland.xml starts using new wayland-scanner features, they should be copied into example.xml again to be covered by the tests. This patch relies on the previous patch to actually add all the data files for input and reference output. The scanner output is fed through sed to remove parts that are allowed to vary: the scanner version string. v2: no need for scanner-test.sh to depend on the test data Task: https://phabricator.freedesktop.org/T3313 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> (v1) Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Tested-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-23tests: add data files for future wayland-scanner testPekka Paalanen11-0/+13740
This patch adds the input and reference output data files for the wayland-scanner tests to be added by the following patch. The data files are split into their own patch because they are extremely uninteresting to review: - example.xml is just a copy wayland.xml from 1.12.0 - small.xml is a tiny dummy definition used for testing scanner variations without causing lots of big output files - the other files are wayland-scanner products from the xml files Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> v2: update output due to 2c6350beb92816eb9213c4944d197485e788ef6d Acked-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-18tests: Add nullable check to wl_message_count_arraysYong Bakos1-2/+4
Array argument symbols in a wl_message may be nullable, but the test for wl_message_count_arrays did not test this. Add one more wl_message with nullable array arguments. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-18tests: Test wl_interface_equalYong Bakos1-0/+50
The test suite did not cover wl_interface_equal, so add one test that specifically tests this method. Add the new test to Makefile.am. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> [Pekka: add assert(&wl_registry_interface != &copy);] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-10tests: Test wl_message_count_arraysYong Bakos1-0/+37
message-test.c did not cover wl_message_count_arrays, so add one test that specifically tests this method. Note that this exposes wl_message_count_arrays in a private header (wayland-private.h), and removes the `static` modifier of the implementation. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-10tests: Use unique XDG_RUNTIME_DIRDaniel Stone1-1/+2
Rather than using a hardcoded 'wayland-tests' directory under the existing XDG_RUNTIME_DIR to use as the new runtime dir, use mkdtemp to guarantee uniqueness. This fixes make -jN check, as well as just happening to run 'make check' twice from the same session. Signed-off-by: Daniel Stone <daniels@collabora.com> Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-10-18array-test: Include wayland-util.h and simplify init testYong Bakos1-11/+9
Include wayland-util.h in addition to wayland-private.h, to be more explicit about where wl_array is defined. Remove the useless repeated testing of wl_array_init, because if it fails once out of thousands of iterations we're all doomed anyway. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> [Pekka: add the memset] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-10-18tests: Test wl_array_releaseYong Bakos1-0/+14
array-test.c did not cover wl_array_release, so add one test that specifically tests this method. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> [Pekka: do not overwrite array.data] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-05tests: Add test for wl_list_lengthYong Bakos1-0/+13
list-test.c did not cover wl_list_length, so add one test that specifically tests this method. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-12Add API to install protocol loggers on the server wl_displayGiulio Camuffo1-0/+148
The new wl_display_add_protocol_logger allows to set a function as a logger, which will get called when a new request is received or an event is sent. This is akin to setting WAYLAND_DEBUG=1, but more powerful because it can be enabled at run time and allows to show the log e.g. in a UI view. A test is added for the new functionality. Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-12Add a resource creation signalGiulio Camuffo1-9/+72
This change allows to add a resource creation listener to a wl_client, which will be notified when a new resource is created for that client. The alternative would be to have a per wl_display listener, but i think that resources are really client specific objects, so it makes sense to use the wl_client as the context. Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> [Pekka: added wl_list_remove() in TEST(new_resource).] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-11Add API to get the list of connected clientsGiulio Camuffo1-0/+22
This patch chooses the wl_list_for_each-style of iterating over the clients, instead of using an iterator function, because i think it is easier to use. Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-11server: add listener API for new clientsSungjae Park1-0/+87
Using display object, Emit a signal if a new client is created. In the server-side, we can get the destroy event of a client, But there is no way to get the created event of it. Of course, we can get the client object from the global registry binding callbacks. But it can be called several times with same client object. And even if A client creates display object, (so there is a connection), The server could not know that. There could be more use-cases not only for this. Giulio: a test is added for the new functionality Signed-off-by: Sung-jae Park <nicesj@nicesj.com> Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-07-25display-test: Remove redundant stdbool includeYong Bakos1-1/+0
display-test.c includes stdbool.h twice. Remove the redundant include. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-25(multiple): Include stdint.hYong Bakos9-0/+9
Some headers and source files have been using types such as uint32_t without explicitly including stdint.h. Explicitly include stdint.h where appropriate. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-11tests: Require base 10 for the string specifying the number of open fd'sBryce Harrington1-1/+1
The third arg to strtol() specifies the base to assume for the number. When 0 is passed, as is currently done in wayland-client.c, hexadecimal and octal numbers are permitted and automatically detected and converted. exec-fd-leak-checker's single argument is the count of file descriptors it should expect to be open. We should expect this to be specified only as a decimal number, there's no reason why one would want to use octal or hexadecimal for that. Suggested by Yong Bakos. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-05-19display-test: move a misplaced commentMarek Chalupa1-2/+2
we split a function while refactoring in c643781 and now the comment makes no sense Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-19tests: Check for client/server-core.h inclusionYong Bakos1-0/+7
The purpose of wayland-*-protocol-core.h is to mimc the wayland-*-protocol.h generated by scanner --include-core-only. The only difference being what wayland-*-protocol.h should include. Add an include check in the headers-protocol-core-test, to be sure that a wayland-*-protocol.h generated with the --include-core-only option properly includes wayland-*-core.h. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02tests: fix typoEric Engestrom1-1/+1
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-29tests/queue-test: Add tests for proxy wrappersJonas Ådahl1-0/+122
Test that doing wl_display.sync on a wrapped proxy with a special queue works as expected. Test that creating a wrapper on a destroyed but not freed proxy fails. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-02-26tests: add test for receiving an error on destroyed objectMarek Chalupa1-0/+50
test if receiving an error on already destroyed object won't do any harm Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Tested-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-02-16resource-test: Use wl_seat instead of wl_display for testingDerek Foreman1-5/+5
We're creating resources with versions up to 4. wl_display isn't version 4, so this is technically verifying that we can do something we shouldn't. wl_seat already has versions this high, so switch to that. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-19tests: Test proxy versionsDerek Foreman1-9/+116
Add a test that confirms that proxy versions are always 0 for display and correct otherwise. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16tests: Test that one can fetch the protocol error after EPIPEJonas Ådahl1-9/+169
If a client is terminated due to some reason, it should always be possible to retrieve protocol error associated with the termination. Test that, while either using the dispatch helpers (wl_display_dispatch(_queue)() or the prepare read API, it should be possible to retrieve the error after EPIPE. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16tests: Pass argument to client mainJonas Ådahl6-37/+45
Change the API to pass an "void *" argument to the client main function, allowing the caller to call the same main function with different input. A helper (client_create_noarg) is added for when no argument is passed, and the existing test cases are changed to use this function instead. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16tests: Synchronize client termination in idle callbackJonas Ådahl1-6/+21
We currently wait for clients in the wl_client destroy signal, which is called before the client is destructed and the socket is closed. If test clients rely on being closed due to the socket being closed we'd dead lock. Avoid this by synchronizing in an idle task that is called after the client is fully destroyed. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-13socket-test: Refactor if check into the assertBryce Harrington1-2/+1
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-13socket-test: Fix some comment typosBryce Harrington1-5/+7
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-16add wl_abort private functionMarek Chalupa1-1/+6
On many places in the code we use wl_log + abort or wl_log + assert(0). Replace these with one call to wl_abort, so that we don't mix abort(), assert(0) and we'll save few lines Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-10fixed-benchmark: remove unused arguments in mainMarek Chalupa1-1/+1
Fixed benchmark uses main(int argc, char *argv[]) but does not use the arguments, so we can replace them with void Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-10tests: Don't increment variables inside an assert()Bryce Harrington1-3/+6
Addresses this warning found by Denis Denisov: [tests/array-test.c:137]: (warning) Assert statement modifies 'i'. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-06-12test-runner: Add copyright boilerplate for .h, same as the .cBryce Harrington1-0/+24
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12socket-test: Fix style on multi-line commentBryce Harrington1-2/+3
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12tests: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington24-384/+456
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-05-21tests: add an headers testGiulio Camuffo3-0/+112
This test checks that the protocol and library headers include only what they are supposed to include. That is, that the core headers do not include the protocol headers and that the core protocol headers do not include the non core library headers. The build process now generates core protocol headers, but they are only used in the test and don't get installed. Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-05-15remove trailing whitespacesMichael Vetter3-6/+6
Remove trailing whitespaces because they are not needed and jumping to the end of al ine should do just that and not jump to the whitespace.
2015-04-15tests: Typo in a commentBryce Harrington1-1/+1
(Spotted by Silvan) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-19Spelling fixes (cosmetic)Bryce Harrington1-2/+2
A few typos in comments and protocol docs, no code changes. ./src/wayland-util.h:281: recieved ==> received ./src/wayland-client.c:115: occured ==> occurred ./src/wayland-client.c:156: occured ==> occurred ./tests/test-compositor.c:76: parallely ==> parallelly ./tests/test-compositor.c:474: recieve ==> receive ./protocol/wayland.xml:1767: layed ==> laid ./protocol/wayland.xml:2112: dependant ==> dependent ./doc/publican/sources/Client.xml:25: recieved ==> received Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Bill Spitzak <spitzak@gmail.com>
2015-02-06tests: Fix FAIL in sanity-test (*timeout*) when Yama LSM enabledBryce Harrington1-11/+51
This fixes a regression in the testsuite since c3653f7f, where four of the timeout tests fail with "Timeouts suppressed" messages. The timeouts are being suppressed because the testsuite is erroneously detecting that a debugger is attached. This detection mechanism (adopted from libinput) uses ptrace to test if there is a debugger parent process that can be attached. Unfortunately, this is an unreliable test: Kernel security policies exist to restrict the scope of ptrace to prevent processes from snooping on one another.[1] This security policy is set as the default on Ubuntu, and potentially other Linux distributions.[2] The Yama documentation suggests, "For software that has defined application-specific relationships between a debugging process and its inferior (crash handlers, etc), prctl(PR_SET_PTRACER, pid, ...) can be used. An inferior can declare which other process (and its descendents) are allowed to call PTRACE_ATTACH against it." This prctl call has no effect if Yama LSM is not loaded. The child needs to be synchronized to the client to prevent a race condition where the child might try to operate before the parent has finished its prctl call. This synchronization is done via pipes. This patch can be tested by running sanity-test with /proc/sys/kernel/yama/ptrace_scope set to 0 or 1; the test must pass for either value. 1: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2d514487faf188938a4ee4fb3464eeecfbdcf8eb 2: https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com> v4: Allow parent to communicate error state to child to prevent leaving child in zombie state if parent hits an error. v5: Check errno instead of rc for error. Don't waitpid on ppid. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-04test-runner: wait for concrete pidMarek Chalupa1-1/+1
After running a test in fork, we were waiting for any child to terminate. It is OK unless the child forks again. If the child calls fork, the waitid can catch the child's child termination, stop block and run another test while the former test is still running. This is racy i. e. when adding socket. Since we have test compositor which uses fork, this situation can occur pretty frequently. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28display-test: disable leak check in tests that use pthreadMarek Chalupa1-0/+8
pthread is leaking and it makes our tests fail. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28tests: add possibility to disable leak check for single testMarek Chalupa3-0/+21
In tests that are using external libraries (i. e. pthread) we can get failure because of leaks in the external library. Until we have some better solution (if ever), let these (and only these) tests to disable leak checks. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>