Commit graph

197 commits

Author SHA1 Message Date
Bryce Harrington 61a6436ae0 tests: Add an xmalloc helper function
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-05-21 15:05:28 -07:00
Bryce Harrington c1a1d6cecf tests: Add client helper routines for output and reference filenames
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-05-21 15:05:20 -07:00
Bryce Harrington e75e7a5b06 tests: Add error handling for system calls
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-05-21 15:04:58 -07:00
Bryce Harrington a20db38437 tests: Fix Samsung copyright assignment on xwayland test 2015-05-05 11:16:51 -07:00
Derek Foreman 29612053e5 tests: fix typo
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-05-02 08:32:46 -07:00
Pekka Paalanen 46804ca5dd tests: add ivi_layout stand-alone test module
This is the ivi_layout stand-alone test controller module that does not
require any clients to run. Therefore it is much simpler than
ivi_layout-test-plugin.c and does not need a matching part in
ivi_layout-test.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-04-09 09:27:47 +03:00
Pekka Paalanen f5b74f7ded tests: ivi_layout test infrastructure
Testing the ivi_layout API requires two things:
- the tests must be written as a controller module to access the API
- the tests need a helper client to create some objects that can then be
  managed via the API

This patch adds all the infrastructure and two different kinds of
example tests.

Internal ivi-shell (ivi_layout) API tests are listed as ivi-*.la files
in TESTS in Makefile.am. Weston-tests-env detects these, and runs Weston
with ivi-shell, and loads the given module as a controller module, not
as a normal plugin.

The test controller module ivi-*.la will launch a helper client. For
ivi-layout-test.la the helper client is ivi-layout.ivi.

The helper client uses the weston-test-runner framework to fork and exec
each TEST with a fresh connection to the compositor.

The actual test is triggered by the weston_test_runner protocol
interface, a new addition to weston-test.xml. The helper client uses
weston_test_runner to trigger a test, and the server side of the
interface is implemented by the test controller module
(ivi-layout-test.la).

The server side of weston_test_runner uses the same trick as
weston-test-runner.h to gather a list of defined tests. A test is
defined with the RUNNER_TEST macro.

If a test defined by RUNNER_TEST succeeds, an event is sent to the
helper client that it can continue (or exit). If a test fails, a fatal
protocol error is sent to the helper client.

Once the helper client has iterated over all of its tests, it signals
the batch success/failure via process exit code. That is cought in the
test controller module, and forwarded as Weston's exit code.

In summary: each ivi_layout test is a combination of a client side
helper/setup and server side actual tests.

v2: Load weston-test.so, because create_client() needs it.

v3: add a comment about IVI_TEST_SURFACE_ID_BASE.

v4: Rebased to upstream weston-tests-env changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> (v2)
2015-04-09 09:27:05 +03:00
Pekka Paalanen 0eb09412b3 tests: add a basic ivi-shell test
This simply tests that Weston starts with ivi-shell, and ivi_application
is present.

Changes in v3:
- Rebased to upstream weston-tests-env changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> (v2)
2015-04-09 09:25:44 +03:00
Bryce Harrington b9ec2be5a1 tests: Prefer bracket form of test command for consistency
Also use variable default assignment to eliminate an if clause

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-07 14:29:24 +03:00
Bryce Harrington 69eb737a33 tests: Cleanup test log filenames
The log files were being named like:

	surface-global-test.la-log.txt
	surface-global-test.la-serverlog.txt
	surface-test.la-log.txt
	surface-test.la-serverlog.txt
	text.weston-log.txt
	text.weston-serverlog.txt

For consistency, omit the test filename's extension (.la/.so).

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-04-07 12:41:30 +03:00
Bryce Harrington 63b1ee9351 tests: Keep track of basename
basename returns the filename without path information (but with
the file extension).  We can get this more efficiently via shell
variables.

