diff options
Diffstat (limited to 'test cases')
11 files changed, 55 insertions, 36 deletions
diff --git a/test cases/failing/47 pkgconfig variables zero length value/meson.build b/test cases/failing/47 pkgconfig variables zero length value/meson.build deleted file mode 100644 index 33977b2..0000000 --- a/test cases/failing/47 pkgconfig variables zero length value/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('variables-zero-length-value-test', 'c', version : '1.0') - -pkgg = import('pkgconfig') -lib = shared_library('simple', 'simple.c') -libver = '1.0' -h = install_headers('simple.h') - -pkgg.generate( - libraries : [lib, '-lz'], - subdirs : '.', - version : libver, - name : 'libsimple', - filebase : 'simple', - description : 'A simple demo library.', - variables : [ 'key=' ] -) diff --git a/test cases/failing/47 pkgconfig variables zero length value/simple.c b/test cases/failing/47 pkgconfig variables zero length value/simple.c deleted file mode 100644 index e8a6d83..0000000 --- a/test cases/failing/47 pkgconfig variables zero length value/simple.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"simple.h" - -int simple_function() { - return 42; -} diff --git a/test cases/failing/47 pkgconfig variables zero length value/simple.h b/test cases/failing/47 pkgconfig variables zero length value/simple.h deleted file mode 100644 index bb52e6d..0000000 --- a/test cases/failing/47 pkgconfig variables zero length value/simple.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SIMPLE_H_ -#define SIMPLE_H_ - -int simple_function(); - -#endif diff --git a/test cases/failing/47 pkgconfig variables zero length value/test.json b/test cases/failing/47 pkgconfig variables zero length value/test.json deleted file mode 100644 index 0be5725..0000000 --- a/test cases/failing/47 pkgconfig variables zero length value/test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "stdout": [ - { - "line": "test cases/failing/47 pkgconfig variables zero length value/meson.build:8:5: ERROR: pkgconfig.generate keyword argument \"variables\" empty variable value" - } - ] -} diff --git a/test cases/rust/22 cargo subproject/subprojects/bar-rs/Cargo.toml b/test cases/rust/22 cargo subproject/subprojects/bar-rs/Cargo.toml index 232b4d7..d60a5d8 100644 --- a/test cases/rust/22 cargo subproject/subprojects/bar-rs/Cargo.toml +++ b/test cases/rust/22 cargo subproject/subprojects/bar-rs/Cargo.toml @@ -1,3 +1,14 @@ [package] name = "bar" version = "0.1" + +# This dependency does not exist, it is required by default but this subproject +# is called with default-features=false. +[dependencies.notfound] +optional = true +version = "1.0" + +[features] +default = ["f2"] +f1 = [] +f2 = ["notfound"] diff --git a/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/lib.c b/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/lib.c new file mode 100644 index 0000000..c2a0777 --- /dev/null +++ b/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/lib.c @@ -0,0 +1,4 @@ +int extra_func(void) +{ + return 0; +} diff --git a/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/meson.build b/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/meson.build new file mode 100644 index 0000000..3ba7852 --- /dev/null +++ b/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/meson.build @@ -0,0 +1,10 @@ +project('extra dep', 'c', version: '1.0') + +assert(get_option('feature-default') == true) + +l = static_library('extra-dep', 'lib.c') +d = declare_dependency(link_with: l, + variables: { + 'features': 'default', + }) +meson.override_dependency('extra-dep-rs', d) diff --git a/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/meson_options.txt b/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/meson_options.txt new file mode 100644 index 0000000..9311d9e --- /dev/null +++ b/test cases/rust/22 cargo subproject/subprojects/extra-dep-rs/meson_options.txt @@ -0,0 +1 @@ +option('feature-default', type: 'boolean', value: true) diff --git a/test cases/rust/22 cargo subproject/subprojects/foo-rs/Cargo.toml b/test cases/rust/22 cargo subproject/subprojects/foo-rs/Cargo.toml index 214c327..796548d 100644 --- a/test cases/rust/22 cargo subproject/subprojects/foo-rs/Cargo.toml +++ b/test cases/rust/22 cargo subproject/subprojects/foo-rs/Cargo.toml @@ -6,5 +6,22 @@ edition = "2021" [lib] crate-type = ["cdylib"] +# This dependency does not exist, verify optional works. +[dependencies.notfound] +optional = true +version = "1.0" + +# This dependency is optional but required for f3 which is on by default. +[dependencies.extra-dep] +optional = true +version = "1.0" + [dependencies] -mybar = { version = "0.1", package = "bar" } +mybar = { version = "0.1", package = "bar", default-features = false } + +[features] +default = ["f1"] +f1 = ["f2", "f3"] +f2 = ["f1"] +f3 = ["mybar/f1", "dep:extra-dep", "notfound?/invalid"] +f4 = ["dep:notfound"] diff --git a/test cases/rust/22 cargo subproject/subprojects/foo-rs/meson/meson.build b/test cases/rust/22 cargo subproject/subprojects/foo-rs/meson/meson.build new file mode 100644 index 0000000..67c7b82 --- /dev/null +++ b/test cases/rust/22 cargo subproject/subprojects/foo-rs/meson/meson.build @@ -0,0 +1 @@ +extra_args += ['--cfg', 'feature="foo"'] diff --git a/test cases/rust/22 cargo subproject/subprojects/foo-rs/src/lib.rs b/test cases/rust/22 cargo subproject/subprojects/foo-rs/src/lib.rs index 732d7d2..1c8cbc9 100644 --- a/test cases/rust/22 cargo subproject/subprojects/foo-rs/src/lib.rs +++ b/test cases/rust/22 cargo subproject/subprojects/foo-rs/src/lib.rs @@ -1,4 +1,13 @@ +extern "C" { + fn extra_func() -> i32; +} + +#[cfg(feature = "foo")] #[no_mangle] pub extern "C" fn rust_func() -> i32 { - mybar::VALUE + let v: i32; + unsafe { + v = extra_func(); + }; + mybar::VALUE + v } |