Commit Graph

988 Commits

Author SHA1 Message Date
Kristian Høgsberg
f42d763cd0 tests: prefix event loop tests with event_loop_ 2012-05-08 09:58:01 -04:00
Kristian Høgsberg
d8dda50d27 tests: assert that mask is zero is post_dispatch callback 2012-05-08 09:57:17 -04:00
Kristian Høgsberg
550e8f3861 tests: Add timerfd test 2012-05-08 09:55:55 -04:00
Kristian Høgsberg
d56af2787e tests: Add signal test case
Doesn't necessarily catch the signalfd bug just fixed, since that only
triggers when an uninitialized int is negative.
2012-05-08 09:41:37 -04:00
Kristian Høgsberg
3e7bd7362b event-loop: Consolidate code for setting up new sources 2012-05-08 09:30:49 -04:00
Tiago Vignatti
a41fa8b3ec event-loop: fix conditional checking
Introduced in:
    commit 80f4f0d512
    Author: Jonas Ådahl <jadahl@gmail.com>
    Date:   Wed Mar 21 10:31:24 2012 +0100

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-08 09:08:57 -04:00
Kristian Høgsberg
a73c91585e TODO: drop scanner namespace item
Not worh the trouble.
2012-05-07 23:45:20 -04:00
Kristian Høgsberg
375cb418f4 scanner: Generalize desc_dump() to handle hanging indents 2012-05-07 23:41:48 -04:00
Kristian Høgsberg
5b0d8f09af scanner: Fix desc_dump() to not extend beyond column 72 2012-05-07 22:43:56 -04:00
Kristian Høgsberg
e4026ff797 scanner: Use indent() function in desc_dump() 2012-05-07 22:38:23 -04:00
Daniel Stone
3f7048e0e9 Use unsigned for key/button up/down state in grabs
Since we just use it as a simple boolean flag, might as well convert it
to unsigned.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 12:15:14 -04:00
Kristian Høgsberg
3de517a092 Use class_ instead of class in protocol
This way we can include the generated code from C++.
2012-05-03 15:41:50 -04:00
Daniel Stone
0a828e098c tests: Fix out-of-tree builds
Make sure we include any generated headers from src/ as well, like
wayland-version.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-02 16:01:04 -04:00
Kristian Høgsberg
2753904eda Add shell_surface set_title and set_class requests 2012-05-02 09:39:17 -04:00
Nicolas Pouillon
c1b6dbbacd server: Post new globals to current clients
Globals are bursted to client on conntect.  Now when new global
objects are added to the server state, existing clients also get
notified.
2012-05-02 09:35:39 -04:00
Kristian Høgsberg
5177e76984 protocol: Move ping event down to other events 2012-05-01 13:50:23 -04:00
Kristian Høgsberg
35fc72eb8b Add wl_proxy_get_id() 2012-04-27 11:31:07 -04:00
Kristian Høgsberg
ac73a74f43 Add wl_client_get_object() 2012-04-27 11:28:06 -04:00
Kristian Høgsberg
4fd3696f98 Drop stale prototype 2012-04-27 11:26:57 -04:00
Kristian Høgsberg
bf1c2f3257 tests: Just list tests under the TESTS variable 2012-04-26 08:06:43 -04:00
Kristian Høgsberg
5be33520b3 Merge remote-tracking branch 'pq/for-krh' 2012-04-25 10:45:48 -04:00
Kristian Høgsberg
f72c0c2a24 Add COPYING 2012-04-25 10:12:21 -04:00
Pekka Paalanen
9f91feb5d9 server: do not create wl_client if accept() failed
Spotted during wl_os_accept_cloexec() work.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25 09:37:42 +03:00
Pekka Paalanen
ff50f6bfc4 os: wrap accept4(SOCK_CLOEXEC)
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-25 09:37:42 +03:00
Pekka Paalanen
b2eaf870cf os: wrap epoll_create
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-25 09:37:42 +03:00
Pekka Paalanen
35d5053c62 os: wrap recvmsg(MSG_CMSG_CLOEXEC)
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-25 09:37:42 +03:00
Pekka Paalanen
2ccaf918ab tests: silence warnings from pipe()
warning: ignoring return value of ‘pipe’, declared with attribute
warn_unused_result

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25 09:32:58 +03:00
Pekka Paalanen
1463a41f89 os: wrap F_DUPFD_CLOEXEC
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-25 09:32:58 +03:00
Pekka Paalanen
3b29783dc8 os: define SOCK_CLOEXEC on Linux
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-25 09:32:57 +03:00
Pekka Paalanen
1f827a4776 os: remove unneeded errno assignment
If socket() fails, it will return failure code. No need to reset errno
beforehand.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-25 09:32:57 +03:00
Kristian Høgsberg
e7dd32710f tests: Test invoking closures built with wl_closure_vmarshal() 2012-04-22 14:17:27 -04:00
Kristian Høgsberg
243672cd3c connection: Make sure we can invoke closures built with wl_closure_vmarshal() 2012-04-22 14:17:20 -04:00
Kristian Høgsberg
1901d66ffc connection: Move closure object out of wl_connection 2012-04-22 13:49:35 -04:00
Kristian Høgsberg
0d6dea17b4 connection: Dont put fds in the connection until we send the closure 2012-04-21 23:50:13 -04:00
Kristian Høgsberg
9d37682db3 Update TODO
Casey did surface.enter/leave.
2012-04-20 13:43:08 -04:00
Casey Dahlin
a5df3de101 Add wl_surface.enter and wl_surface.leave events
These events let us track when a surface enters or leaves the scanout region of
an output. This way if a surface moves to another output and that output is on
a different card, we can suggest the toolkit reallocate its buffers
appropriately.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
2012-04-20 10:45:38 -04:00
Pekka Paalanen
f52a901f88 tests: add .gitignore
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-20 16:28:15 +03:00
Pekka Paalanen
7134a439c1 os: wrap socket(SOCK_CLOEXEC) calls
Some system C libraries do not offer SOCK_CLOEXEC flag.

