From e7f20efc8bd123bfc2c325198866850694612a23 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 16 Oct 2023 16:02:28 -0700 Subject: modules/rust: allow setting a version constraint on bindgen This allows us to ensure that the bindgen we're using is suitable for our purpose. --- test cases/rust/12 bindgen/meson.build | 9 +++++++-- test cases/rust/12 bindgen/test.json | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'test cases/rust') diff --git a/test cases/rust/12 bindgen/meson.build b/test cases/rust/12 bindgen/meson.build index 0957581..a88ed81 100644 --- a/test cases/rust/12 bindgen/meson.build +++ b/test cases/rust/12 bindgen/meson.build @@ -32,13 +32,18 @@ if result.returncode() != 0 error('MESON_SKIP_TEST bindgen does not seem to work') endif +rust = import('unstable-rust') + +# Check version, this case is obviously impossible +testcase expect_error('Program \'bindgen\' not found or not executable') + rust.bindgen(input : 'include/other.h', output : 'other.rs', bindgen_version : ['< 0.1', '> 10000']) +endtestcase + # This is to test the include_directories argument to bindgen inc = include_directories('include') c_lib = static_library('clib', 'src/source.c', include_directories : inc) -rust = import('unstable-rust') - gen = rust.bindgen( input : 'src/header.h', output : 'header.rs', diff --git a/test cases/rust/12 bindgen/test.json b/test cases/rust/12 bindgen/test.json index 25fafd2..a3b7e29 100644 --- a/test cases/rust/12 bindgen/test.json +++ b/test cases/rust/12 bindgen/test.json @@ -4,7 +4,7 @@ }, "stdout": [ { - "line": "test cases/rust/12 bindgen/meson.build:42: WARNING: Project targets '>= 0.63' but uses feature introduced in '1.0.0': \"rust.bindgen\" keyword argument \"include_directories\" of type array[str]." + "line": "test cases/rust/12 bindgen/meson.build:47: WARNING: Project targets '>= 0.63' but uses feature introduced in '1.0.0': \"rust.bindgen\" keyword argument \"include_directories\" of type array[str]." } ] } -- cgit v1.1