summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* display-test: move a misplaced commentMarek Chalupa2016-05-191-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>
* tests: Check for client/server-core.h inclusionYong Bakos2016-05-191-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>
* tests: fix typoEric Engestrom2016-05-021-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>
* tests/queue-test: Add tests for proxy wrappersJonas Ådahl2016-04-291-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>
* tests: add test for receiving an error on destroyed objectMarek Chalupa2016-02-261-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>
* resource-test: Use wl_seat instead of wl_display for testingDerek Foreman2016-02-161-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>
* tests: Test proxy versionsDerek Foreman2016-01-191-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>
* tests: Test that one can fetch the protocol error after EPIPEJonas Ådahl2016-01-161-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>
* tests: Pass argument to client mainJonas Ådahl2016-01-166-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>
* tests: Synchronize client termination in idle callbackJonas Ådahl2016-01-161-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>
* socket-test: Refactor if check into the assertBryce Harrington2016-01-131-2/+1
| | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* socket-test: Fix some comment typosBryce Harrington2016-01-131-5/+7
| | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* add wl_abort private functionMarek Chalupa2015-11-161-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>
* fixed-benchmark: remove unused arguments in mainMarek Chalupa2015-07-101-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>
* tests: Don't increment variables inside an assert()Bryce Harrington2015-07-101-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>
* test-runner: Add copyright boilerplate for .h, same as the .cBryce Harrington2015-06-121-0/+24
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* socket-test: Fix style on multi-line commentBryce Harrington2015-06-121-2/+3
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-1224-384/+456
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: add an headers testGiulio Camuffo2015-05-213-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>
* remove trailing whitespacesMichael Vetter2015-05-153-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.
* tests: Typo in a commentBryce Harrington2015-04-151-1/+1
| | | | | | (Spotted by Silvan) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* Spelling fixes (cosmetic)Bryce Harrington2015-03-191-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>
* tests: Fix FAIL in sanity-test (*timeout*) when Yama LSM enabledBryce Harrington2015-02-061-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>
* test-runner: wait for concrete pidMarek Chalupa2015-02-041-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>
* display-test: disable leak check in tests that use pthreadMarek Chalupa2015-01-281-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>
* tests: add possibility to disable leak check for single testMarek Chalupa2015-01-283-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>
* connection-test: add tests for closure leaksMarek Chalupa2015-01-281-0/+79
| | | | | | | When we destroy closure, we are leaking memory sometimes. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* tests: add tests for leak check in clientsMarek Chalupa2015-01-282-0/+92
| | | | | | | | | Sanity tests for leak checks in clients of test compositor and also check if the test-compositor itself is not leaking anything. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* test-compositor: extend leak checks into clientsMarek Chalupa2015-01-281-0/+15
| | | | | | | | | | | | | | | | | | | Run leak checks also on clients of test-compositor. Checking leaks in memory is the same as in normal TEST. Checking file descriptor leaks is slightly more complex, as we pass an open file descriptor in the WAYLAND_SOCKET environment variable, which will be consumed by a client calling wl_display_connect(), but otherwise remain unused. We manage this accounting by checking if the environment variable has been unset by wl_display_connect() as it consumes the socket. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> [daniels: squashed counter-proposal patch to simplify fd leak checking, plus Bill's counter-counter-proposal, and reworded log.]
* test-runner: move leak checking into functionMarek Chalupa2015-01-282-19/+41
| | | | | | | | 1) now we can use it in the test-compositor 2) it looks better Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* tests: C++ compilation testMariusz Ceier2015-01-271-0/+5
| | | | | | | | | | | | | | | This test includes one of wayland headers, which produced error with C++ compiler. C compiler can't be used for this test, because it issues only a warning[1] and only when wayland headers are not installed in system headers path (/usr/include). [1] wayland-server-protocol.h:201:2: warning: implicit declaration of function ‘wl_resource_post_event’ [daniels: Merged in Marek's follow-up to check for a C++ compiler.] Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com> Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* tests: Correct return code handlingBryce Harrington2015-01-261-2/+2
| | | | | Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* tests: Fix typo "evnironment"Bryce Harrington2015-01-261-1/+1
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* tests: fix memory leakMarek Chalupa2014-12-012-10/+14
| | | | | | | We didn't free the struct client that we got from client_connect() Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: split queue-test testcasesMarek Chalupa2014-12-011-1/+19
| | | | | | | | | 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>
* tests: detect if debugger is attachedMarek Chalupa2014-12-011-3/+41
| | | | | | | | | | | | | 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>
* tests: use color when printing on terminalMarek Chalupa2014-11-281-7/+45
| | | | | | | 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>
* test-runner: print separator line after each test-caseMarek Chalupa2014-11-281-0/+3
| | | | | | Who can read the output when it is a single piece of text? Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
* tests: rename env vars for testsMarek Chalupa2014-11-281-3/+6
| | | | | | | | | | | | | | 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>
* client: read_events should return -1 after an errorMarek Chalupa2014-11-211-2/+2
| | | | | | | | | | | | | | | | | 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>
* tests: don't print '\0' characterMarek Chalupa2014-11-191-2/+2
| | | | | | | 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>
* queue-test: put back timeoutMarek Chalupa2014-11-171-0/+2
| | | | | | | | 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: use test_set_timeout in display-testMarek Chalupa2014-11-171-4/+4
| | | | | | | replace call to alarm() with test_set_timeout() Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
* tests: add timeout testsMarek Chalupa2014-11-171-0/+67
| | | | | | | | | | | 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: add test_usleep and test_sleep functionsMarek Chalupa2014-11-173-15/+44
| | | | | | | | | 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 timeoutMarek Chalupa2014-11-172-0/+54
| | | | | | | | | | | | | | | | 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: use our own XDG_RUNTIME_DIR for testsMarek Chalupa2014-11-101-0/+52
| | | | | | | | | | 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>
* queue-test: Add another assertionPhilip Withnall2014-11-051-1/+1
| | | | | | | | | 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>
* connection: Leave fd open in wl_connection_destroyBenjamin Herr2014-11-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* display-test: test if threads are woken up on EAGAINMarek Chalupa2014-09-111-0/+39
| | | | | | | | When wl_connection_read() in wl_display_read_events() returns with EAGAIN, we want the sleeping threads to be woken up. Test it! Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>