mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
35 lines
2.1 KiB
Bash
Executable File
35 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
TASK_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$TASK_ROOT"
|
|
TASK_OUT="$TASK_ROOT/target/timer-state-load"
|
|
mkdir -p "$TASK_OUT"
|
|
RUSTC=${RUSTC:-$(rustup which rustc 2>/dev/null || command -v rustc || echo "$HOME/.cargo/bin/rustc")}
|
|
"$RUSTC" -D warnings --edition=2024 --crate-name nv_rs_abi --crate-type=rlib src/common/abi/src/lib.rs -o "$TASK_OUT/libnv_rs_abi.rlib"
|
|
"$RUSTC" -D warnings --edition=2024 --crate-name nv_rs_core --crate-type=rlib src/nvidia/src/lib.rs --extern nv_rs_abi="$TASK_OUT/libnv_rs_abi.rlib" -o "$TASK_OUT/libnv_rs_core.rlib"
|
|
cat > "$TASK_OUT/fixture.rs" <<RUST
|
|
#![forbid(unsafe_code)]
|
|
mod timer {
|
|
pub use nv_rs_core::gpu::bringup::ExecutedStatus;
|
|
pub use nv_rs_core::gpu::timer::interrupt;
|
|
#[path="$TASK_ROOT/src/nvidia/src/gpu/timer/load.rs"]
|
|
pub mod load;
|
|
}
|
|
RUST
|
|
"$RUSTC" -D warnings --edition=2024 --test --crate-name timer_state_load "$TASK_OUT/fixture.rs" --extern nv_rs_abi="$TASK_OUT/libnv_rs_abi.rlib" --extern nv_rs_core="$TASK_OUT/libnv_rs_core.rlib" -L dependency="$TASK_OUT" -o "$TASK_OUT/test"
|
|
"$TASK_OUT/test"
|
|
if [ -z "${CLIPPY_DRIVER:-}" ]; then
|
|
RUSTC_SYSROOT=$("$RUSTC" --print sysroot 2>/dev/null || true)
|
|
RUSTC_PATH=$(command -v -- "$RUSTC" 2>/dev/null || printf '%s' "$RUSTC")
|
|
RUSTC_REAL=$(readlink -f -- "$RUSTC_PATH" 2>/dev/null || printf '%s' "$RUSTC_PATH")
|
|
RUSTC_DIR=$(dirname -- "$RUSTC_REAL")
|
|
if [ -n "$RUSTC_SYSROOT" ] && [ -x "$RUSTC_SYSROOT/bin/clippy-driver" ]; then
|
|
CLIPPY_DRIVER="$RUSTC_SYSROOT/bin/clippy-driver"
|
|
elif [ "$(basename -- "$RUSTC_REAL")" != "rustup" ] && [ -x "$RUSTC_DIR/clippy-driver" ]; then
|
|
CLIPPY_DRIVER="$RUSTC_DIR/clippy-driver"
|
|
else
|
|
CLIPPY_DRIVER=$(rustup which clippy-driver 2>/dev/null || command -v clippy-driver || printf '%s/clippy-driver' "$RUSTC_DIR")
|
|
fi
|
|
fi
|
|
"$CLIPPY_DRIVER" -D warnings --edition=2024 --test --crate-name timer_state_load "$TASK_OUT/fixture.rs" --extern nv_rs_abi="$TASK_OUT/libnv_rs_abi.rlib" --extern nv_rs_core="$TASK_OUT/libnv_rs_core.rlib" -L dependency="$TASK_OUT" -o "$TASK_OUT/test-clippy"
|