From 85a52b85791d3c41d251b80755b3d9407be4eb24 Mon Sep 17 00:00:00 2001 From: sanana Date: Sun, 2 Feb 2025 20:11:56 +0300 Subject: [PATCH] tests/rtld: Add support for conditionally skipping tests This allows test subdirs in tests/rtld to conditionally skip, e.g. when patchelf is needed to build a test and not found. --- tests/rtld/meson.build | 13 +++++++++++++ tests/rtld/skipped.c | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 tests/rtld/skipped.c diff --git a/tests/rtld/meson.build b/tests/rtld/meson.build index 2a8d852d5..638e50b32 100644 --- a/tests/rtld/meson.build +++ b/tests/rtld/meson.build @@ -33,10 +33,23 @@ foreach test_name : rtld_test_cases test_native_link_with = [] test_native_depends = [] test_additional_link_args = [] + test_skipped = false # Build the needed DSOs for the test. This sets the variables above. subdir(test_name) + if test_skipped + exec = executable('rtld-' + test_name, ['skipped.c', test_sources], + dependencies: libc_dep, + link_args: test_link_args, + ) + test(test_name, exec, suite: 'rtld') + if build_tests_host_libc and not host_libc_excluded_test_cases.contains(test_name) + test(test_name, exec, suite: ['host-libc', 'rtld']) + endif + continue + endif + exec = executable('rtld-' + test_name, [test_name / 'test.c', test_sources], link_with: test_link_with, dependencies: libc_dep, diff --git a/tests/rtld/skipped.c b/tests/rtld/skipped.c new file mode 100644 index 000000000..e7c74c561 --- /dev/null +++ b/tests/rtld/skipped.c @@ -0,0 +1,3 @@ +int main() { + return 77; +}