diff options
author | John Levon <john.levon@nutanix.com> | 2021-04-19 13:10:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 13:10:02 +0100 |
commit | 3acb97477f261bf11c866b5764deabe693607bc3 (patch) | |
tree | 36e50e822962b8fbe4db9313d916cf3b84716290 /test | |
parent | 445ec5463f26cbfbc0630b6bf907cc9709918013 (diff) | |
download | libvfio-user-3acb97477f261bf11c866b5764deabe693607bc3.zip libvfio-user-3acb97477f261bf11c866b5764deabe693607bc3.tar.gz libvfio-user-3acb97477f261bf11c866b5764deabe693607bc3.tar.bz2 |
vfu_realize_ctx(): fix default PCI config space region (#445)
Fix check for an un-configured PCI config space region (the previous method was
not accounting for the initialized ->fd).
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit-tests.c b/test/unit-tests.c index 7f03fb7..9aa1106 100644 --- a/test/unit-tests.c +++ b/test/unit-tests.c @@ -737,6 +737,18 @@ test_vfu_ctx_create(void **state UNUSED) will_return(close, 0); vfu_destroy_ctx(vfu_ctx); + + /* Test "bare" vfu_create_ctx(). */ + vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, "", LIBVFIO_USER_FLAG_ATTACH_NB, + NULL, VFU_DEV_TYPE_PCI); + assert_non_null(vfu_ctx); + + assert_int_equal(0, vfu_realize_ctx(vfu_ctx)); + + expect_value(close, fd, ((tran_sock_t *)vfu_ctx->tran_data)->fd); + will_return(close, 0); + + vfu_destroy_ctx(vfu_ctx); } bool pci_caps_writing = true; |