weston/tests/meson.build

533 lines
12 KiB
Meson
Raw Permalink Normal View History

plugin_test_shell_desktop = shared_library(
'weston-test-desktop-shell',
'weston-test-desktop-shell.c',
include_directories: common_inc,
dependencies: [ dep_libweston_public, dep_libexec_weston ],
name_prefix: '',
install: false
)
env_modmap += 'weston-test-desktop-shell.so=@0@;'.format(plugin_test_shell_desktop.full_path())
lib_test_runner = static_library(
'test-runner',
'weston-test-runner.c',
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
dependencies: [
dep_libweston_private_h_deps,
dep_wayland_client,
CI: Never unload llvmpipe DSO whilst testing This commit is truly horrible. We want to run ASan with leak checking enabled in CI so we can catch memory leaks before they're introduced. This works well with Pixman, and with NIR-only drivers like iris or Panfrost. But when we run under llvmpipe - which we do under CI - we start failing because: - Mesa pulls in llvmpipe via dlopen - llvmpipe pulls in LLVM itself via DT_NEEDED - initialising LLVM's global type/etc systems performs thread-local allocations - llvmpipe can't free those allocations since the application might also be using LLVM - Weston stops using GL and destroys all GL objects, leading to Mesa unloading llvmpipe like it should - with everything disappearing from the process's vmap, ASan can no longer keep track of still-reachable pointers - tests fail because LLVM is 'leaking' Usually, an alternative is to LD_PRELOAD a shim which overrides dlclose() to be a no-op. This is not usable here, because when $LD_PRELOAD is not empty and ASan is not first in it, ASan immediately errors out. Prepending ASan doesn't work, because we run our tests through Meson (which also invokes Ninja), leading to LSan exploding over CPython and Ninja, which is not what we're interested in. It would be possible to inject _both_ ASan and a dlclose-does-nothing shim DSO into the LD_PRELOAD environment for every test, but that seems even worse, especially as Meson strongly discourages globbing for random files in the root. So, here we are, doing what we can: finding where swrast_dri.so (aka llvmpipe) lives, stashing that in an environment variable, and deliberately leaking a dlopen handle which we never close to ensure that neither llvmpipe nor LLVM leave our process's address space before we exit. Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-25 06:59:52 +03:00
dep_libdl,
dep_threads,
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
],
include_directories: common_inc,
install: false,
)
dep_test_runner = declare_dependency(
dependencies: dep_wayland_client,
link_with: lib_test_runner
)
lib_test_client = static_library(
'test-client',
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
[
'weston-test-client-helper.c',
'weston-test-fixture-compositor.c',
weston_test_client_protocol_h,
weston_test_protocol_c,
weston_output_capture_client_protocol_h,
weston_output_capture_protocol_c,
viewporter_client_protocol_h,
viewporter_protocol_c,
xdg_shell_client_protocol_h,
xdg_shell_protocol_c,
'color_util.h',
'color_util.c',
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
],
include_directories: common_inc,
dependencies: [
dep_libshared,
dep_wayland_client,
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
dep_libexec_weston,
dep_libweston_private,
dep_libdrm_headers,
dep_pixman,
dep_threads,
dependency('cairo'),
],
install: false,
)
dep_test_client = declare_dependency(
link_with: lib_test_client,
sources: [
viewporter_client_protocol_h,
],
dependencies: [
dep_wayland_client,
dep_test_runner,
dep_pixman,
dep_libdrm_headers,
dep_threads,
dependency('libudev', version: '>= 136'),
]
)
lib_lcms_util = static_library(
'lib_lcms_util',
[ 'lcms_util.c' ],
include_directories: common_inc,
dependencies: [
dep_lcms2, dep_libm
],
build_by_default: false,
install: false,
)
dep_lcms_util = declare_dependency(
link_with: lib_lcms_util,
dependencies: [ dep_lcms2 ]
)
exe_plugin_test = shared_library(
'test-plugin',
'weston-test.c',
weston_test_server_protocol_h,
weston_test_protocol_c,
include_directories: common_inc,
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
dependencies: [
dep_libexec_weston,
dep_libweston_private,
dep_threads
],
name_prefix: '',
install: false,
)
deps_zuc = [ dep_libshared ]
config_h.set10('ENABLE_JUNIT_XML', get_option('test-junit-xml'))
if get_option('test-junit-xml')
d = dependency('libxml-2.0', version: '>= 2.6', required: false)
if not d.found()
error('JUnit XML support requires libxml-2.0 >= 2.6 which was not found. Or, you can use \'-Dtest-junit-xml=false\'.')
endif
deps_zuc += d
endif
lib_zuc = static_library(
'zunitc',
'../tools/zunitc/inc/zunitc/zunitc.h',
'../tools/zunitc/inc/zunitc/zunitc_impl.h',
'../tools/zunitc/src/zuc_base_logger.c',
'../tools/zunitc/src/zuc_base_logger.h',
'../tools/zunitc/src/zuc_context.h',
'../tools/zunitc/src/zuc_event.h',
'../tools/zunitc/src/zuc_event_listener.h',
'../tools/zunitc/src/zuc_junit_reporter.c',
'../tools/zunitc/src/zuc_junit_reporter.h',
'../tools/zunitc/src/zuc_types.h',
'../tools/zunitc/src/zunitc_impl.c',
include_directories: [ common_inc, include_directories('../tools/zunitc/inc') ],
dependencies: deps_zuc,
)
dep_zuc = declare_dependency(
link_with: lib_zuc,
dependencies: dep_libshared,
include_directories: include_directories('../tools/zunitc/inc')
)
lib_zucmain = static_library(
'zunitcmain',
'../tools/zunitc/src/main.c',
include_directories: [ common_inc, include_directories('../tools/zunitc/inc') ],
dependencies: [ dep_libshared, dep_zuc ],
)
dep_zucmain = declare_dependency(
link_with: lib_zucmain,
dependencies: dep_zuc
)
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
tests = [
{
'name': 'alpha-blending',
'dep_objs': dep_libm,
},
{ 'name': 'assert', },
{ 'name': 'bad-buffer', },
{ 'name': 'buffer-transforms', },
{
'name': 'color-metadata-errors',
'dep_objs': dep_libexec_weston,
},
{
'name': 'constraints',
'sources': [
'constraints-test.c',
pointer_constraints_unstable_v1_protocol_c,
],
},
{ 'name': 'custom-env', },
{ 'name': 'devices', },
{
'name': 'drm-formats',
'dep_objs': dep_libdrm_headers,
},
{ 'name': 'drm-smoke', 'run_exclusive': true },
{ 'name': 'drm-writeback-screenshot', 'run_exclusive': true },
{ 'name': 'event', },
{ 'name': 'internal-screenshot', },
{
'name': 'keyboard',
'sources': [
'keyboard-test.c',
'input-timestamps-helper.c',
input_timestamps_unstable_v1_client_protocol_h,
input_timestamps_unstable_v1_protocol_c,
],
},
{
'name': 'kiosk-shell',
'sources': [
'kiosk-shell-test.c',
xdg_shell_client_protocol_h,
xdg_shell_protocol_c,
],
},
{
'name': 'linux-explicit-synchronization',
'sources': [
'linux-explicit-synchronization-test.c',
linux_explicit_synchronization_unstable_v1_client_protocol_h,
linux_explicit_synchronization_unstable_v1_protocol_c,
],
},
{
'name': 'matrix',
'dep_objs': [ dep_libm ]
},
{
'name': 'matrix-transform',
'dep_objs': dep_libm,
},
{
'name': 'output-capture-protocol',
'sources': [
'output-capture-protocol-test.c',
weston_output_capture_protocol_c,
weston_output_capture_client_protocol_h,
],
'dep_objs': [ dep_libdrm_headers ],
},
{ 'name': 'output-damage', },
{ 'name': 'output-decorations', },
tests: add output transform tests This goes through all output transforms with two different buffer transforms and verifies the visual output against reference images. This commit introduces a new test input image 'basic-test-card.png'. It is a small image with deliberately odd and indivisible dimensions to provoke bad assumptions about image sizes. It contains red, green and blue areas which are actually text that makes it very obvious if you have e.g. color channels swapped. It has a white thick circle to highlight aspect ratio issues, and an orange cross to show a mixed color. The white border is for contrast and a 1px wide detail. The whole design makes it clear if the image happens to be rotated or flipped in any way. The image has one pixel wide transparent border so that bilinear sampling filter near the edges of the image would produce the same colors with both Pixman- and GL-renderers which handle the out-of-image samples fundamentally differently: Pixman assumes (0, 0, 0, 0) samples outside of the image, while GL-renderer clamps sample coordinates to the edge essentially repeating the edge pixels. It would have been "easy" to create a full matrix of every output scale & transform x every buffer scale & transform, but that would have resulted in 2 renderers * 8 output transforms * 3 output scales * 8 buffer transforms * 3 buffer scales = 1152 test cases that would have all ran strictly serially because our test harness has no parallelism inside one test program. That would have been slow to run, and need a lot more reference images too. Instead, I chose to iterate separately through all output scales & transforms (this patch) and all buffer scales & transforms (next patch). This limits the number of test cases in this patch to 56, and allows the two test programs to run in parallel. I did not even pick all possible scale & transform combinations here, but just what I think is a representative sub-set to hopefully exercise all the code paths. https://gitlab.freedesktop.org/wayland/weston/issues/52 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-21 13:00:28 +03:00
{ 'name': 'output-transforms', },
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
{ 'name': 'plugin-registry', },
{ 'name': 'paint-node', },
{
'name': 'pointer',
'sources': [
'pointer-test.c',
'input-timestamps-helper.c',
input_timestamps_unstable_v1_client_protocol_h,
input_timestamps_unstable_v1_protocol_c,
],
},
{ 'name': 'pointer-shot', },
{
'name': 'presentation',
'sources': [
'presentation-test.c',
presentation_time_client_protocol_h,
presentation_time_protocol_c,
],
},
{
'name': 'roles',
'sources': [
'roles-test.c',
xdg_shell_client_protocol_h,
xdg_shell_protocol_c,
],
},
{
'name': 'single-pixel-buffer',
'sources': [
'single-pixel-buffer-test.c',
single_pixel_buffer_v1_client_protocol_h,
single_pixel_buffer_v1_protocol_c,
]
},
{ 'name': 'string', },
{ 'name': 'subsurface', },
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
{ 'name': 'subsurface-shot', },
{ 'name': 'surface', },
{ 'name': 'surface-global', },
{
'name': 'text',
'sources': [
'text-test.c',
text_input_unstable_v1_client_protocol_h,
text_input_unstable_v1_protocol_c,
],
},
{
'name': 'touch',
'sources': [
'touch-test.c',
'input-timestamps-helper.c',
input_timestamps_unstable_v1_client_protocol_h,
input_timestamps_unstable_v1_protocol_c,
],
},
{ 'name': 'viewporter', },
{ 'name': 'viewporter-shot', },
{
'name': 'yuv-buffer',
'dep_objs': [
dep_libdrm_headers,
dep_libm,
],
},
{ 'name': 'safe-signal', },
{ 'name': 'safe-signal-output-removal',
'sources': [
'safe-signal-output-removal-test.c',
],
'dep_objs': [ dep_libweston_public ]
},
{ 'name': 'iterate-debug-scopes',
'sources': [
'iterate-debug-scopes-test.c',
],
'dep_objs': [ dep_libweston_public ]
},
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
]
if get_option('renderer-gl')
tests += {
'name': 'vertex-clip',
'link_with': plugin_gl,
}
endif
if get_option('color-management-lcms')
if not dep_lcms2.found()
error('color-management-lcms tests require lcms2 which was not found. Or, you can use \'-Dcolor-management-lcms=false\'.')
endif
tests += [
{
'name': 'color-icc-output',
tests/color-shaper-matrix: add creation and usage cLUT profiles Added cLUT profile creation to validate linearization algorithm for DToB3 tag (direction dev to PCS). The 3DLUT is built by using raw matrix conversion from dev to XYZ and reverse (XYZ to device). The test uses floating point pipeline, known as unbounded mode of LCMS. The details are described in ICCSpecRevision_02_11_06_Float.pdf The purpose of these new test cases is to keep the GL-renderer 3D LUT path tested even after color-lcms and GL-renderer start using specialized matrix-shaper paths. These also exercise build_eotf_from_clut_profile() in color-lcms, but do not actually verify it. These cases only test that the recovered EOTF and its inverse produce an identity mapping together. BT.2020 is not used in these tests, because the RGB-XYZ conversion matrix does not stay inside [0.0, 1.0] in either direction, which would be a problem for the 3D LUT element in the multiProcessingElement pipelines. Handling that would have been possible, but testing with AdobeRGB color space should suffice while keeping the test code from being even more complicated. roundtrip_verification() tests that we succeed in creating cms pipelines correctly in both directions so that the resulting ICC file is better behaved. The Weston test itself only cares about the BToD direction. Credits to: Vladimir Lachine <vladimir.lachine@amd.com> Graeme Gill <graeme@argyllcms.com> Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com> Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-05 02:27:16 +03:00
'dep_objs': [ dep_libm, dep_lcms_util ]
},
{
'name': 'color-lcms-optimizer',
'link_with': plugin_color_lcms,
'dep_objs': [ dep_lcms_util ]
},
{ 'name': 'color-management',
'sources': [
'color-management-test.c',
color_management_v1_client_protocol_h,
color_management_v1_protocol_c,
],
'dep_objs': [ dep_lcms_util ]
},
{ 'name': 'color-metadata-parsing' },
{
'name': 'lcms-util',
'dep_objs': [ dep_lcms_util ]
},
]
endif
tests_standalone = [
['config-parser', [], [ dep_zucmain ]],
['timespec', [], [ dep_zucmain ]],
['zuc',
[
'../tools/zunitc/test/fixtures_test.c',
'../tools/zunitc/test/zunitc_test.c'
],
[ dep_zucmain ]
],
]
if get_option('xwayland')
xcb_dep = dependency('xcb', required: false)
xcb_cursor_dep = dependency('xcb-cursor', required: false)
if not xcb_dep.found() or not xcb_cursor_dep.found()
error('xcb and xcb-cursor required for running xwayland tests')
endif
libxwayland_test_client = static_library(
'test-xwayland-client',
[ 'xcb-client-helper.c', weston_test_client_protocol_h ],
include_directories: common_inc,
dependencies: [
dep_pixman, dep_xcb_xwayland,
xcb_dep, xcb_cursor_dep,
dep_wayland_client,
],
install: false,
)
dep_libxwayland_test = declare_dependency(
dependencies: [ xcb_dep, xcb_cursor_dep ],
link_with: libxwayland_test_client,
)
tests += [ {
'name': 'xwayland',
'dep_objs': dep_libxwayland_test,
} ]
endif
# Manual test plugin, not used in the automatic suite
surface_screenshot_test = shared_library(
'test-surface-screenshot',
'surface-screenshot-test.c',
include_directories: common_inc,
dependencies: [ dep_libweston_private, dep_libshared ],
name_prefix: '',
install: false,
)
if get_option('shell-ivi')
ivi_layout_test_plugin = shared_library(
'test-ivi-layout',
[
'ivi-layout-test-plugin.c',
weston_test_server_protocol_h,
weston_test_protocol_c,
],
include_directories: common_inc,
dependencies: [ dep_libweston_private, dep_libexec_weston ],
name_prefix: '',
install: false,
)
env_modmap += 'test-ivi-layout.so=' + ivi_layout_test_plugin.full_path() + ';'
tests += [
{
'name': 'ivi-layout-client',
'sources': [
'ivi-layout-test-client.c',
ivi_application_client_protocol_h,
ivi_application_protocol_c,
],
'test_deps': [ ivi_layout_test_plugin ],
},
{ 'name': 'ivi-layout-internal', },
{
'name': 'ivi-shell-app',
'sources': [
'ivi-shell-app-test.c',
ivi_application_client_protocol_h,
ivi_application_protocol_c,
],
},
]
endif
test_config_h = configuration_data()
test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
test_config_h.set_quoted('WESTON_DATA_DIR', join_paths(meson.current_source_dir(), '..', 'data'))
test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', exe_plugin_test.full_path())
test_config_h.set10('WESTON_TEST_SKIP_IS_FAILURE', get_option('test-skip-is-failure'))
configure_file(output: 'test-config.h', configuration: test_config_h)
test_env = {}
# there are some leaks in fontconfig we can't fix;
CI: work around LeakSanitizer crashes with use_tls=0 Without this fix, we have randomly been getting CI failures due to LeakSanitizer itself crashing after all the tests in a program have succeeded. This has been happening randomly for a long time, but https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486 made it very reliably repeatable in the job x86_64-debian-full-build (and no other job) in the test-subsurface-shot program. --- Fixture 2 (GL) ok: passed 4, skipped 0, failed 0, total 4 Tracer caught signal 11: addr=0x1b8 pc=0x7f6b3ba640f0 sp=0x7f6b2cc77d10 ==489==LeakSanitizer has encountered a fatal error. I was also able to get a core file after twiddling, but there it ended up with lsan aborting itself rather than a segfault. We got some clues that use_tls=0 might work around this, from https://github.com/google/sanitizers/issues/1342 https://github.com/google/sanitizers/issues/1409 and some other projects that have cargo-culted the same workaround. Using that cause more false leaks to appear, so they need to be suppressed. I suppose we are not interested in catching leaks in glib using code, so I opted to suppress g_malloc0 altogether. Pinpointing it better might have required much more slower stack tracing. wl_shm_buffer_begin_access() uses TLS, so no wonder it gets flagged. ld-*.so is simply uninteresting to us, and it got flagged too. Since this might have been fixed already in LeakSanitizer upstream, who knows, leave some notes to revisit this when we upgrade that in CI. This fix seems to make the branch of https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486 in my quick testing. Suggested-by: Derek Foreman <derek.foreman@collabora.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-04-09 15:41:45 +03:00
# use_tls=0 is a workaround for LeakSanitizer crashing after successful
# program exit when it scans for leaks. Due to use_tls=0 even more
# suppressions had to be added.
# TODO XXX: Try to revert the addition of use_tls=0 when our CI image
# upgrades from Debian Bookworm to something more recent.
if get_option('b_sanitize') in ['address', 'address,undefined' ]
CI: work around LeakSanitizer crashes with use_tls=0 Without this fix, we have randomly been getting CI failures due to LeakSanitizer itself crashing after all the tests in a program have succeeded. This has been happening randomly for a long time, but https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486 made it very reliably repeatable in the job x86_64-debian-full-build (and no other job) in the test-subsurface-shot program. --- Fixture 2 (GL) ok: passed 4, skipped 0, failed 0, total 4 Tracer caught signal 11: addr=0x1b8 pc=0x7f6b3ba640f0 sp=0x7f6b2cc77d10 ==489==LeakSanitizer has encountered a fatal error. I was also able to get a core file after twiddling, but there it ended up with lsan aborting itself rather than a segfault. We got some clues that use_tls=0 might work around this, from https://github.com/google/sanitizers/issues/1342 https://github.com/google/sanitizers/issues/1409 and some other projects that have cargo-culted the same workaround. Using that cause more false leaks to appear, so they need to be suppressed. I suppose we are not interested in catching leaks in glib using code, so I opted to suppress g_malloc0 altogether. Pinpointing it better might have required much more slower stack tracing. wl_shm_buffer_begin_access() uses TLS, so no wonder it gets flagged. ld-*.so is simply uninteresting to us, and it got flagged too. Since this might have been fixed already in LeakSanitizer upstream, who knows, leave some notes to revisit this when we upgrade that in CI. This fix seems to make the branch of https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486 in my quick testing. Suggested-by: Derek Foreman <derek.foreman@collabora.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-04-09 15:41:45 +03:00
test_env += { 'LSAN_OPTIONS': 'use_tls=0:suppressions=@0@'.format(dir_gitlab_ci / 'leak-sanitizer.supp') }
endif
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
foreach t : tests
t_name = 'test-' + t.get('name')
t_sources = t.get('sources', [t.get('name') + '-test.c'])
t_sources += weston_test_client_protocol_h
t_deps = [ dep_test_client, dep_libweston_private_h ]
t_deps += t.get('dep_objs', [])
run_exclusive = t.get('run_exclusive', false)
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
t_exe = executable(
t_name,
t_sources,
c_args: [
'-DTHIS_TEST_NAME="' + t_name + '"',
],
build_by_default: true,
include_directories: common_inc,
dependencies: t_deps,
link_with: t.get('link_with', []),
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
install: false,
)
test(
t.get('name'),
t_exe,
env: test_env,
depends: t.get('test_deps', []),
timeout: 120,
protocol: 'tap',
is_parallel: not run_exclusive
)
tests: thread-based client harness This replaces the old test harness with a new one. The old harness relied on fork()'ing each test which makes tests independent, but makes debugging them harder. The new harness runs client code in a thread instead of a new process. A side-effect of not fork()'ing anymore is that any failure will stop running a test series short. Fortunately we do not have any tests that are expected to crash or fail. The old harness executed 'weston' from Meson, with lots of setup as both command line options and environment variables. The new harness executes wet_main() instead: the test program itself calls the compositor main function to execute the compositor in-process. Command line arguments are configured in the test program itself, not in meson.build. Environment variables aside, you are able to run a test by simply executing the test program, even if it is a plugin test. The new harness adds a new type of iteration: fixtures. For now, fixtures are used to set up the compositor for tests that need a compositor. If necessary, a fixture setup may include a data array of arbitrary type for executing the test series for each element in the array. This will be most useful for running screenshooting tests with both Pixman- and GL-renderers. The new harness outputs TAP formatted results into stdout. Meson is not switched to consume TAP yet though, because it would require a Meson version requirement bump and would not have any benefits at this time. OTOH outputting TAP is trivial and sets up a clear precedent of random test chatter belonging to stderr. This commit migrates only few tests to actually make use of the new features: roles is a basic client test, subsurface-shot is a client test that demonstrates the fixture array, and plugin-registry is a plugin test. The rest of the tests will be migrated later. Once all tests are migrated, we can remove the test-specific setup from meson.build, leaving only the actual build instructions in there. The not migrated tests and stand-alone tests suffer only a minor change: they no longer fork() for each TEST(), otherwise they keep running as before. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-01 15:02:15 +03:00
endforeach
# FIXME: the multiple loops is lame. rethink this.
foreach t : tests_standalone
if t[0] != 'zuc'
srcs_t = [
'@0@-test.c'.format(t.get(0)),
weston_test_client_protocol_h,
]
else
srcs_t = []
endif
if t.length() > 1
srcs_t += t.get(1)
endif
if t.length() > 2
deps_t = t[2]
else
deps_t = [ dep_test_client ]
endif
exe_t = executable(
'test-@0@'.format(t.get(0)),
srcs_t,
build_by_default: true,
include_directories: common_inc,
dependencies: deps_t,
install: false,
)
# matrix-test is a manual test
if t[0] != 'matrix'
test(t.get(0), exe_t)
endif
endforeach
if get_option('backend-drm')
executable(
'setbacklight',
'setbacklight.c',
dependencies: [
dep_backlight,
dep_libdrm,
dependency('libudev')
],
include_directories: common_inc,
install: false
)
endif