summaryrefslogtreecommitdiffstats
path: root/test cases/rust/2 sharedlib
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/rust/2 sharedlib')
-rw-r--r--test cases/rust/2 sharedlib/meson.build17
-rw-r--r--test cases/rust/2 sharedlib/prog.rs3
-rw-r--r--test cases/rust/2 sharedlib/stuff.rs11
-rw-r--r--test cases/rust/2 sharedlib/test.json10
-rw-r--r--test cases/rust/2 sharedlib/value.c3
5 files changed, 44 insertions, 0 deletions
diff --git a/test cases/rust/2 sharedlib/meson.build b/test cases/rust/2 sharedlib/meson.build
new file mode 100644
index 0000000..295fa04
--- /dev/null
+++ b/test cases/rust/2 sharedlib/meson.build
@@ -0,0 +1,17 @@
+project('rust shared library', 'rust', 'c')
+
+if host_machine.system() == 'darwin'
+ error('MESON_SKIP_TEST: does not work right on macos, please fix!')
+endif
+
+s = static_library('static', 'value.c')
+l = shared_library('stuff', 'stuff.rs', link_whole : s, install : true)
+e = executable('prog', 'prog.rs', link_with : l, install : true)
+
+if build_machine.system() == 'windows'
+ rustup = find_program('rustup')
+ test('linktest', rustup,
+ args: ['run', 'stable', e])
+else
+ test('linktest', e)
+endif
diff --git a/test cases/rust/2 sharedlib/prog.rs b/test cases/rust/2 sharedlib/prog.rs
new file mode 100644
index 0000000..fbf3181
--- /dev/null
+++ b/test cases/rust/2 sharedlib/prog.rs
@@ -0,0 +1,3 @@
+extern crate stuff;
+
+fn main() { println!("printing: {}", stuff::explore()); }
diff --git a/test cases/rust/2 sharedlib/stuff.rs b/test cases/rust/2 sharedlib/stuff.rs
new file mode 100644
index 0000000..e7c0521
--- /dev/null
+++ b/test cases/rust/2 sharedlib/stuff.rs
@@ -0,0 +1,11 @@
+#![crate_name = "stuff"]
+
+extern "C" {
+ fn c_value() -> i32;
+}
+
+pub fn explore() -> String {
+ unsafe {
+ format!("library{}string", c_value())
+ }
+}
diff --git a/test cases/rust/2 sharedlib/test.json b/test cases/rust/2 sharedlib/test.json
new file mode 100644
index 0000000..585fdeb
--- /dev/null
+++ b/test cases/rust/2 sharedlib/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": "pdb", "file": "usr/bin/stuff"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/stuff.dll.lib"}
+ ]
+}
diff --git a/test cases/rust/2 sharedlib/value.c b/test cases/rust/2 sharedlib/value.c
new file mode 100644
index 0000000..d17b6de
--- /dev/null
+++ b/test cases/rust/2 sharedlib/value.c
@@ -0,0 +1,3 @@
+int c_value(void) {
+ return 7;
+}