Commit Graph

28 Commits

Author SHA1 Message Date
Marek Chalupa
85d08e8bd6 tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()

The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().

client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().

An example:

  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();

        /* do some stuff, ... */

        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);

        /* ... */

        client_disconnect(c);
  }

  TEST(dummy_tst)
  {
       struct display *d = display_create();

       /* set up the display */
       wl_global_create(d->wl_display, ...);

       /* ... */

       create_client(d, client_main);
       display_run();

       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);

       /* ... */

       display_resume(d); /* resume display and clients */

       display_destroy(d);
  }

v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err

[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:34:33 +03:00
Marek Chalupa
886b09c9a3 client: extend error handling
When an error occurs, wl_display_get_error() does not
provide any way of getting know if it was a local error or if it was
an error event, respectively what object caused the error and what
the error was.

This patch introduces a new function wl_display_get_protocol_error()
which will return error code, interface and id of the object that
generated the error.
wl_display_get_error() will work the same way as before.

wl_display_get_protocol_error() DOES NOT indicate that a non-protocol
error happened. It returns valid information only in that case that
(protocol) error occurred, so it should be used after calling
wl_display_get_error() with positive result.

[Pekka Paalanen] Applied another hunk of Bryce's comments to docs,
	added libtool version bump.

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-07-07 17:13:21 +03:00
Thierry Reding
6b27878559 Do not distribute generated headers
The wayland-server-protocol.h and wayland-client-protocol.h headers are
currently being shipped in tarballs created using make dist. This causes
out-of-tree builds to fail since make will detect that the headers exist
by looking at the source directory (via VPATH) and not regenerate them.
But as opposed to ${top_builddir}/protocol, ${top_srcdir}/protocol is
not part of the include path and therefore the shipped files can't be
found during compilation.

Two solutions exist to this problem: 1) add ${top_srcdir}/protocol to
the include path to allow shipped files to be used if available or 2)
don't ship these generated files in release tarballs. The latter seems
the most appropriate. wayland-scanner is already a prerequisite in order
to generate wayland-protocol.c, so it is either built as part of the
package or provided externally. Generating all files from the protocol
definition at build time also ensures that they don't get out of sync.

Both of the generated headers are already listed in Makefile.am as
nodist_*_SOURCES, but at the same time they appear in include_HEADERS,
which will cause them to be added to the list of distributable files
after all. To prevent that, split them off into nodist_include_HEADERS.

