From ccf099d0d12cc6087f65e19f549c583dc23a5c9d Mon Sep 17 00:00:00 2001 From: norablackcat Date: Fri, 24 Jan 2025 17:00:45 -0600 Subject: [PATCH] rusticl: add Test targets v2: Add more targets and a little test lib to add stubs for missing symbols v3: Condition building tests on a recent enough meson (@leftmostcat) v4: Set suite parameter for new tests (@leftmostcat) Reviewed-by: Eric Engestrom Part-of: --- src/gallium/frontends/rusticl/meson.build | 27 +++++++++++++++++++++++ src/gallium/frontends/rusticl/test/lib.rs | 6 +++++ 2 files changed, 33 insertions(+) create mode 100644 src/gallium/frontends/rusticl/test/lib.rs diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build index d1c17fd7560..f42ebac43cc 100644 --- a/src/gallium/frontends/rusticl/meson.build +++ b/src/gallium/frontends/rusticl/meson.build @@ -441,3 +441,30 @@ librusticl = static_library( rusticl_proc_macros, ], ) + +if meson.version().version_compare('>= 1.9.0') and with_tests + # Tests may fail to build with versions of meson prior to 1.9 due to a bug + # involving parameters passed to the linker. + # + # See https://github.com/mesonbuild/meson/issues/14622 + librusticl_test = static_library( + 'rusticl_test', + 'test/lib.rs', + rust_abi : 'c', + ) + + rust.test('rusticl_opencl_gen_test', rusticl_opencl_gen, suite : ['rusticl']) + rust.test('rusticl_llvm_gen_test', rusticl_llvm_gen, suite : ['rusticl']) + rust.test('rusticl_proc_macros_test', rusticl_proc_macros, suite : ['rusticl']) + rust.test('libc_rust_gen_test', libc_rust_gen, suite : ['rusticl']) + rust.test('libmesa_rust_gen_test', libmesa_rust_gen, suite : ['rusticl']) + rust.test('libmesa_rust_util_test', libmesa_rust_util, suite : ['rusticl']) + rust.test('libmesa_rust_test', libmesa_rust, suite : ['rusticl']) + + rust.test('rusticl_test', librusticl, + link_with : [ + librusticl_test, + ], + suite : ['rusticl'], + ) +endif diff --git a/src/gallium/frontends/rusticl/test/lib.rs b/src/gallium/frontends/rusticl/test/lib.rs new file mode 100644 index 00000000000..68c53b7bed0 --- /dev/null +++ b/src/gallium/frontends/rusticl/test/lib.rs @@ -0,0 +1,6 @@ +use std::ffi::{c_int, c_void}; + +// it's never called anyway, but the linker _might_ think that. If this interface ever changes it +// might cause random issues, but... I also don't really care all that much until it happens. +#[no_mangle] +extern "C" fn pipe_loader_release(_: *mut *mut c_void, _: c_int) {}