From df8187f66b86de4a079a8679c86cbc81c406ade9 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 17 Jul 2023 11:38:53 -0700 Subject: [PATCH] libsysprof-capture: move mapped ring buffer test to capture lib --- src/libsysprof-capture/meson.build | 4 +++ src/libsysprof-capture/tests/meson.build | 34 +++++++++++++++++++ .../tests/test-mapped-ring-buffer.c | 0 3 files changed, 38 insertions(+) create mode 100644 src/libsysprof-capture/tests/meson.build rename src/{ => libsysprof-capture}/tests/test-mapped-ring-buffer.c (100%) diff --git a/src/libsysprof-capture/meson.build b/src/libsysprof-capture/meson.build index fefa923a..aa75b636 100644 --- a/src/libsysprof-capture/meson.build +++ b/src/libsysprof-capture/meson.build @@ -80,3 +80,7 @@ if install_static libraries_private: libsysprof_capture_deps, ) endif + +if get_option('tests') + subdir('tests') +endif diff --git a/src/libsysprof-capture/tests/meson.build b/src/libsysprof-capture/tests/meson.build new file mode 100644 index 00000000..b84247f7 --- /dev/null +++ b/src/libsysprof-capture/tests/meson.build @@ -0,0 +1,34 @@ +libsysprof_capture_test_env = [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + 'G_DEBUG=gc-friendly', + 'GSETTINGS_BACKEND=memory', + 'MALLOC_CHECK_=2', + 'NO_AT_BRIDGE=1', +] + +libsysprof_capture_testsuite_c_args = [ + '-DSYSPROF_COMPILATION', + '-DG_ENABLE_DEBUG', + '-UG_DISABLE_ASSERT', + '-UG_DISABLE_CAST_CHECKS', +] + +libsysprof_capture_testsuite = { + 'test-mapped-ring-buffer' : {}, +} + +libsysprof_capture_testsuite_deps = [ + dependency('glib-2.0'), + libsysprof_capture_dep, +] + +foreach test, params: libsysprof_capture_testsuite + test_exe = executable(test, '@0@.c'.format(test), + c_args: libsysprof_capture_testsuite_c_args, + dependencies: libsysprof_capture_testsuite_deps, + ) + if not params.get('skip', false) + test(test, test_exe, env: libsysprof_capture_test_env) + endif +endforeach diff --git a/src/tests/test-mapped-ring-buffer.c b/src/libsysprof-capture/tests/test-mapped-ring-buffer.c similarity index 100% rename from src/tests/test-mapped-ring-buffer.c rename to src/libsysprof-capture/tests/test-mapped-ring-buffer.c