diff options
author | swapnili <swapnil.ingle@nutanix.com> | 2020-12-17 14:17:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 14:17:38 +0100 |
commit | ff70ca1a9f97feae62e326eca39624c13aa8117f (patch) | |
tree | 9e3c8933c2614bc12d4d4002de054444d1886ec5 /test/unit-tests.c | |
parent | ff260aa40b9b6f44e923d8efd209cc26a39aad33 (diff) | |
download | libvfio-user-ff70ca1a9f97feae62e326eca39624c13aa8117f.zip libvfio-user-ff70ca1a9f97feae62e326eca39624c13aa8117f.tar.gz libvfio-user-ff70ca1a9f97feae62e326eca39624c13aa8117f.tar.bz2 |
General fixes (#213)
* Reorg vfu_create_ctx()
* Unconditionally call dma_controller_create() in vfu_setup_device_dma_cb().
* Added UT for vfu_setup_device_dma_cb()
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/unit-tests.c')
-rw-r--r-- | test/unit-tests.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unit-tests.c b/test/unit-tests.c index 59b24dc..6355843 100644 --- a/test/unit-tests.c +++ b/test/unit-tests.c @@ -680,6 +680,15 @@ test_dma_map_sg(void **state __attribute__((unused))) } +static void +test_vfu_setup_device_dma_cb(void **state __attribute__((unused))) +{ + vfu_ctx_t vfu_ctx = { 0 }; + + assert_int_equal(0, vfu_setup_device_dma_cb(&vfu_ctx, NULL, NULL)); + assert_non_null(vfu_ctx.dma); +} + /* * FIXME we shouldn't have to specify a setup function explicitly for each unit * test, cmocka should provide that. E.g. cmocka_run_group_tests enables us to @@ -712,7 +721,8 @@ int main(void) cmocka_unit_test_setup(test_get_region_info, setup), cmocka_unit_test_setup(test_setup_sparse_region, setup), cmocka_unit_test_setup(test_dma_map_return_value, setup), - cmocka_unit_test_setup(test_dma_map_sg, setup) + cmocka_unit_test_setup(test_dma_map_sg, setup), + cmocka_unit_test_setup(test_vfu_setup_device_dma_cb, setup) }; return cmocka_run_group_tests(tests, NULL, NULL); |