Add a new header for OS compatibility wrappers. Wrap socket() calls into
wl_os_socket_cloexec() which makes sure the O_CLOEXEC flag gets set on
the file descriptor.

On systems having SOCK_CLOEXEC this uses the old socket() call, and
falls back if it fails due to the flag (kernel not supporting it).

wayland-os.h is private and not exported.

Add close-on-exec tests for both normal and forced fallback paths.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-20 16:26:37 +03:00
Pekka Paalanen
da6b1a8e47 tests: support testing fd inheritance over exec
Add facility for testing how (many) file descriptors survive an exec.
This allows implementing O_CLOEXEC tests.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-20 15:06:27 +03:00
Pekka Paalanen
7c0aa1a4a3 tests: plug fd leaks in free_source_with_data
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-20 14:58:31 +03:00
Pekka Paalanen
e0561ac68d tests: detect fd leaks
Detect file descriptor leaks in tests.

Add a sanity test to verify that we catch the leaks.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-20 14:58:31 +03:00
Scott Moreau
2896b6a220 protocol: Add ping event and corresponding pong request 2012-04-19 12:48:55 -04:00
Kristian Høgsberg
d44074900d tests: Add more sanity test to make sure we catch different failure modes 2012-04-19 12:37:40 -04:00
Kristian Høgsberg
41570a5ed9 tests: Make sure unused malloc() doesn't get optimized away 2012-04-19 12:07:20 -04:00
Pekka Paalanen
55489883c4 tests: add sanity-test
Test the testing framework itself, so that it catches the errors we
expect it to.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-19 14:46:52 +03:00
Pekka Paalanen
bb74adbc4d tests: add support for tests expected to fail
Add a new macro FAIL_TEST that can be used to define tests that are
supposed to fail. To distinguish the supposed outcome of a test, add a
field to 'struct test'.

However, simply adding a field to 'struct test' will make all tests past
the first one in an executable to be garbage. Apparently, the variables
of type 'struct test' have different alignment when put into a special
section than otherwise, and the compiler will get the skip from one
'struct test' to the next wrong.

Explicitly specify the alingment of 'struct test' to be 16 bytes, which
is what it seems to be in the special section on x86_64.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-19 14:26:51 +03:00
Pekka Paalanen
56426d8a4a tests: stylish test-runner.c
Fix a typo, add a comment, change the print format, and add a variable
that will ease implementing tests that are expected to fail.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-19 14:06:08 +03:00
Pekka Paalanen
b1d4eb24c6 tests: fail build if NDEBUG is defined
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-19 12:14:19 +03:00
Pekka Paalanen
84464a3e9b tests: put common test source files in a variable
Makes all test targets have the same common make dependencies.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-19 12:12:13 +03:00
Pekka Paalanen
b7c7963f16 Fix printf format warnings
connection.c:530: warning: format '%lu' expects type 'long unsigned
int', but argument 2 has type 'unsigned int'

/connection.c:560: warning: format '%lu' expects type 'long unsigned
int', but argument 2 has type 'unsigned int'

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-17 15:02:15 -04:00