diff options
Diffstat (limited to 'test cases')
| -rw-r--r-- | test cases/rust/28 self-contained/lib.rs | 4 | ||||
| -rw-r--r-- | test cases/rust/28 self-contained/main.c | 6 | ||||
| -rw-r--r-- | test cases/rust/28 self-contained/meson.build | 17 | ||||
| -rw-r--r-- | test cases/rust/28 self-contained/test.json | 6 |
4 files changed, 33 insertions, 0 deletions
diff --git a/test cases/rust/28 self-contained/lib.rs b/test cases/rust/28 self-contained/lib.rs new file mode 100644 index 000000000..f8a8bf201 --- /dev/null +++ b/test cases/rust/28 self-contained/lib.rs @@ -0,0 +1,4 @@ +#[unsafe(export_name = "hello")] +pub extern "C" fn hello() { + println!("Hello, world!"); +} diff --git a/test cases/rust/28 self-contained/main.c b/test cases/rust/28 self-contained/main.c new file mode 100644 index 000000000..11bedf5ae --- /dev/null +++ b/test cases/rust/28 self-contained/main.c @@ -0,0 +1,6 @@ +extern void hello(void); + +int main(void) +{ + hello(); +} diff --git a/test cases/rust/28 self-contained/meson.build b/test cases/rust/28 self-contained/meson.build new file mode 100644 index 000000000..25de68f25 --- /dev/null +++ b/test cases/rust/28 self-contained/meson.build @@ -0,0 +1,17 @@ +project('self-contained', meson_version : '>= 1.3.0') + +if not add_languages('c', native : false, required : false) + error('MESON_SKIP_TEST clang not installed') +endif + +if not add_languages('rust', native : false, required : false) + error('MESON_SKIP_TEST Rust x86_64-unknown-linux-musl target not installed') +endif + +if meson.get_compiler('c').find_library('libunwind', required : false).found() + error('MESON_SKIP_TEST libunwind is installed globally') +endif + +lib = static_library('rust', 'lib.rs', rust_abi : 'c') + +executable('exe', 'main.c', link_with : lib) diff --git a/test cases/rust/28 self-contained/test.json b/test cases/rust/28 self-contained/test.json new file mode 100644 index 000000000..fccefd6f1 --- /dev/null +++ b/test cases/rust/28 self-contained/test.json @@ -0,0 +1,6 @@ +{ + "env": { + "CC": "clang -target x86_64-unknown-linux-musl", + "RUSTC": "rustc --target x86_64-unknown-linux-musl" + } +} |
