]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virt-aa-helper-test: Test hostdevs unconditionally
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 10 Jun 2025 12:30:40 +0000 (14:30 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Jul 2025 11:54:12 +0000 (13:54 +0200)
commit935bd37c4a7d840208923e89f3c7a74c5f4c16b4
tree196359f11311fc575499c60a01751b488d9059c3
parent9f12874238ddd771c19d68a0d5b8ed18bbb248df
virt-aa-helper-test: Test hostdevs unconditionally

Our test suite is very feature rich. In particular, it has two
mocks that implement sysfs close enough to create
host-independent environment to work with PCI and USB devices.
These mocks are called virpcimock and virusbmock, respectively.

Inside of virt-aa-helper-test there is an attempt to test whether
virt-aa-helper generates profiles for <hostdevs/>, once for USB
and the other time for PCI. Use this mocks to run virt-aa-helper
in an environment where certain PCI/USB devices always exist.

There are two problem though:

1) those two test cases use hardcoded PCI/USB addresses, which
   makes them host environment dependant,

2) neither of the test cases checks whether corresponding rule
   was added into the profile.

Using mocks we can get away with problem 1), and by passing the
fifth argument to testme() we can list an expected rule in the
profile.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virt-aa-helper-test