MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / test_nmi

Function test_nmi

cloud-hypervisor/tests/integration.rs:5754–5797  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5752 #[test]
5753 #[cfg(target_arch = "x86_64")]
5754 fn test_nmi() {
5755 let disk_config = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string());
5756 let guest = Guest::new(Box::new(disk_config));
5757 let api_socket = temp_api_path(&guest.tmp_dir);
5758 let event_path = temp_event_monitor_path(&guest.tmp_dir);
5759
5760 let kernel_path = direct_kernel_boot_path();
5761 let cmd_line = format!("{} {}", DIRECT_KERNEL_BOOT_CMDLINE, "unknown_nmi_panic=1");
5762
5763 let mut cmd = GuestCommand::new(&guest);
5764 cmd.args(["--cpus", "boot=4"])
5765 .default_memory()
5766 .args(["--kernel", kernel_path.to_str().unwrap()])
5767 .args(["--cmdline", cmd_line.as_str()])
5768 .default_disks()
5769 .args(["--net", guest.default_net_string().as_str()])
5770 .args(["--pvpanic"])
5771 .args(["--api-socket", &api_socket])
5772 .args(["--event-monitor", format!("path={event_path}").as_str()])
5773 .capture_output();
5774
5775 let mut child = cmd.spawn().unwrap();
5776
5777 let r = std::panic::catch_unwind(|| {
5778 guest.wait_vm_boot().unwrap();
5779
5780 assert!(remote_command(&api_socket, "nmi", None));
5781
5782 let expected_sequential_events = [&MetaEvent {
5783 event: "panic".to_string(),
5784 device_id: None,
5785 }];
5786 assert!(wait_for_latest_events_exact(
5787 Duration::from_secs(3),
5788 &expected_sequential_events,
5789 &event_path
5790 ));
5791 });
5792
5793 kill_child(&mut child);
5794 let output = child.wait_with_output().unwrap();
5795
5796 handle_child_output(r, &output);
5797 }
5798
5799 // Checks that explicit PCI device IDs are honored for boot-time and hotplugged devices.
5800 // It also verifies dynamic hotplug allocation reuses freed PCI device ID holes.

Callers

nothing calls this directly

Calls 13

newFunction · 0.85
temp_api_pathFunction · 0.85
temp_event_monitor_pathFunction · 0.85
direct_kernel_boot_pathFunction · 0.85
kill_childFunction · 0.85
handle_child_outputFunction · 0.85
capture_outputMethod · 0.80
argsMethod · 0.80
default_disksMethod · 0.80
default_memoryMethod · 0.80
default_net_stringMethod · 0.80
spawnMethod · 0.80

Tested by

no test coverage detected