CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
40 lines
1.3 KiB
Rust
40 lines
1.3 KiB
Rust
//! Optional runtime-load test for `rocjitsu_sys`.
|
|
//!
|
|
//! Resolving the `rj_vm_*` symbols requires a real `librocjitsu.so`.
|
|
//! The test probes the conventional ROCm install locations
|
|
//! (`$ROCM_HOME/lib`, `/opt/rocm/lib`) for one; otherwise it skips so
|
|
//! the suite stays green on machines without rocjitsu.
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use rocjitsu_sys::Lib;
|
|
|
|
/// Locate the rocjitsu library to load (the combined `librocjitsu.so`).
|
|
fn locate_lib() -> Option<PathBuf> {
|
|
const LIBS: &[&str] = &["librocjitsu.so"];
|
|
|
|
let mut dirs: Vec<PathBuf> = Vec::new();
|
|
if let Some(root) = std::env::var_os("ROCM_HOME").filter(|v| !v.is_empty()) {
|
|
dirs.push(PathBuf::from(root).join("lib"));
|
|
}
|
|
dirs.push(PathBuf::from("/opt/rocm/lib"));
|
|
dirs.into_iter()
|
|
.flat_map(|dir| LIBS.iter().map(move |lib| dir.join(lib)))
|
|
.find(|p| p.is_file())
|
|
}
|
|
|
|
#[test]
|
|
fn loads_and_resolves_symbols() {
|
|
let Some(path) = locate_lib() else {
|
|
eprintln!("no rocjitsu library found; skipping rocjitsu_sys load test");
|
|
return;
|
|
};
|
|
// Loading succeeds only if every `rj_vm_*` symbol resolves.
|
|
let lib = unsafe { Lib::open(&path) };
|
|
assert!(
|
|
lib.is_ok(),
|
|
"failed to load rocjitsu library at {path:?}: {:?}",
|
|
lib.err()
|
|
);
|
|
}
|