Commit Graph

163 Commits

Author SHA1 Message Date
Derek Foreman 6bef237943 tests: Allow tests to use customized command line parameters
Tests will now return the extra command line parameters they need
when run with --params

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-24 12:21:05 +02:00
Pekka Paalanen 3c5f1c76b2 tests: add role conflict sub-surface vs. wl_shell_surface
Add tests for triggering the role conflict when a wl_surface is already
a wl_shell_surface and then attempted to be made into a sub-surface, and
vice versa.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-10-08 13:16:40 +03:00
Pekka Paalanen de7f5c8fda tests: presentation test, simple
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-30 13:02:20 +03:00
Derek Foreman 086b987be4 matrix-test: fix units in report
The matrix-test speed tests are calculated in ns but some printed the
units as us

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-05 11:32:36 +03:00
Derek Foreman c7210434d4 tests: allow running make check without make install
desktop shell and weston keyboard both refer to themselves prefixed by
LIBEXECDIR, however this is only valid once installed.  make check will
currently either fail or run pre-existing versions.

This patch adds a way to override that location by setting the env var
WESTON_BUILD_DIR - which is then set by the test env script so make check
will test the versions in the build directory regardless of whether they're
installed or not.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 17:47:33 +03:00
Marek Chalupa 42ebdda446 weston-test: check if resource is not NULL
and post client_no_memory if is...

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 14:24:39 +03:00
Giulio Camuffo 412e6a59eb compositor: keep track of the weston_layer a weston_view is in
This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
2014-07-23 12:34:33 -07:00
Marek Chalupa cfff312204 tests: use expect_protocol_error in tests
Turn FAIL_TESTs to TESTs. FAIL_TESTs are bad...

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-22 19:16:49 +03:00
Marek Chalupa 1740aa8c85 tests: add frame_callback_wait_nofail
With expect_protocol_error, we need a possibility to wait for a frame
without aborting the test when wl_display_dispatch returns -1;
This patch adds function frame_callback_wait_nofail that only
returns 1 or 0 (instead of aborting on error).

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-22 19:15:28 +03:00
Marek Chalupa 4d06d46ace tests: add expect_protocol_error function
This function checks if a particular protocol error came in wire.
It's usefull in the cases where we hitherto used FAIL_TEST.
The problem with FAIL_TEST is that *any* assert will pass the test,
but we want only some asserts to pass the test (i. e. we don't
want the test to pass when it, for example, can't connect to display).
FAIL_TESTs are good only for sanity testing.

The expect_protocol_error allows us to turn all FAIL_TESTs to TESTs
as will be introduced in following patches.

v2: fixed white-space error and a mistake in comment

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2014-07-22 19:14:54 +03:00
Pekka Paalanen c2b74fb849 tests: load the right shell plugin
Again, load the shell plugin with full path, rather than possibly find an
old version from a previous installation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-05-09 15:00:32 -07:00
Pekka Paalanen 6ea0d176d6 tests: load the right xwayland plugin
If we do not specify the full path to xwayland.so, Weston can find an
old one installed in a $prefix and use that instead of the freshly built
one.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-05-09 15:00:14 -07:00
Pekka Paalanen 412e58a240 tests: use --no-config
Use --no-config to avoid loading arbitrary weston.ini files from unit
tests. It may affect the unit test results.

I actually hit the following case:

[13:34:04.636] Using config file '/home/pq/local/etc/weston.ini'
[13:34:04.636] Loading module '/home/pq/git/weston/.libs/headless-backend.so'
[13:34:04.637] launching '/home/pq/local/libexec/weston-keyboard'
[13:34:04.644] Loading module '/home/pq/local/lib/weston/desktop-shell.so'
[13:34:04.644] Loading module '/home/pq/local/lib/weston/xwayland.so'
[13:34:04.648] unlinking stale lock file /tmp/.X1-lock
[13:34:04.648] xserver listening on display :1
[13:34:04.648] Loading module '/home/pq/git/weston/.libs/./xwayland.so'
[13:34:04.648] xserver listening on display :2
[13:34:04.648] Module '/home/pq/local/lib/weston/xwayland.so' already loaded

Weston tries to load xwayland module three times, or which twice it
succeeds. This might not make the xwayland test end well. Or at all,
actually.

Adding --no-config should remove one of these loads of xwayland.so.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-05-09 15:00:06 -07:00
Marek Chalupa 06f2fa1a60 tests: fix bad-buffer-test
bad-buffer-test is FAIL_TEST and every assert() (or even SIGSEGV signal)
make it pass. It shouldn't be so for example when assert() is invoked
when a client couldn't connect to display.

Make sure that only relevant asserts make the test pass
and the other make it fail (by returning 0)
2014-04-16 22:31:44 -07:00
Andrew Wedgbury 9cd661e746 Make sure config.h is included before any system headers
There was an issue recently in screen-share.c where config.h was not
being included, resulting in the wrong definition for off_t being used on
32 bit systems. I checked and I don't think this problem is happening
elsewhere, but to help avoid this sort of problem in the future, I went
through and made sure that config.h is included first whenever system
headers are included.

The config.h header should be included before any system headers, failing
to do this can result in the wrong type sizes being defined on certain
systems, e.g. off_t from sys/types.h

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
2014-04-07 10:22:28 -07:00
Emilio Pozuelo Monfort dae8a4b9c5 tests: Properly report skipped tests
We were calling exit(0) when tests were skipped, which counted
them as passed instead of skipped. Fix this by properly exiting
with 77 (which is what automake expects for skipped tests) from
the tests themselves, then returning 77 again from weston-test-runner
if all the tests were skipped. Finally the weston-test.so module
catches weston-test-runner's exit code and uses it as an exit code,
which is what automake will see and use.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2014-02-18 13:50:29 -08:00
Emilio Pozuelo Monfort 943cb12075 tests: use the headless backend to run the test suite
Other backends can be used by passing BACKEND=some-backend.so, e.g.

    $ make check BACKEND=x11-backend.so

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2014-02-18 13:50:24 -08:00
Emilio Pozuelo Monfort 08dbd31c4b tests: Skip buffer-count if EGL initialization fails
That is the case when using the headless backend. In the future
we may be able to use the mesa null egl platform but for now let's
just skip it.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2014-02-18 13:49:37 -08:00
Quentin Glidic 088ba5e475 Makefile.am: Fix protocol source files usage
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2014-02-01 21:21:39 -08:00
Kristian Høgsberg 1e80afa36c build: Move tests/Makefile.am into toplevel Makefile.am 2014-02-01 01:04:32 -08:00
Kristian Høgsberg 396a9bb995 build: Use subdir-objects automake option
This makes automake place the object files in the same subdir as the
source file.  For a recursive build system as we have now, there's
no difference, but with a non-recursive build system it means that
the object files don't all end up in the toplevel directory.
2014-01-31 23:49:33 -08:00
Bryce W. Harrington d716754cfb gitignore: Generated files text-client-protocol.h, text-protocol.c
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-01-17 11:32:01 -08:00
Pekka Paalanen 73e9f86e2c tests: fix build on rpi with EGL
This patch fixes the compiler errors:

  CC     weston_test_la-weston-test.lo
weston-test.c:34:21: fatal error: EGL/egl.h: No such file or directory

  CC     buffer-count-test.o
buffer-count-test.c:30:21: fatal error: EGL/egl.h: No such file or directory

On rpi, the EGL headers are not in the standard path.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-01-08 21:30:20 -08:00
Pekka Paalanen ca6bd745b8 tests: Only run buffer-count test on Mesa >= 10.1
Comment #2 in the bug report says Mesa 10.0 branch does not have the
fix, and indeed buffer-count test fails on Mesa 10.0.1. Fix the test to
require Mesa 10.1 or later.

Now I correctly get:
	mesa version too old (OpenGL ES 3.0 Mesa 10.0.1 (git-12484d2))

https://bugs.freedesktop.org/show_bug.cgi?id=72835

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-01-08 21:27:53 -08:00
Kristian Høgsberg 42284f5f9e tests: Only run buffer-count test if we have at least mesa 10
https://bugs.freedesktop.org/show_bug.cgi?id=72835
2014-01-01 17:38:04 -08:00
Kristian Høgsberg f3fa832796 build: Move clients libexec_PROGRAMS under BUILD_CLIENTS conditional
All the libexec programs are only built when BUILD_CLIENTS is true,
so we can just assign libexec_PROGRAMS under the condition.  This lets us
drop most of the variable assignments and simplify it a bit.

https://bugs.freedesktop.org/show_bug.cgi?id=72812
2014-01-01 13:52:20 -08:00
Neil Roberts 40c0c3f91e tests: Test whether a simple EGL main loop uses too many buffers
This adds a test that tries to simulate a simple game loop that would
be like this:

while (1) {
        draw_something();
        eglSwapBuffers();
}

In this case the test is relying on eglSwapBuffers to throttle to a
sensible frame rate.

The test then verifies that only 2 EGL buffers are used. This is done
via a new request and event in the wayland-test protocol.

Currently this causes 3 buffers to be created because the release
event generated by the swap buffers is not processed by Mesa until it
blocks for the frame complete event in the next swap buffers call, but
that is too late.

This can be fixed in Mesa by issuing a sync request after the swap
buffers and blocking on it before deciding whether to allocate a new
buffer.
2013-12-07 22:26:23 -08:00
Jason Ekstrand 918f2dd4cf Remove the weston_view.geometry.width/height fields
This has a couple of additional implications for the internal weston API:
 1) weston_view_configure no longer exists.  Use weston_view_set_position
    instead.
 2) The weston_surface.configure callback no longer takes a width and
    height.  If you need these, surface.width/height are set before
    configure is called.  If you need to know when the width/height
    changes, you must track that yourself.
2013-12-02 22:17:58 -08:00
Tomeu Vizoso 0f0a6ffc2e Remove dependency on <GLES2/gl2.h> by replacing GLfloat with float 2013-11-27 22:49:31 -08:00
Kristian Høgsberg d2c9d8af50 configure.ac: Make libdrm optional in weston-launch
If libdrm is available, weston-launch and launcer-util.c will support
getting the drm device and setting and dropping drm master, otherwise
we'll only support getting input devices.
2013-11-24 15:16:23 -08:00
Kristian Høgsberg 89eebb7ceb tests: Remove an unecessary Makefile.am variable 2013-11-23 12:59:27 -08:00
Kristian Høgsberg 9ab771d6d5 tests: Use a helper library for weston-test clients 2013-11-23 12:53:16 -08:00
Kristian Høgsberg 8e293a5adb tests: Use TEST_CLIENT for test client modules
We abused SIMPLE_CLIENT_LIBS before, but if you disable simple clients,
the test suite fails to link.  Use test client specific variables instead.

https://bugs.freedesktop.org/show_bug.cgi?id=71530
2013-11-23 12:40:34 -08:00
Pekka Paalanen b9eae3369b tests: .gitignore log files 2013-11-21 21:47:29 -08:00
Pekka Paalanen f72e4797f4 tests: allow weston test plugin to keep on running
If the environment variable WESTON_TEST_CLIENT_PATH is not set, do not
quit Weston in the test plugin.