Also, for the socket name, use the test's name without the file
extension.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
[Pekka: rebased without "tests: Support --config to enable tests to
override config defaults".]
2015-04-07 12:40:02 +03:00
Pekka Paalanen 4ac06ff97e tests: rename client_create to create_client_and_test_surface
A more descriptive name to not be confused with create_client().

v2: Rebased: fix also devices-test.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2015-04-02 12:54:27 +03:00
Pekka Paalanen 1ffd4615e8 tests: introduce create_client()
Introduce a new helper create_client(), which creates and initializes
the client struct, but does not create a wl_surface.

This will be useful for ivi-shell tests.

v2: Rebased, and restored the dependency to weston-test.so, since seat
handling requires it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2015-04-02 12:54:04 +03:00
Marek Chalupa 5fd814090e tests: add tests for devices handling
Test misc races when adding/releasing devices

v2.: use one roundtrip after releasing devices
     add touch support

v3.: remove useless checks
     add few comments
     repeat tests 30 times instead of 100 times
     (it took too long, 30 is enough)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-31 11:11:59 +03:00
Marek Chalupa 8a5523c3ec tests: implement touch in test-helpers
Let the client bind to wl_touch. Since we have our own seat,
we know that the compositor will have wl_touch capability.

v2: rebased due to changes in previous commit

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-31 11:11:59 +03:00
Marek Chalupa c3c3fc411e tests: use special seat
When running on different backends, we don't know what devices
the backend provides. Create new seat for tests that contains
everything what we need. This is also first step in adding
touch support for tests.

v2: do not add devices in wl_seat.name event. Collect first
    all wl_seats and then pick the one that we need and
    destroy the rest. The effect is the same, but this code
    is better understandable.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-31 11:11:52 +03:00
Marek Chalupa 643d85f76d tests: fix handling globals
We used hard-coded version 1 for all globals. For testing
newer methods and events we need use the current version
of global. This patch fixes this and adds missing
event handlers (for the events that were added in
versions > 1)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-31 10:12:57 +03:00
Marek Chalupa c8daf77f91 weston-test: add device_{release/add} into protocol
This request simulates device creation/destruction from evdev (libinput)

v2: added support for touch. Touch is not supported yet,
    but better be prepared

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-31 10:12:39 +03:00
Pekka Paalanen fb7069ee05 tests: use MODDIR in weston-tests-env
Make a little short-hand for the module directory.

This also cleans up the redefinition of BACKEND in the script.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-27 09:37:56 +02:00
Jonny Lamb abff883d2c platform: rename create_egl_window to create_egl_surface
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 4bdcb5732b clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:57:24 -07:00
Jonny Lamb 51a7ae5f89 clients & tests: use eglGetPlatformDisplayEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:56:38 -07:00
Marek Chalupa a413ff897d tests: use two roundtrips for global events
first is for getting and binding to globals and the other one is for
getting wl_shm.formats that are emitted after binding
to wl_shm

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-19 16:17:20 +02:00
Pekka Paalanen 312fe5f445 surface-screenshot: a new manual test module
Add a new Weston plugin under tests/ for manual testing of the
surface-shooting API.

The debug key binding 'h' triggers a surface shot from the surface that
currently has the pointer focus. The shot is written in PAM format into
a file. PAM format was chosen because it is dead-simple to write from
scratch and can carry an RGBA format.

Changes in v2:
- check fprintf calls, fix a malloc without free
- remove stride and format arguments from the API

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-02-25 14:48:02 +02:00
Derek Foreman f6a65928a8 tests: Rename wayland-test to weston-test
wayland-test isn't and will never be wayland protocol, it's weston internal.

Renamed wayland-test to weston-test, and wl_test to weston_test.

Also added a Big Fat Warning to the description of weston_test to try to
keep people from thinking it's a good idea to use some of these functions
outside of testing.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-24 11:26:29 -08:00
Daniel Stone e78977196c tests: Include weston-egl-ext from weston-test
weston-test uses eglBindWaylandDisplayWL and friends, which are defined
either by the EGL implementation, or weston-egl-ext.h as a fallback.
Include weston-egl-ext.h from weston-test, so we can build on systems
whose native EGL implementation doesn't give us the needed defines.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
2015-02-12 19:30:35 -08:00
Derek Foreman 8771a14ff3 xwayland-test: Replace the xwayland-test
The old xwayland-test hasn't worked in a while...

This new test checks that the wayland specific WL_SURFACE_ID atom exists,
checks that the window manager name is "Weston WM" and then maps a window
and waits for an exposure event.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-30 12:21:39 -08:00
Derek Foreman 9bb133990a tests: Skip buffer count test if wl_drm isn't present
This skips the test when running on the headless backend.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
(Presumably) Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2015-01-23 18:16:48 -08:00
Pekka Paalanen 63495864d3 tests, clients: add Presentation feedback flags
Decode the new feedback flags.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-01-20 17:13:27 -08:00
Bryce Harrington cb50ed226b tests: Fix minor typo 2014-12-10 18:33:47 -08:00
Bryce Harrington 2cd82b7692 tests: Use one shared xzalloc implementation
Since this is an inlined function, move it to a common header file.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-28 15:57:55 +02:00
Bryce Harrington 22ea306ce2 tests: Move ARRAY_LENGTH to a shared header for reuse
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-28 15:56:45 +02:00
Bryce Harrington a76802685a tests: Cleanup superfluous headers
Mostly remove headers that aren't actually needed for anything.
Add stdint.h to permit dropping xf86drm.h, which is otherwise unneeded.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-28 15:54:31 +02:00
Bryce Harrington 12cc4055ff tests: Include "config.h" as first header
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-11-28 15:52:56 +02:00
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