aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/rust/4 polyglot
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/rust/4 polyglot')
-rw-r--r--meson/test cases/rust/4 polyglot/meson.build9
-rw-r--r--meson/test cases/rust/4 polyglot/prog.c8
-rw-r--r--meson/test cases/rust/4 polyglot/stuff.rs6
-rw-r--r--meson/test cases/rust/4 polyglot/test.json10
4 files changed, 33 insertions, 0 deletions
diff --git a/meson/test cases/rust/4 polyglot/meson.build b/meson/test cases/rust/4 polyglot/meson.build
new file mode 100644
index 000000000..4e96679f6
--- /dev/null
+++ b/meson/test cases/rust/4 polyglot/meson.build
@@ -0,0 +1,9 @@
+project('rust and c polyglot executable', 'c', 'rust')
+
+if host_machine.system() == 'darwin'
+ error('MESON_SKIP_TEST: doesnt work right on macos, please fix!')
+endif
+
+l = shared_library('stuff', 'stuff.rs', rust_crate_type: 'cdylib', install : true)
+e = executable('prog', 'prog.c', link_with : l, install : true)
+test('polyglottest', e)
diff --git a/meson/test cases/rust/4 polyglot/prog.c b/meson/test cases/rust/4 polyglot/prog.c
new file mode 100644
index 000000000..dbbd8800a
--- /dev/null
+++ b/meson/test cases/rust/4 polyglot/prog.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+void f();
+
+int main(void) {
+ printf("Hello from C!\n");
+ f();
+}
diff --git a/meson/test cases/rust/4 polyglot/stuff.rs b/meson/test cases/rust/4 polyglot/stuff.rs
new file mode 100644
index 000000000..ecf623c64
--- /dev/null
+++ b/meson/test cases/rust/4 polyglot/stuff.rs
@@ -0,0 +1,6 @@
+#![crate_name = "stuff"]
+
+#[no_mangle]
+pub extern fn f() {
+ println!("Hello from Rust!");
+}
diff --git a/meson/test cases/rust/4 polyglot/test.json b/meson/test cases/rust/4 polyglot/test.json
new file mode 100644
index 000000000..a8837a195
--- /dev/null
+++ b/meson/test cases/rust/4 polyglot/test.json
@@ -0,0 +1,10 @@
+{
+ "installed": [
+ {"type": "exe", "file": "usr/bin/prog"},
+ {"type": "pdb", "file": "usr/bin/prog"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/libstuff.so"},
+ {"type": "file", "platform": "msvc", "file": "usr/bin/stuff.dll"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/stuff.dll.lib"},
+ {"type": "pdb", "file": "usr/bin/stuff"}
+ ]
+}