• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NVIDIA / nvrc / 20381075488

19 Dec 2025 07:59PM UTC coverage: 89.348% (+8.9%) from 80.415%
20381075488

Pull #85

github

web-flow
Merge 40e9e3e58 into 2295d6b0d
Pull Request #85: Update coverage.yaml to use cargo-llvm-cov

1233 of 1380 relevant lines covered (89.35%)

4.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/src/modprobe.rs
1
use crate::execute::foreground;
2
use anyhow::Result;
3

4
const MODPROBE: &str = "/sbin/modprobe";
5

6
/// Load a kernel module via modprobe.
7
/// Used to load GPU drivers (nvidia, nvidia-uvm) during init.
8
pub fn load(module: &str) -> Result<()> {
2✔
9
    foreground(MODPROBE, &[module])
2✔
10
}
2✔
11

12
/// Reload NVIDIA modules to pick up configuration changes.
13
/// Used after nvidia-smi adjusts GPU settings (clocks, power limits)
14
/// that require a module reload to take effect.
15
pub fn reload_nvidia_modules() -> Result<()> {
1✔
16
    foreground(MODPROBE, &["-r", "nvidia-uvm", "nvidia"])?;
1✔
17
    load("nvidia")?;
×
18
    load("nvidia-uvm")
×
19
}
1✔
20

21
#[cfg(test)]
22
mod tests {
23
    use super::*;
24
    use crate::test_utils::require_root;
25
    use serial_test::serial;
26

27
    // Kernel module loading must be serialized - parallel modprobe
28
    // calls can race and cause spurious failures.
29

30
    #[test]
31
    #[serial]
32
    fn test_load_loop() {
1✔
33
        require_root();
1✔
34
        // 'loop' module is almost always available (loop devices)
35
        assert!(load("loop").is_ok());
1✔
36
    }
37

38
    #[test]
39
    #[serial]
40
    fn test_load_nonexistent() {
1✔
41
        require_root();
1✔
42
        let err = load("nonexistent_module_xyz123").unwrap_err();
1✔
43
        // modprobe exits non-zero for missing modules
44
        assert!(
1✔
45
            err.to_string().contains("modprobe"),
1✔
46
            "error should mention modprobe: {}",
×
47
            err
48
        );
49
    }
50

51
    #[test]
52
    #[serial]
53
    fn test_reload_fails_without_hardware() {
1✔
54
        require_root();
1✔
55
        // Will fail: no nvidia modules on systems without NVIDIA
56
        let _ = reload_nvidia_modules();
1✔
57
    }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc