aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-01-04 17:53:10 +0000
committerGitHub <noreply@github.com>2021-01-04 17:53:10 +0000
commit1fa90d5abecd896362e551b2bd2ec987d8f60a6b (patch)
tree6bcb22c92d2bf52c1baf6786a644d4abbbd09604 /test
parent715b7963312002980b9eea5a695719cfdf2bf6e4 (diff)
downloadlibvfio-user-1fa90d5abecd896362e551b2bd2ec987d8f60a6b.zip
libvfio-user-1fa90d5abecd896362e551b2bd2ec987d8f60a6b.tar.gz
libvfio-user-1fa90d5abecd896362e551b2bd2ec987d8f60a6b.tar.bz2
re-work PCI config setup API (#198)
Split up vfu_pci_setup_config_hdr(): individual "helpers" like vfu_pci_set_id() are much simpler to use than making the user specify the values in header-formatted structs; and this way if we want to add additional helpers, we won't need to modify the existing functions. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test')
-rw-r--r--test/unit-tests.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/test/unit-tests.c b/test/unit-tests.c
index 9063038..a304e02 100644
--- a/test/unit-tests.c
+++ b/test/unit-tests.c
@@ -516,9 +516,6 @@ static void
test_vfu_ctx_create(void **state __attribute__((unused)))
{
vfu_ctx_t *vfu_ctx = NULL;
- vfu_pci_hdr_id_t id = { 0 };
- vfu_pci_hdr_ss_t ss = { 0 };
- vfu_pci_hdr_cc_t cc = { { 0 } };
vfu_cap_t pm = {.pm = {.hdr.id = PCI_CAP_ID_PM}};
vfu_cap_t *caps[] = { &pm };
@@ -527,9 +524,8 @@ test_vfu_ctx_create(void **state __attribute__((unused)))
assert_non_null(vfu_ctx);
assert_int_equal(1, vfu_ctx->irq_count[VFU_DEV_ERR_IRQ]);
assert_int_equal(1, vfu_ctx->irq_count[VFU_DEV_REQ_IRQ]);
- assert_int_equal(0,
- vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc,
- VFU_PCI_TYPE_CONVENTIONAL, 0));
+ assert_int_equal(0, vfu_pci_init(vfu_ctx, VFU_PCI_TYPE_CONVENTIONAL,
+ PCI_HEADER_TYPE_NORMAL, 0));
assert_int_equal(0, vfu_pci_setup_caps(vfu_ctx, caps, 1));
assert_int_equal(0, vfu_realize_ctx(vfu_ctx));
}