diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-03-01 18:01:38 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-03-06 06:31:43 -0500 |
commit | e80a9c2cbac3080dad6e55c070c83cac47d6d7f8 (patch) | |
tree | 5f7303c29984e39245be41ed6db7857341aab14f /test cases | |
parent | af9af219d815f157acd2dd4629727fcd90aa9d86 (diff) | |
download | meson-e80a9c2cbac3080dad6e55c070c83cac47d6d7f8.zip meson-e80a9c2cbac3080dad6e55c070c83cac47d6d7f8.tar.gz meson-e80a9c2cbac3080dad6e55c070c83cac47d6d7f8.tar.bz2 |
wayland module: Allow building both client and server sides
- Change `scope` kwarg to `public` boolean default to false.
- Change `side` kwarg to `client` and `server` booleans.
- Document returned values
- Aggregate in a single unit test because have lots of small tests
increases CI time.
Fixes: #10040.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/wayland/1 client/both.c | 11 | ||||
-rw-r--r-- | test cases/wayland/1 client/client.c (renamed from test cases/wayland/1 client/main.c) | 4 | ||||
-rw-r--r-- | test cases/wayland/1 client/local.c (renamed from test cases/wayland/3 local/main.c) | 0 | ||||
-rw-r--r-- | test cases/wayland/1 client/meson.build | 38 | ||||
-rw-r--r-- | test cases/wayland/1 client/server.c | 9 | ||||
-rw-r--r-- | test cases/wayland/1 client/test.xml (renamed from test cases/wayland/3 local/test.xml) | 0 | ||||
-rw-r--r-- | test cases/wayland/2 server/main.c | 9 | ||||
-rw-r--r-- | test cases/wayland/2 server/meson.build | 16 | ||||
-rw-r--r-- | test cases/wayland/3 local/meson.build | 11 |
9 files changed, 57 insertions, 41 deletions
diff --git a/test cases/wayland/1 client/both.c b/test cases/wayland/1 client/both.c new file mode 100644 index 0000000..b6e1bab --- /dev/null +++ b/test cases/wayland/1 client/both.c @@ -0,0 +1,11 @@ +#include "viewporter-client-protocol.h" +#include "viewporter-server-protocol.h" + +int main() { +#if defined(VIEWPORTER_CLIENT_PROTOCOL_H) && \ + defined(VIEWPORTER_SERVER_PROTOCOL_H) + return 0; +#else + return 1; +#endif +} diff --git a/test cases/wayland/1 client/main.c b/test cases/wayland/1 client/client.c index 6aca80d..4966721 100644 --- a/test cases/wayland/1 client/main.c +++ b/test cases/wayland/1 client/client.c @@ -2,8 +2,8 @@ int main() { #ifdef XDG_SHELL_CLIENT_PROTOCOL_H - return 0; + return 0; #else - return 1; + return 1; #endif } diff --git a/test cases/wayland/3 local/main.c b/test cases/wayland/1 client/local.c index 97bfa56..97bfa56 100644 --- a/test cases/wayland/3 local/main.c +++ b/test cases/wayland/1 client/local.c diff --git a/test cases/wayland/1 client/meson.build b/test cases/wayland/1 client/meson.build index 7ca868b..cb13db2 100644 --- a/test cases/wayland/1 client/meson.build +++ b/test cases/wayland/1 client/meson.build @@ -5,12 +5,44 @@ if not wl_protocols_dep.found() error('MESON_SKIP_TEST: wayland-protocols not installed') endif -wl_dep = dependency('wayland-client') +wl_client_dep = dependency('wayland-client') +wl_server_dep = dependency('wayland-server') wl_mod = import('unstable-wayland') +fs = import('fs') +# Client side only xdg_shell_xml = wl_mod.find_protocol('xdg-shell') xdg_shell = wl_mod.scan_xml(xdg_shell_xml) +assert(xdg_shell.length() == 2) +assert(fs.name(xdg_shell[0].full_path()) == 'xdg-shell-protocol.c') +assert(fs.name(xdg_shell[1].full_path()) == 'xdg-shell-client-protocol.h') +exe = executable('client', 'client.c', xdg_shell, dependencies : wl_client_dep) +test('client', exe) -exe = executable('client', 'main.c', xdg_shell, dependencies : wl_dep) +# Server side only +presentation_time_xml = wl_mod.find_protocol('presentation-time') +presentation_time = wl_mod.scan_xml(presentation_time_xml, client : false, server : true) +assert(presentation_time.length() == 2) +assert(fs.name(presentation_time[0].full_path()) == 'presentation-time-protocol.c') +assert(fs.name(presentation_time[1].full_path()) == 'presentation-time-server-protocol.h') +exe = executable('server', 'server.c', presentation_time, dependencies : wl_server_dep) +test('server', exe) -test('client', exe) +# Both sides +viewporter_xml = wl_mod.find_protocol('viewporter') +viewporter = wl_mod.scan_xml(viewporter_xml, client : true, server : true) +assert(viewporter.length() == 3) +assert(fs.name(viewporter[0].full_path()) == 'viewporter-protocol.c') +assert(fs.name(viewporter[1].full_path()) == 'viewporter-client-protocol.h') +assert(fs.name(viewporter[2].full_path()) == 'viewporter-server-protocol.h') +exe = executable('both', 'both.c', viewporter, dependencies : [wl_client_dep, wl_server_dep]) +test('both', exe) + +# Local xml +xmls = files('test.xml') +gen = wl_mod.scan_xml(xmls) +assert(gen.length() == 2) +assert(fs.name(gen[0].full_path()) == 'test-protocol.c') +assert(fs.name(gen[1].full_path()) == 'test-client-protocol.h') +exe = executable('local', 'local.c', gen, dependencies : wl_client_dep) +test('local', exe) diff --git a/test cases/wayland/1 client/server.c b/test cases/wayland/1 client/server.c new file mode 100644 index 0000000..e073a7b --- /dev/null +++ b/test cases/wayland/1 client/server.c @@ -0,0 +1,9 @@ +#include "presentation-time-server-protocol.h" + +int main() { +#ifdef PRESENTATION_TIME_SERVER_PROTOCOL_H + return 0; +#else + return 1; +#endif +} diff --git a/test cases/wayland/3 local/test.xml b/test cases/wayland/1 client/test.xml index f3c6db1..f3c6db1 100644 --- a/test cases/wayland/3 local/test.xml +++ b/test cases/wayland/1 client/test.xml diff --git a/test cases/wayland/2 server/main.c b/test cases/wayland/2 server/main.c deleted file mode 100644 index 3307499..0000000 --- a/test cases/wayland/2 server/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "xdg-shell-server-protocol.h" - -int main() { -#ifdef XDG_SHELL_SERVER_PROTOCOL_H - return 0; -#else - return 1; -#endif -} diff --git a/test cases/wayland/2 server/meson.build b/test cases/wayland/2 server/meson.build deleted file mode 100644 index c93ff11..0000000 --- a/test cases/wayland/2 server/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('wayland-test-server', 'c') - -wl_protocols_dep = dependency('wayland-protocols', required : false) -if not wl_protocols_dep.found() - error('MESON_SKIP_TEST: wayland-protocols not installed') -endif - -wl_dep = dependency('wayland-server') -wl_mod = import('unstable-wayland') - -xdg_shell_xml = wl_mod.find_protocol('xdg-shell') -xdg_shell = wl_mod.scan_xml(xdg_shell_xml, side : 'server') - -exe = executable('server', 'main.c', xdg_shell, dependencies : wl_dep) - -test('client', exe) diff --git a/test cases/wayland/3 local/meson.build b/test cases/wayland/3 local/meson.build deleted file mode 100644 index 7a470d6..0000000 --- a/test cases/wayland/3 local/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('wayland-test-local', 'c') - -wl_dep = dependency('wayland-client') -wl_mod = import('unstable-wayland') - -xmls = files('test.xml') -gen = wl_mod.scan_xml(xmls) - -exe = executable('local', 'main.c', gen, dependencies : wl_dep) - -test('local', exe) |