This allows one to start Weston with the test plugin manually, and then
run any tests also manually, while observing Weston's behaviour over
time. This is useful for:
- Running a test multiple times and checking if Weston leaks (e.g. with
  Valgrind)
- Running tests manually on a backend that is not x11 or wayland,
  especially the backends that require weston-launch, and therefore
  cannot be used with the 'make check' machinery.

This change should not affect 'make check' behaviour, because there
WESTON_TEST_CLIENT_PATH is always set.

Cc: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-11-21 21:47:28 -08:00
Pekka Paalanen f812477fc0 tests: add a test causing SIGBUS to the compositor
This tests the wl_shm buffer access wrappers, that are supposed to catch
the invalid accesses to a memory-mapped file beyond EOF.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-11-21 21:47:19 -08:00
Pekka Paalanen a662206e71 protocol: move sub-surfaces to Wayland
This reverts commit 2396aec684.

This exact version of the sub-surface protocol has been copied into
Wayland core. Therefore it must be removed from here to avoid build
conflicts and useless duplication.

No other changes to sub-surface protocol consumers are needed, the
identical API is now offered by libwayland-client and libwayland-server.

The commit adding sub-surfaces to Wayland is:
Author: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

    protocol: add sub-surfaces to the core

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-11-15 16:23:17 -08:00
Kristian Høgsberg ace0a3920e weston-test: Always update transform when moving surface
weston_view_update_transform() will post damage in the old and new
positions of the view and thus make sure we always repaint properly.
In particular, in bug 66133, the test suite moves the surface off
any output and weston_surface_schedule_repaint() in commit fails to
do anything, since the surface is not on any output.