Note that this problem will be hidden if a previous version of wayland
has been installed, since these files will exist in /usr/include and be
included from there. So this build error will only show for out-of-tree
builds on systems that don't have wayland installed yet.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-05-12 10:55:01 -07:00
Jonas Ådahl
e2b1218422 tests: Add message version sanity test
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-05-09 14:32:04 -07:00
Bryce W. Harrington
3adcf6f11b tests: Fix build of noinst fixed-benchmark test
Solves this build error:

  tests/fixed-benchmark.o: In function `benchmark':
  ./wayland/tests/fixed-benchmark.c:82: undefined reference to `clock_gettime'
  ./wayland/tests/fixed-benchmark.c:84: undefined reference to `clock_gettime'

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-11 09:20:27 -07:00
Pekka Paalanen
d533839735 build: depend on generated protocol headers
Fixes the build failure where the protocol headers were not generated at
all before compiling src/.libs/libwayland_server_la-wayland-server.o.

The failure was reproducable by starting fresh with 'git clean -dxf' and
not having any wayland headers installed system-wide.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-03-10 13:10:10 -07:00
Kristian Høgsberg
be75659ad1 build: Include protocol/ so we pick up generated headers 2014-03-07 16:02:19 -08:00
Kristian Høgsberg
1e716d6fcf build: Generated protocol files live in protocol/ now
Fix up the references in include_HEADERS.
2014-03-07 14:02:32 -08:00
Kristian Høgsberg
bb41c57446 build: Consolidate scanner build rules 2014-03-07 12:00:13 -08:00
Kristian Høgsberg
7ecb102409 build: Move tests/Makefile.am into toplevel Makefile.am 2014-03-07 12:00:06 -08:00
Kristian Høgsberg
4c163b9b00 build: Move src/Makefile.am into toplevel Makefile.am 2014-03-07 11:50:59 -08:00
Kristian Høgsberg
267b28887d build: Move cursor Makefile.am into toplevel Makefile.am 2014-03-06 23:15:02 -08:00
Kristian Høgsberg
bb5344ee6d build: Move protocol/ Makefile.am into toplevel Makefile.am
A small step towards non-recursive build system for wayland too.
2014-02-18 14:55:09 -08:00
Peter Hutterer
05f95c85c8 protocol: validate the protocol against a dtd
The scanner is not very forgiving if the protocol doesn't match it's
expectations and crashes without much of a notice. Thus, validate the protocol
against a DTD.

Move the protocol subdir forward so we validate first before trying anything
else, and install the DTD so we can validate weston's protocols as well.
2013-10-25 10:58:06 -07:00
Daiki Ueno
40fc79d5b0 build: Add wayland-scanner.pc.
To allow user program to include wayland-scanner.m4 in tarball, move
the path variables from it into wayland-scanner.pc.
2013-07-03 16:38:12 -04:00
Daiki Ueno
60fc83af6e build: Install wayland-scanner.mk under $(pkgdatadir). 2013-07-03 16:37:31 -04:00
Kristian Høgsberg
173e160632 Fix distcheck by adding back protocol/Makefile.am
5909dddc78 removed protocol/Makefile.am
which meant protocol/wayland.xml no longer got included in the tarball.
Add back protocol/Makefile.am and configure.ac bits and add protocol to
subdirs in Makefile.am to fix this.
2012-11-19 17:11:58 -05:00
Tiago Vignatti
5909dddc78 doc: Remove unused css and xslt for the protocol
This was added previously (commit 015c42e1) when we didn't have docbook
formatted documentation. Now it became quite useless.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-11-12 16:08:32 -02:00
Tiago Vignatti
008760822b configure: Make documentation option work in fact
Also, now doxygen is mandatory for building the documentation (looks
reasonable because both man-pages and publican will need it).

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-10-15 13:10:08 -04:00
Ander Conselvan de Oliveira
775002c6c0 Introduce libwayland-cursor, a cursor helper library
The purpose of this library is to be the equivalent of libXcursor in
the X world. This library is compatible with X cursor themes and loads
them directly into an shm pool making it easy for the clients to get
buffer for each cursor image.

The code for handling the X cursor theme was taken from libXcursor. The
files cursor/xcursor.[ch] are a stripped down version of that library
containing only the interfaces necessary for implementing the wayland
counterpart.
2012-05-22 15:20:13 -04:00
Kristian Høgsberg
ab0c7c58b9 Add tests subdir to toplevel SUBDIRS variable
Artie spotted this.
2012-03-03 00:40:12 -05:00
Peter Hutterer
c3d56a05c6 Hook up autotools for publican
automake doesn't seem to provide a sensible method to install a directory of
stuff in $(docdir). Do it manually then.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-29 12:46:00 +10:00
Peter Hutterer
015c42e1b1 protocol: add xslt stylesheet to prettify the protocol
Includes rudimentary styling only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-23 16:03:58 -05:00
Kristian Høgsberg
4c260db68c Rename source subdir from wayland to src 2011-08-12 16:25:14 -04:00
Rico Tzschichholz
8105d2873c Add wayland-scanner.mk to EXTRA_DIST for make distcheck 2011-02-25 08:43:14 -05:00
Kristian Høgsberg
fcfb4e30a4 Split into a core repository that only holds the core Wayland libraries 2011-02-14 22:21:13 -05:00
Javier Jardón
5b7e43ac56 Update autotools configuration
Use new libtool syntax and cleaning the code a bit
2010-11-06 21:04:03 -04:00
Kristian Høgsberg
f0152daad7 Use automake 2010-10-12 18:00:16 -04:00