Re: [PATCH v2 16/22] vfio: selftests: Add vfio_pci_liveupdate_uapi_test

Vipin Sharma
2026-03-16T16:05:00Z

On Thu, Jan 29, 2026 at 09:25:03PM +0000, David Matlack wrote:
> +
> +TEST_F(vfio_pci_liveupdate_uapi_test, preserve_device)
> +{
> + int ret;
> +
> + ret = luo_session_preserve_fd(self->session_fd, self->device->fd, 0);
> +
> + /* Preservation should only be supported for VFIO cdev files. */
> + ASSERT_EQ(ret, self->iommu->iommufd ? 0 : -ENOENT);
> +}
> +
> +TEST_F(vfio_pci_liveupdate_uapi_test, preserve_group_fails)
> +{
> + int ret;
> +
> + if (self->iommu->iommufd)
> + return;

for iommufd variant, should we mark test as skipped instead of showing
it as passed?

> +int main(int argc, char *argv[])
> +{
> + int fd;
> +
> + fd = luo_open_device();
> + if (fd < 0) {
> + printf("open(%s) failed: %s, skipping\n", LUO_DEVICE, strerror(errno));
> + return KSFT_SKIP;

Both can be combined using ksft_exit_skip()