After changing view geometry, we have to either call
weston_compositor_schedule_repaint(), which is what shell.c typically
does, though that repaints all outputs, or call
weston_view_update_transform() to force update the transformation
and queue repaints on affected outputs.

https://bugs.freedesktop.org/show_bug.cgi?id=66133
2013-11-13 21:55:57 -08:00
Jonas Ådahl 80511efe43 tests/.gitignore: Add *.trs
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-28 14:38:23 -07:00
Jason Ekstrand a7af70436b Split the geometry information from weston_surface out into weston_view
The weston_surface structure is split into two structures:

 * The weston_surface structure storres everything required for a
   client-side or server-side surface.  This includes buffers; callbacks;
   backend private data; input, damage, and opaque regions; and a few other
   bookkeeping bits.

 * The weston_view structure represents an entity in the scenegraph and
   storres all of the geometry information.  This includes clip region,
   alpha, position, and the transformation list as well as all of the
   temporary information derived from the geometry state.  Because a view,
   and not a surface, is a scenegraph element, the view is what is placed
   in layers and planes.

There are a few things worth noting about the surface/view split:

 1. This is *not* a modification to the protocol.  It is, instead, a
    modification to Weston's internal scenegraph to allow a single surface
    to exist in multiple places at a time.  Clients are completely unaware
    of how many views to a particular surface exist.

 2. A view is considered a direct child of a surface and is destroyed when
    the surface is destroyed.  Because of this, the view.surface pointer is
    always valid and non-null.

 3. The compositor's surface_list is replaced with a view_list.  Due to
    subsurfaces, building the view list is a little more complicated than
    it used to be and involves building a tree of views on the fly whenever
    subsurfaces are used.  However, this means that backends can remain
    completely subsurface-agnostic.

 4. Surfaces and views both keep track of which outputs they are on.

 5. The weston_surface structure now has width and height fields.  These
    are populated when a new buffer is attached before surface.configure
    is called.  This is because there are many surface-based operations
    that really require the width and height and digging through the views
    didn't work well.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-22 13:34:11 -07:00
Kristian Høgsberg 10ddd97ecf compositor: Remove redundant and not well-defined focus field
It was never clear what this field really did.
2013-10-22 12:40:54 -07:00
Kristian Høgsberg 4c8ce20ba7 weston-test-client-helper: Use wl_fixed_to_double() when printing axis value 2013-10-10 16:50:18 -07:00
Kristian Høgsberg c1b244f61d weston-test-client-helper.c: Assert on failed allocations 2013-10-10 16:50:18 -07:00
Kristian Høgsberg 3b7d841b7e tests: Assert surface creation succeeds 2013-10-10 16:50:18 -07:00
Kristian Høgsberg 1abe0486bb config-parser: Make weston_config_parse() tkae a file name
Take a basename of the config file to parse instead of an fd.
2013-09-21 23:05:45 -07:00
Sam Spilsbury b42fb52537 Added tests for the vertex clipping code.
This tests (via the table-driven testing method) that the correct
number of vertices and also the correct vertices themselves
are generated for an clip box and polygon of up to eight vertices.

Also add a libshared-test.la so that we don't have to build weston-test-runner
all the time
2013-09-16 21:40:34 -07:00
Sam Spilsbury b502126e19 Add support for table-driven testing.
The new TEST_P macro takes a function name and a "data" argument to
point to an arbitrary array of known size of test data. This allows
multiple tests to be run with different datasets. The array is stored
as a void * but advanced by a known size on each iteration.

The data for each invocation of the test is provided as a "data" argument,
it is the responsibility of the test to cast it to something sensible.

Also fixed single-test running to only run the tests specified
2013-09-13 15:19:35 -07:00
Sam Spilsbury db0eda4abb Remove AM_LDFLAGS usage
We are not building everything here as a module, only the test modules.
2013-09-13 15:13:49 -07:00
Peter Hutterer 9715d4db54 tests: list available tests if an invalid test name is given 2013-09-11 13:41:22 -07:00
Peter Hutterer 534f0a4dd1 tests: support -h/--help for the tests
Including listing the tests available in that binary
2013-09-11 13:41:12 -07:00