Testing¶
The local test environment assumes passwordless sudo, matching typical
DevStack usage.
Host loopback smoke test¶
$ make -C pci-sim modules
$ sudo modprobe vfio-pci
$ sudo insmod pci-sim/fake_pci_sriov.ko
$ sudo pci-sim/test_pci_sim_loopback.py
$ sudo pci-sim/cleanup_fake_pci_sriov.sh
QEMU/VFIO smoke test¶
$ make -C pci-sim modules
$ MODULE=./pci-sim/fake_pci_sriov.ko pci-sim/run_fake_pci_qemu_vfio_smoke.sh
The QEMU helpers bind a fake VF to pci_sim_vfio_pci and verify that QEMU
can start with the assigned VF. CirrOS-based helpers are also included for
guest-level UART loopback testing.
VF personality sysfs smoke test¶
$ make -C pci-sim modules
$ pci-sim/run_fake_pci_personality_smoke.sh
The script loads two PFs, verifies the vf_personality and
vf_personality_available sysfs files, tests VF creation under the
uart personality, confirms personality changes are rejected while
VFs are active, and validates that invalid personality names are rejected.
QEMU/mdev smoke test¶
$ make -C pci-sim modules
$ MODULE=./pci-sim/fake_pci_sriov.ko pci-sim/run_fake_pci_qemu_mdev_smoke.sh
The script creates a fake mdev instance from the pci-sim module and verifies
that QEMU can start with it attached via sysfsdev. Override the mdev type
with MDEV_TYPE=sim_accel_large to test the large accelerator type.
Mdev smoke test¶
The mdev smoke test verifies that pci-sim correctly registers each fake PF as an mdev parent and exposes the expected mdev types in sysfs.
$ make -C pci-sim modules
$ sudo pci-sim/run_fake_pci_mdev_smoke.sh
The script performs the following checks:
Loads the module and sets the PF personality to
mdevvia thevf_personalitysysfs attribute.Verifies that the PF appears under
/sys/class/mdev_bus/.Confirms that the PF exposes two mdev types:
fake_pci_sriov_pf-sim_accel_smallandfake_pci_sriov_pf-sim_accel_large.Reads
available_instancesfor each type and verifies the expected counts (default 8 small, 2 large).Cleans up and unloads the module.
DevStack Nova/Cyborg serial echo test¶
After stacking with the pci-sim DevStack plugin and its generated test flavors, run the end-to-end helper from the repository root:
$ tools/run-devstack-serial-echo-test.sh
The helper uses openstack --os-cloud devstack-admin by default. It
creates one VM at a time on the private network using the
pci-sim-nova and pci-sim-cyborg flavors, opens the current
project’s default security group for ICMP and SSH, attaches a temporary
floating IP, SSHes into CirrOS with the default cirros/gocubsgo
credentials, verifies the passed-through serial PCI device, checks the UART
echo path, and then deletes the test VM and tagged floating IP. Use
--cleanup to remove leftovers from interrupted runs.