weston/shared
Pekka Paalanen 32a790f774 shared: add WESTON_EXPORT_FOR_TESTS
This is a new function exporting macro that intends to make writing unit
tests in the Weston test suite easier.

A test needs to access a private function to be able to verify its
behavior. Previously we have used things like putting such functions in
a separate .c file and then building that file into the corresponding
test. That is a bit awkward and can lead to proliferation of arbitrary
.c files for no good reason. It may also require pre-processor magic,
and sometimes copying chunks of code causing a risk of deviating the
code being tested from the code actually used.

This patch proposes another approach: a private export from a DSO.
Except, private exports do not really exist, and this is just a normal
export with a specific C macro, and omitting the function from public
headers.

Once exported, a test program can link the DSO during build, be that a
shared library or even a plugin, use the private header declaring the
function, and simply call the function in the test.

The declaration of WESTON_EXPORT_FOR_TESTS is in shared/helpers.h so
that it is available to all components equally while still not being in
a public header. Other places that were considered:

- include/libweston/libweston.h is a public header, but external users
  should not know about the macro.

- libweston/libweston-private.h is too private and not available to all
  components, particularly color-lcms plugin.

- libweston/backend.h is not appropriate for color-lcms plugin either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-01 13:32:15 +00:00
..
cairo-util.c clients: don't use deprecated fontconfig aliases 2021-11-18 10:57:16 +02:00
cairo-util.h xwm: Fix icon surface ownership 2018-02-09 17:01:09 +00:00
config-parser.c config-parser: use zalloc() 2020-11-27 14:44:10 +02:00
fd-util.h libweston: Support zwp_surface_synchronization_v1.set_acquire_fence 2019-02-06 12:21:56 +00:00
file-util.c clients: Fix/resolved doxygen warnings 2019-06-25 14:05:54 +00:00
file-util.h file-util: allow specifying path separately in file_create_dated() 2018-02-09 15:16:07 +00:00
frame.c xwm: Fix icon surface ownership 2018-02-09 17:01:09 +00:00
helpers.h shared: add WESTON_EXPORT_FOR_TESTS 2022-03-01 13:32:15 +00:00
image-loader.c image-loader: Fix undefined left shift in premultiply_data 2019-10-16 16:06:06 -04:00
image-loader.h shared: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
matrix.c Rename matrix.h to libweston/matrix.h 2019-04-18 12:31:46 +03:00
meson.build libweston: Introduce a safer wayland signal emission 2021-12-14 17:55:06 +00:00
option-parser.c option-parser: Make bools boolean 2019-11-28 19:24:13 +00:00
os-compatibility.c shared: fix typos 2021-02-24 10:00:32 -05:00
os-compatibility.h shared: add read-only anonymous file abstraction 2019-11-01 02:44:58 +01:00
platform.h Fix indentation all through the project 2021-07-31 15:28:20 +00:00
shell-utils.c desktop-shell, kiosk-shell: Migrate helpers to create a view to shell-utils 2021-11-02 19:32:24 +02:00
shell-utils.h desktop-shell, kiosk-shell: Migrate helpers to create a view to shell-utils 2021-11-02 19:32:24 +02:00
signal.c libweston: Introduce a safer wayland signal emission 2021-12-14 17:55:06 +00:00
signal.h libweston: Introduce a safer wayland signal emission 2021-12-14 17:55:06 +00:00
string-helpers.h shared: add str_printf() 2021-07-22 22:19:17 +00:00
timespec-util.h timespec: Don't return value from void function 2019-06-11 11:31:04 +01:00
weston-drm-fourcc.h gl-renderer: add support for (a|x)bgr16161616 shm formats 2022-02-02 11:58:58 +00:00
weston-egl-ext.h gl-renderer: query DRM device given an EGLDisplay 2021-11-25 10:47:39 -03:00
xalloc.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
xalloc.h Rename zalloc.h to libweston/zalloc.h 2019-04-18 12:31:46 +03:00