summaryrefslogtreecommitdiffstats
path: root/vendor/libloading/src/test_helpers.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/libloading/src/test_helpers.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/libloading/src/test_helpers.rs')
-rw-r--r--vendor/libloading/src/test_helpers.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/libloading/src/test_helpers.rs b/vendor/libloading/src/test_helpers.rs
new file mode 100644
index 000000000..9e3e9924f
--- /dev/null
+++ b/vendor/libloading/src/test_helpers.rs
@@ -0,0 +1,37 @@
+//! This is a separate file containing helpers for tests of this library. It is built into a
+//! dynamic library by the build.rs script.
+#![crate_type="cdylib"]
+
+#[no_mangle]
+pub static mut TEST_STATIC_U32: u32 = 0;
+
+#[no_mangle]
+pub static mut TEST_STATIC_PTR: *mut () = 0 as *mut _;
+
+#[no_mangle]
+pub extern "C" fn test_identity_u32(x: u32) -> u32 {
+ x
+}
+
+#[repr(C)]
+pub struct S {
+ a: u64,
+ b: u32,
+ c: u16,
+ d: u8
+}
+
+#[no_mangle]
+pub extern "C" fn test_identity_struct(x: S) -> S {
+ x
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn test_get_static_u32() -> u32 {
+ TEST_STATIC_U32
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn test_check_static_ptr() -> bool {
+ TEST_STATIC_PTR == (&mut TEST_STATIC_PTR as *mut *mut _ as *mut _)
+}