Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
cogl_test_conformance_sources = [
|
|
|
|
'test-conform-main.c',
|
|
|
|
'test-atlas-migration.c',
|
|
|
|
'test-blend-strings.c',
|
|
|
|
'test-blend.c',
|
|
|
|
'test-depth-test.c',
|
|
|
|
'test-color-hsl.c',
|
|
|
|
'test-backface-culling.c',
|
|
|
|
'test-just-vertex-shader.c',
|
|
|
|
'test-pipeline-user-matrix.c',
|
|
|
|
'test-pipeline-uniforms.c',
|
|
|
|
'test-pixel-buffer.c',
|
|
|
|
'test-premult.c',
|
|
|
|
'test-snippets.c',
|
|
|
|
'test-wrap-modes.c',
|
|
|
|
'test-sub-texture.c',
|
|
|
|
'test-custom-attributes.c',
|
|
|
|
'test-offscreen.c',
|
cogl/journal: Don't sometimes hold a ref on the framebuffer
d42f1873fcd0876244eb8468d72ce35459ba94ca introduced a semi circular
reference between the CoglFramebuffer, and CoglJournal, where
CoglJournal would keep a reference on the CoglFramebuffer when there
were any entries in the journal log.
To avoid risking leaking these objects indefinitely, when freeing
objects without doing anything that triggered a flush, CoglFramebuffer
had a "filter" on cogl_object_unref() calls, which knew
about under what conditions CoglJournal had a reference to it. When it
could detect that there were only the journal itself holding such a
reference, it'd flush the journal, effectively releasing the reference
the journal held, thus freeing itself, as well as the journal.
When CoglFramebuffer was ported to be implemented using GObject instead
of CoglObject, this "filter" was missed, causing not only awkward but
infrequent leaks, but also situations where we'd flush journals when
only the journal itself held the last reference to the framebuffer,
meaning the journal would free the framebuffer, thus itself, in the
middle of flushing, causing memory corruption and crashes.
A way to detect this, by asserting on CoglObject reference count during
flush, is by adding the `g_assert()` as described below, which will
assert instead cause memory corruption.
void
_cogl_journal_flush (CoglJournal *journal
{
...
_cogl_journal_discard (journal);
+ g_assert (journal->_parent.ref_count > 0);
...
}
Fix this by making CoglFramebuffer the owner of the journal, which it
already was, and remove any circle referencing that was there before, as
it is not needed given that the CoglFramebuffer pointer is guaranteed to
be valid for the lifetime of CoglJournal as the framebuffer is the owner
of the journal.
However, to not miss flushing before tearing down, which is important as
this flushes painting calls to the driver that is important for e.g.
using the result of those journal entries, flush the journal the first
time cogl_framebuffer_dispose() is called, before doing anything else.
This also adds a test case. Without having broken the circular
reference, the test would fail on g_assert_null (offscreen), as it would
have been "leaked" at this point, but the actual memory corruption would
be a result of the `cogl_texture_get_data()` call, which flushes the
framebuffer, and causes the 'mid-flush' destruction of the journal
described above. Note that the texture keeps track of dependent
framebuffers, but it does not hold any references to them.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1474
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1735>
2021-02-18 14:46:28 +00:00
|
|
|
'test-journal.c',
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
'test-primitive.c',
|
|
|
|
'test-sparse-pipeline.c',
|
|
|
|
'test-read-texture-formats.c',
|
|
|
|
'test-write-texture-formats.c',
|
|
|
|
'test-point-size.c',
|
|
|
|
'test-point-size-attribute.c',
|
|
|
|
'test-point-sprite.c',
|
|
|
|
'test-no-gl-header.c',
|
|
|
|
'test-version.c',
|
|
|
|
'test-layer-remove.c',
|
|
|
|
'test-alpha-test.c',
|
|
|
|
'test-map-buffer-range.c',
|
|
|
|
'test-npot-texture.c',
|
|
|
|
'test-alpha-textures.c',
|
|
|
|
'test-texture-get-set-data.c',
|
|
|
|
'test-framebuffer-get-bits.c',
|
|
|
|
'test-primitive-and-journal.c',
|
|
|
|
'test-copy-replace-texture.c',
|
|
|
|
'test-pipeline-cache-unrefs-texture.c',
|
|
|
|
'test-texture-no-allocate.c',
|
|
|
|
'test-pipeline-shader-state.c',
|
|
|
|
'test-texture-rg.c',
|
|
|
|
'test-fence.c',
|
|
|
|
]
|
|
|
|
|
|
|
|
#unported = [
|
|
|
|
# "test-viewport.c",
|
|
|
|
# "test-multitexture.c",
|
|
|
|
# "test-npot-texture.c",
|
|
|
|
# "test-object.c",
|
|
|
|
# "test-readpixels.c",
|
|
|
|
# "test-texture-mipmaps.c",
|
|
|
|
# "test-texture-pixmap-x11.c",",
|
|
|
|
#]
|
|
|
|
|
|
|
|
cogl_test_conformance_includes = [
|
|
|
|
cogl_includepath,
|
|
|
|
cogl_test_fixtures_includepath,
|
|
|
|
]
|
|
|
|
|
2018-12-17 15:26:07 +00:00
|
|
|
if have_installed_tests
|
|
|
|
cogl_installed_tests_cdata = configuration_data()
|
|
|
|
cogl_installed_tests_cdata.set('libexecdir', libexecdir)
|
|
|
|
cogl_installed_tests_cdata.set('apiversion', libmutter_api_version)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
input: 'mutter-cogl.test.in',
|
|
|
|
output: 'mutter-cogl.test',
|
|
|
|
configuration: cogl_installed_tests_cdata,
|
|
|
|
install: true,
|
|
|
|
install_dir: mutter_installed_tests_datadir,
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
libmutter_cogl_test_conformance = executable('test-conformance',
|
|
|
|
sources: cogl_test_conformance_sources,
|
|
|
|
c_args: cogl_debug_c_args + [
|
|
|
|
'-DCOGL_ENABLE_EXPERIMENTAL_API',
|
|
|
|
'-DCOGL_DISABLE_DEPRECATED',
|
|
|
|
'-DCOGL_DISABLE_DEPRECATION_WARNINGS',
|
|
|
|
'-DTESTS_DATADIR="@0@/tests/data"'.format(cogl_srcdir),
|
|
|
|
],
|
|
|
|
include_directories: cogl_test_conformance_includes,
|
|
|
|
dependencies: [
|
2018-11-06 19:50:24 +00:00
|
|
|
libmutter_cogl_dep,
|
|
|
|
libmutter_cogl_test_fixtures_dep,
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
],
|
2018-12-17 15:26:07 +00:00
|
|
|
install: have_installed_tests,
|
|
|
|
install_dir: cogl_installed_tests_libexecdir,
|
|
|
|
install_rpath: pkglibdir,
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
find_unit_tests = find_program('meson/find-conform-unit-tests.sh')
|
2019-02-13 15:34:07 +00:00
|
|
|
test_conform_main = files(join_paths(meson.current_source_dir(), 'test-conform-main.c'))
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
cogl_conform_unit_tests = custom_target('cogl-tests-conform-unit-tests',
|
|
|
|
output: 'unit-tests',
|
2019-02-13 15:34:07 +00:00
|
|
|
input: test_conform_main,
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
command: [find_unit_tests, '@INPUT@', '@OUTPUT@'],
|
2018-12-17 15:26:07 +00:00
|
|
|
install: have_installed_tests,
|
|
|
|
install_dir: cogl_installed_tests_libexecdir,
|
Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-05-22 13:55:35 +00:00
|
|
|
)
|
|
|
|
|
2019-02-13 15:34:07 +00:00
|
|
|
cogl_conformance_tests = run_command(
|
|
|
|
find_unit_tests, test_conform_main, '/dev/stdout',
|
|
|
|
check: true,
|
|
|
|
).stdout().strip().split('\n')
|
|
|
|
|
|
|
|
foreach test_target: cogl_conformance_tests
|
|
|
|
name_parts = []
|
|
|
|
foreach part: test_target.split('_')
|
|
|
|
if part != 'test'
|
|
|
|
name_parts += [part]
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
test_name = '-'.join(name_parts)
|
|
|
|
test(test_name, cogl_run_tests,
|
|
|
|
suite: ['cogl', 'cogl/conform'],
|
2019-04-05 03:36:06 +00:00
|
|
|
env: ['RUN_TESTS_QUIET=1'],
|
2019-02-13 15:34:07 +00:00
|
|
|
args: [
|
|
|
|
cogl_config_env,
|
|
|
|
libmutter_cogl_test_conformance,
|
|
|
|
test_target
|
|
|
|
],
|
|
|
|
is_parallel: false,
|
|
|
|
)
|
|
|
|
endforeach
|