aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/tests/context_push_invalid_should_crash.rs
diff options
context:
space:
mode:
Diffstat (limited to 'zluda/tests/context_push_invalid_should_crash.rs')
-rw-r--r--zluda/tests/context_push_invalid_should_crash.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/zluda/tests/context_push_invalid_should_crash.rs b/zluda/tests/context_push_invalid_should_crash.rs
new file mode 100644
index 0000000..f1538d5
--- /dev/null
+++ b/zluda/tests/context_push_invalid_should_crash.rs
@@ -0,0 +1,15 @@
+use crate::common::CudaDriverFns;
+use cuda_types::*;
+
+mod common;
+
+cuda_driver_test!(context_push_invalid_should_crash);
+
+// This test is supposed to segfault on NV runtime, but this is impossible
+// to express easily in Rust right now on Windows
+unsafe fn context_push_invalid_should_crash<T: CudaDriverFns>(cuda: T) {
+ assert_eq!(cuda.cuInit(0), CUresult::CUDA_SUCCESS);
+ let mut fake_ctx = vec![0usize; 32];
+ let result = cuda.cuCtxPushCurrent_v2(fake_ctx.as_mut_ptr() as _);
+ assert_eq!(result, CUresult::CUDA_ERROR_INVALID_CONTEXT);
+}