From 1549a3d6acc3e4d59440d7a509f0a330d322bbb1 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sat, 9 Sep 2023 00:11:48 +0100 Subject: [PATCH 1/2] test_negotiate: add migration testing Add migration support to the test setup, and complete some additional testing for the migration JSON capability. Signed-off-by: John Levon --- test/py/test_negotiate.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/py/test_negotiate.py b/test/py/test_negotiate.py index 74049026..6646b56e 100644 --- a/test/py/test_negotiate.py +++ b/test/py/test_negotiate.py @@ -55,6 +55,13 @@ def test_server_setup(): ctx = vfu_create_ctx() assert ctx is not None + ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, + size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW) + assert ret == 0 + + ret = vfu_setup_device_migration_callbacks(ctx) + assert ret == 0 + ret = vfu_realize_ctx(ctx) assert ret == 0 @@ -150,14 +157,9 @@ def test_invalid_json_bad_pgsize(): b'{ "migration": { "pgsize": "foo" } } }') -# -# FIXME: need vfu_setup_device_migration_callbacks() to be able to test this -# failure mode. -# def test_invalid_json_bad_pgsize2(): - if False: - client_version_json(errno.EINVAL, - b'{ "capabilities": { "migration": { "pgsize": 4095 } } }') + client_version_json(errno.EINVAL, + b'{ "capabilities": { "migration": { "pgsize": 4095 } } }') def test_valid_negotiate_no_json(): @@ -177,7 +179,7 @@ def test_valid_negotiate_no_json(): json = parse_json(json_str) assert json.capabilities.max_msg_fds == SERVER_MAX_FDS assert json.capabilities.max_data_xfer_size == SERVER_MAX_DATA_XFER_SIZE - # FIXME: migration object checks + assert json.capabilities.migration.pgsize == PAGE_SIZE client.disconnect(ctx) From c1c06c60efb264d7e55ac1b5348dda9e5dc79094 Mon Sep 17 00:00:00 2001 From: John Levon Date: Mon, 18 Sep 2023 13:39:03 +0000 Subject: [PATCH 2/2] fix up for migration checks --- test/py/test_negotiate.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/py/test_negotiate.py b/test/py/test_negotiate.py index 6646b56e..64840dfb 100644 --- a/test/py/test_negotiate.py +++ b/test/py/test_negotiate.py @@ -55,10 +55,6 @@ def test_server_setup(): ctx = vfu_create_ctx() assert ctx is not None - ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_MIGR_REGION_IDX, - size=2 << PAGE_SHIFT, flags=VFU_REGION_FLAG_RW) - assert ret == 0 - ret = vfu_setup_device_migration_callbacks(ctx) assert ret == 0