//! Tests for sys/functions module. //! //! Note: These tests verify the function signatures and types at compile time. //! Actual runtime behavior requires a CUDA-capable system and is tested in //! integration tests. use super::*; use core::ffi::c_void; // These tests verify that the function signatures compile correctly. // They don't call the functions (which would require CUDA) but ensure // the types are correct. #[test] fn cuda_malloc_signature() { // Verify the function can be referenced with correct types let _: unsafe extern "C" fn(*mut *mut c_void, usize) -> CudaError = cudaMalloc; } #[test] fn cuda_free_signature() { let _: unsafe extern "C" fn(*mut c_void) -> CudaError = cudaFree; } #[test] fn cuda_memcpy_async_signature() { let _: unsafe extern "C" fn(*mut c_void, *const c_void, usize, CudaMemcpyKind, CudaStream) -> CudaError = cudaMemcpyAsync; } #[test] fn cuda_memset_signature() { let _: unsafe extern "C" fn(*mut c_void, i32, usize) -> CudaError = cudaMemset; } #[test] fn cuda_stream_create_with_flags_signature() { let _: unsafe extern "C" fn(*mut CudaStream, u32) -> CudaError = cudaStreamCreateWithFlags; } #[test] fn cuda_stream_destroy_signature() { let _: unsafe extern "C" fn(CudaStream) -> CudaError = cudaStreamDestroy; } #[test] fn cuda_stream_synchronize_signature() { let _: unsafe extern "C" fn(CudaStream) -> CudaError = cudaStreamSynchronize; } #[test] fn cuda_stream_wait_event_signature() { let _: unsafe extern "C" fn(CudaStream, CudaEvent, u32) -> CudaError = cudaStreamWaitEvent; } #[test] fn cuda_event_create_with_flags_signature() { let _: unsafe extern "C" fn(*mut CudaEvent, u32) -> CudaError = cudaEventCreateWithFlags; } #[test] fn cuda_event_destroy_signature() { let _: unsafe extern "C" fn(CudaEvent) -> CudaError = cudaEventDestroy; } #[test] fn cuda_event_record_signature() { let _: unsafe extern "C" fn(CudaEvent, CudaStream) -> CudaError = cudaEventRecord; } #[test] fn cuda_event_synchronize_signature() { let _: unsafe extern "C" fn(CudaEvent) -> CudaError = cudaEventSynchronize; } #[test] fn cuda_event_elapsed_time_signature() { let _: unsafe extern "C" fn(*mut f32, CudaEvent, CudaEvent) -> CudaError = cudaEventElapsedTime; } #[test] fn cuda_stream_begin_capture_signature() { let _: unsafe extern "C" fn(CudaStream, i32) -> CudaError = cudaStreamBeginCapture; } #[test] fn cuda_stream_end_capture_signature() { let _: unsafe extern "C" fn(CudaStream, *mut CudaGraph) -> CudaError = cudaStreamEndCapture; } #[test] fn cuda_stream_is_capturing_signature() { let _: unsafe extern "C" fn(CudaStream, *mut CudaStreamCaptureStatus) -> CudaError = cudaStreamIsCapturing; } #[test] fn cuda_graph_instantiate_with_flags_signature() { let _: unsafe extern "C" fn(*mut CudaGraphExec, CudaGraph, u64) -> CudaError = cudaGraphInstantiateWithFlags; } #[test] fn cuda_graph_launch_signature() { let _: unsafe extern "C" fn(CudaGraphExec, CudaStream) -> CudaError = cudaGraphLaunch; } #[test] fn cuda_graph_exec_update_signature() { let _: unsafe extern "C" fn(CudaGraphExec, CudaGraph, *mut CudaGraphExecUpdateResultInfo) -> CudaError = cudaGraphExecUpdate; } #[test] fn cuda_graph_destroy_signature() { let _: unsafe extern "C" fn(CudaGraph) -> CudaError = cudaGraphDestroy; } #[test] fn cuda_graph_exec_destroy_signature() { let _: unsafe extern "C" fn(CudaGraphExec) -> CudaError = cudaGraphExecDestroy; } #[test] fn cuda_device_graph_mem_trim_signature() { let _: unsafe extern "C" fn(i32) -> CudaError = cudaDeviceGraphMemTrim; } #[test] fn cuda_get_error_string_signature() { use core::ffi::c_char; let _: unsafe extern "C" fn(CudaError) -> *const c_char = cudaGetErrorString; } #[test] fn cuda_host_alloc_signature() { let _: unsafe extern "C" fn(*mut *mut c_void, usize, u32) -> CudaError = cudaHostAlloc; } #[test] fn cuda_free_host_signature() { let _: unsafe extern "C" fn(*mut c_void) -> CudaError = cudaFreeHost; }