summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-09-21tests: add wl_resource testsMarek Ch2-1/+170
2013-09-21tests: add unit tests for wl_signalMarek Ch2-1/+117
Test wl_signal initialization, adding and getting listeners and emitting
2013-09-21tests: extended message when leak in test is detectedMarek Ch1-3/+14
When memory or fd leak is detected, print how many blocks of memory were allocated and not freed, respectively how many files were opened/unclosed.
2013-07-09Replace two remaining wl_display_add_gloavl() occurencesKristian Høgsberg1-2/+3
2013-07-02server: Make wl_object and wl_resource opaque structsKristian Høgsberg3-3/+4
With the work to add wl_resource accessors and port weston to use them, we're ready to make wl_resource and wl_object opaque structs. We keep wl_buffer in the header for EGL stacks to use, but don't expose it by default. In time we'll remove it completely, but for now it provides a transition paths for code that still uses wl_buffer. Reviewed-by: Jason Ekstrand<jason@jlekstrand.net>
2013-06-05Update tests for wl_map changes and add a map_flags testJason Ekstrand3-19/+41
2013-03-18Change wl_closure_invoke to take an opcode instead of an actual function pointerJason Ekstrand2-8/+9
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-03-17client: Invoke new_id closure arguments as pointers instead of integersJonas Ådahl2-4/+4
This commit adds a flags parameter to wl_closure_invoke(). The so far added flags are ment to specify if the invokation is client side or server side. When on the server side, closure arguments of type 'new_id' should be invoked as a integer id while on the client side they should be invoked as a pointer to a proxy object. This fixes a bug happening when the address of a client side 'new_id' proxy object did not fit in a 32 bit integer. krh: Squashed test suite compile fix from Jason Ekstrand. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-02-11tests: Add a help message for the test runnerKristian Høgsberg1-1/+22
In case we forget the name of the test case or typo it, the test runner will now list the test cases in the test binary.
2013-02-08queue-test: WEXITSTATUS() is undefined if WIFEXITED() is falseKristian Høgsberg1-2/+3
If a child process dies from a signal, WIFEXITED() returns false and WEXITSTATUS() isn't well-defined. In this case, if the client segfaults, the status is 134 and WEXITSTATUS(134) is EXIT_SUCCESS, so we mask the error.
2013-01-24gitignore: add test-suite filesDavid Herrmann1-1/+6
The *.log and *.trs files should be ignored by git as well as the GNU autotools ./test-driver helper script. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2013-01-15Add a destroy signal to the wl_event_loop objectJason Ekstrand1-0/+57
2013-01-11Added a destroy signal to the wl_display object.Jason Ekstrand2-0/+81
Added a destroy signal to the wl_display object.
2013-01-11test/event-loop: Check readable state on a pipeQuentin Glidic1-1/+6
When redirecting stdout to a non-readable file makes the test fail as a false negative
2012-12-03tests: rename temporary filesPekka Paalanen1-2/+2
This is libwayland, not weston, so call the temporary files wayland-tests-*, not weston-tests-*. This is a candidate for the stable branch. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-03tests: Don't leave temporary files behindSven Joachim1-0/+2
Signed-off-by: Sven Joachim <svenjoac@gmx.de>
2012-11-07tests: Add out of order delete_id queue testsJonas Ådahl1-12/+96
Verify that when receiving the first of two synchronization callback events, destroying the second one doesn't cause any errors even if the delete_id event is handled out of order. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-11-07tests: Use a pipe for synchronization to avoid potential deadlockJonas Ådahl1-24/+55
Using signals in the previous way could potentially lead to dead locks if the SIGCONT was signalled before a listener was registered. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-11-05tests: Add queue test caseJonas Ådahl2-1/+174
Check that after a callback removes a proxy that most likely will have several events queued up with the same target proxy, no more callbacks are invoked. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-21tests: Include wayland-private.h for container_ofKristian Høgsberg1-0/+1
2012-10-10Change filedescriptor API to be thread safeKristian Høgsberg2-88/+25
The update callback for the file descriptors was always a bit awkward and un-intuitive. The idea was that whenever the protocol code needed to write data to the fd it would call the 'update' function. This function would adjust the mainloop so that it polls for POLLOUT on the fd so we can eventually flush the data to the socket. The problem is that in multi-threaded applications, any thread can issue a request, which writes data to the output buffer and thus triggers the update callback. Thus, we'll be calling out with the display mutex held and may call from any thread. The solution is to eliminate the udpate callback and just require that the application or server flushes all connection buffers before blocking. This turns out to be a simpler API, although we now require clients to deal with EAGAIN and non-blocking writes. It also saves a few syscalls, since the socket will be writable most of the time and most writes will complete, so we avoid changing epoll to poll for POLLOUT, then write and then change it back for each write.
2012-08-29tests: Quiet warningKristian Høgsberg1-1/+2
2012-08-29tests: ensure sanity leak check tests pass when leak checks are disabled.U. Artie Eoff2-1/+13
This finalizes Robert Bradfords patch to allow NO_ASSERT_LEAK_CHECK environment variable to disable leak checks in unit tests. Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-08-29tests: Allow disabling leak checking assertions by envRob Bradford1-2/+4
Some code coverage tools trigger these assertions when run against the test suite since they don't free all their memory.
2012-08-14socket-test: don't try to be clever, fail if no XDG_RUNTIME_DIR is setPhilipp Brüschweiler1-11/+10
Not only setenv(), also putenv() allocates memory on my system (glibc 2.16.0). Just fail with a clear message if XDG_RUNTIME_DIR is not set. https://bugs.freedesktop.org/show_bug.cgi?id=52618
2012-07-23More consistent ID printingDaniel Stone1-1/+1
Use unsigned rather than signed for IDs, so they match up with what we see in other prints. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-23tests: Wrap calloc by just returning NULL if we're called too earlyKristian Høgsberg1-0/+13
Since glibc dlsym() calls calloc, we get a call to our calloc wrapper as we try to look up the real calloc implementation. dlsym() will fall back to a static buffer in case calloc returns NULL, so that's what we'll do. This is all highly glibc dependent, of course, but the entire malloc weak symbol wrapper mechanism is, so there's no loss of generality here.
2012-07-23test-runner: Wrap realloc() tooDaniel Stone1-1/+11
So all our tests don't start failing just because we had the temerity to use realloc() rather than malloc(). Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-02protocol: Add explicit nullable typesChristopher James Halse Rogers1-4/+83
Most of the time it does not make sense to pass a NULL object, string, or array to a protocol request. This commit adds an explicit “allow-null” attribute to mark the request arguments where NULL makes sense. Passing a NULL object, string, or array to a protocol request which is not marked as allow-null is now an error. An implementation will never receive a NULL value for these arguments from a client. Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-06-30tests: test that path names longer than 108 bytes are rejectedDylan Noblesmith2-1/+86
These would either overflow the struct sockaddr_un, or be truncated and leave a non-null-terminated string.
2012-06-30tests: fix make check for out-of-tree buildsDylan Noblesmith11-12/+13
It was failing with missing include files. While here, destroy the ugly "../src/..." include paths used in the tests that was just hacking around this problem in the Makefile: sed -i s/..\\/src\\/// tests/*.c
2012-06-30tests: sort list of testsDylan Noblesmith1-9/+9
2012-06-15tests: Update test cases to new closure allocate conventionKristian Høgsberg2-38/+36
2012-05-29tests: update gitignorePekka Paalanen1-0/+2
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-15tests: add noop to fixed-benchmarkPekka Paalanen1-0/+16
I was just curious of how much the looping takes time without conversion, so I added this. My results on Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz: benchmarked noop: 1.876349827s benchmarked magic: 2.245844470s benchmarked div: 12.709085309s benchmarked mul: 7.504838141s Mul seems to take 15x the time magic does, cool! Btw. the simple default cast of int32_t to double is slower than magic for me, hence the use of union. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-14Optimize wl_fixed_t to/from double conversion functionsKristian Høgsberg3-1/+186
2012-05-08Add support for signed 24.8 decimal numbersDaniel Stone1-0/+26
'fixed' is a signed decimal type which offers a sign bit, 23 bits of integer precision, and 8 bits of decimal precision. This is exposed as an opaque struct with conversion helpers to and from double and int on the C API side. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08tests: prefix event loop tests with event_loop_Kristian Høgsberg1-2/+2
2012-05-08tests: assert that mask is zero is post_dispatch callbackKristian Høgsberg1-0/+1
2012-05-08tests: Add timerfd testKristian Høgsberg1-1/+31
2012-05-08tests: Add signal test caseKristian Høgsberg1-0/+28
Doesn't necessarily catch the signalfd bug just fixed, since that only triggers when an uninitialized int is negative.
2012-05-02tests: Fix out-of-tree buildsDaniel Stone1-1/+1
Make sure we include any generated headers from src/ as well, like wayland-version.h. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-26tests: Just list tests under the TESTS variableKristian Høgsberg1-4/+2
2012-04-25os: wrap accept4(SOCK_CLOEXEC)Pekka Paalanen1-0/+2
Some system C libraries do not have SOCK_CLOEXEC, and completely miss accept4(), too. Provide a fallback for this case. This changes the behaviour: no error messages are printed now for failing to set CLOEXEC but the file descriptor is closed. The unit test for this wrapper is NOT included. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25os: wrap epoll_createPekka Paalanen1-0/+51
Some system C libraries do not have epoll_create1() nor EPOLL_CLOEXEC, provide a fallback. Add tests for the wrapper. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25os: wrap recvmsg(MSG_CMSG_CLOEXEC)Pekka Paalanen1-0/+175
Some system C libraries do not have MSG_CMSG_CLOEXEC. This flag would automatically set O_CLOEXEC flag on any received file descriptors. Provide a fallback that does it manually. If setting CLOEXEC fails, the file descriptor is closed immediately, which will lead to failures but avoid leaks. However, setting CLOEXEC is not really expected to fail occasionally. Add tests for the wrapper. The setup is copied from connection-test.c. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25tests: silence warnings from pipe()Pekka Paalanen1-3/+5
warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25os: wrap F_DUPFD_CLOEXECPekka Paalanen1-3/+67
Some system C libraries do not have F_DUPFD_CLOEXEC. Provide a fallback. Add tests for the new wl_os_dupfd_cloexec() wrapper. Add per-wrapper call counters in os_wrappers-test.c. Makes it easier to determine the minimum required number of wrapped calls. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25os: define SOCK_CLOEXEC on LinuxPekka Paalanen1-7/+1
If it's not already defined, and we are on Linux, #define it. This gets rid of a load of #ifdefs. This should also allow to use it when the kernel supports it, but the libc does not define it. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-22tests: Test invoking closures built with wl_closure_vmarshal()Kristian Høgsberg1-0/+38