From fa3e0a68c16185ee75c1828870279aa852c7c8ee Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Tue, 9 Jul 2019 09:41:42 +0200 Subject: [PATCH] ut: move all spdk_env_* mocks to test_env.c Cleanup. Change-Id: If6c24ef6fcea5531007e6d4f10ee896939ffaa12 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460906 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto --- test/common/lib/test_env.c | 5 +++++ test/unit/lib/bdev/compress.c/compress_ut.c | 2 -- test/unit/lib/bdev/crypto.c/crypto_ut.c | 1 - test/unit/lib/event/app.c/app_ut.c | 1 - test/unit/lib/event/subsystem.c/subsystem_ut.c | 6 ------ test/unit/lib/iscsi/common.c | 2 -- test/unit/lib/iscsi/conn.c/conn_ut.c | 8 -------- test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c | 6 ------ test/unit/lib/nvmf/subsystem.c/subsystem_ut.c | 6 ------ test/unit/lib/vhost/test_vhost.c | 2 -- test/unit/lib/vhost/vhost.c/vhost_ut.c | 3 --- 11 files changed, 5 insertions(+), 37 deletions(-) diff --git a/test/common/lib/test_env.c b/test/common/lib/test_env.c index 9314f4948..1d1ee61ec 100644 --- a/test/common/lib/test_env.c +++ b/test/common/lib/test_env.c @@ -44,6 +44,11 @@ DEFINE_STUB(spdk_memzone_lookup, void *, (const char *name), NULL) DEFINE_STUB(spdk_pci_nvme_get_driver, struct spdk_pci_driver *, (void), NULL) DEFINE_STUB(spdk_pci_ioat_get_driver, struct spdk_pci_driver *, (void), NULL) DEFINE_STUB(spdk_pci_virtio_get_driver, struct spdk_pci_driver *, (void), NULL) +DEFINE_STUB(spdk_env_get_first_core, uint32_t, (void), 0); +DEFINE_STUB(spdk_env_get_next_core, uint32_t, (uint32_t prev_core), 0); +DEFINE_STUB(spdk_env_get_last_core, uint32_t, (void), 0); +DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); +DEFINE_STUB(spdk_env_get_socket_id, uint32_t, (uint32_t core), 0); /* * These mocks don't use the DEFINE_STUB macros because diff --git a/test/unit/lib/bdev/compress.c/compress_ut.c b/test/unit/lib/bdev/compress.c/compress_ut.c index dd96c7ff6..ea9dace5c 100644 --- a/test/unit/lib/bdev/compress.c/compress_ut.c +++ b/test/unit/lib/bdev/compress.c/compress_ut.c @@ -239,7 +239,6 @@ DEFINE_STUB(spdk_bdev_io_type_supported, bool, (struct spdk_bdev *bdev, DEFINE_STUB_V(spdk_bdev_module_release_bdev, (struct spdk_bdev *bdev)); DEFINE_STUB_V(spdk_bdev_close, (struct spdk_bdev_desc *desc)); DEFINE_STUB(spdk_bdev_get_name, const char *, (const struct spdk_bdev *bdev), 0); -DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); DEFINE_STUB(spdk_bdev_get_io_channel, struct spdk_io_channel *, (struct spdk_bdev_desc *desc), 0); DEFINE_STUB_V(spdk_bdev_unregister, (struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn, void *cb_arg)); @@ -251,7 +250,6 @@ DEFINE_STUB(spdk_bdev_module_claim_bdev, int, (struct spdk_bdev *bdev, struct sp DEFINE_STUB_V(spdk_bdev_module_examine_done, (struct spdk_bdev_module *module)); DEFINE_STUB(spdk_bdev_register, int, (struct spdk_bdev *bdev), 0); DEFINE_STUB(spdk_bdev_get_by_name, struct spdk_bdev *, (const char *bdev_name), NULL); -DEFINE_STUB(spdk_env_get_socket_id, uint32_t, (uint32_t core), 0); DEFINE_STUB(spdk_bdev_io_get_io_channel, struct spdk_io_channel *, (struct spdk_bdev_io *bdev_io), 0); DEFINE_STUB(spdk_bdev_queue_io_wait, int, (struct spdk_bdev *bdev, struct spdk_io_channel *ch, diff --git a/test/unit/lib/bdev/crypto.c/crypto_ut.c b/test/unit/lib/bdev/crypto.c/crypto_ut.c index 06e692b7c..72660fcb0 100644 --- a/test/unit/lib/bdev/crypto.c/crypto_ut.c +++ b/test/unit/lib/bdev/crypto.c/crypto_ut.c @@ -165,7 +165,6 @@ DEFINE_STUB(spdk_bdev_module_claim_bdev, int, (struct spdk_bdev *bdev, struct sp struct spdk_bdev_module *module), 0); DEFINE_STUB_V(spdk_bdev_module_examine_done, (struct spdk_bdev_module *module)); DEFINE_STUB(spdk_bdev_register, int, (struct spdk_bdev *vbdev), 0); -DEFINE_STUB(spdk_env_get_socket_id, uint32_t, (uint32_t core), 0); /* DPDK stubs */ DEFINE_STUB(rte_cryptodev_count, uint8_t, (void), 0); diff --git a/test/unit/lib/event/app.c/app_ut.c b/test/unit/lib/event/app.c/app_ut.c index 2be85a157..e67e50c05 100644 --- a/test/unit/lib/event/app.c/app_ut.c +++ b/test/unit/lib/event/app.c/app_ut.c @@ -42,7 +42,6 @@ DEFINE_STUB_V(spdk_event_call, (struct spdk_event *event)); DEFINE_STUB(spdk_event_allocate, struct spdk_event *, (uint32_t core, spdk_event_fn fn, void *arg1, void *arg2), NULL); -DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); DEFINE_STUB_V(spdk_subsystem_init, (spdk_msg_fn cb_fn, void *cb_arg)); DEFINE_STUB_V(spdk_rpc_register_method, (const char *method, spdk_rpc_method_handler func, uint32_t state_mask)); diff --git a/test/unit/lib/event/subsystem.c/subsystem_ut.c b/test/unit/lib/event/subsystem.c/subsystem_ut.c index 319c01399..e027f3de7 100644 --- a/test/unit/lib/event/subsystem.c/subsystem_ut.c +++ b/test/unit/lib/event/subsystem.c/subsystem_ut.c @@ -49,12 +49,6 @@ spdk_app_stop(int rc) global_rc = rc; } -uint32_t -spdk_env_get_current_core(void) -{ - return 0; -} - static void ut_event_fn(void *arg1) { diff --git a/test/unit/lib/iscsi/common.c b/test/unit/lib/iscsi/common.c index 1470594d5..9ea4e737c 100644 --- a/test/unit/lib/iscsi/common.c +++ b/test/unit/lib/iscsi/common.c @@ -128,8 +128,6 @@ spdk_app_parse_core_mask(const char *mask, struct spdk_cpuset *cpumask) return 0; } -DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); - DEFINE_STUB(spdk_event_allocate, struct spdk_event *, (uint32_t core, spdk_event_fn fn, void *arg1, void *arg2), NULL); diff --git a/test/unit/lib/iscsi/conn.c/conn_ut.c b/test/unit/lib/iscsi/conn.c/conn_ut.c index 988b5a5a5..63294ad10 100644 --- a/test/unit/lib/iscsi/conn.c/conn_ut.c +++ b/test/unit/lib/iscsi/conn.c/conn_ut.c @@ -49,14 +49,6 @@ static TAILQ_HEAD(, spdk_iscsi_task) g_ut_read_tasks = TAILQ_HEAD_INITIALIZER(g_ DEFINE_STUB(spdk_app_get_shm_id, int, (void), 0); -DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); - -DEFINE_STUB(spdk_env_get_first_core, uint32_t, (void), 0); - -DEFINE_STUB(spdk_env_get_last_core, uint32_t, (void), 0); - -DEFINE_STUB(spdk_env_get_next_core, uint32_t, (uint32_t prev_core), 0); - DEFINE_STUB(spdk_event_allocate, struct spdk_event *, (uint32_t lcore, spdk_event_fn fn, void *arg1, void *arg2), NULL); diff --git a/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c b/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c index 33d9fa7a6..62f970045 100644 --- a/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c +++ b/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c @@ -53,12 +53,6 @@ DEFINE_STUB(spdk_nvmf_transport_stop_listen, (struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid), 0); -uint32_t -spdk_env_get_current_core(void) -{ - return 0; -} - struct spdk_event * spdk_event_allocate(uint32_t core, spdk_event_fn fn, void *arg1, void *arg2) { diff --git a/test/unit/lib/nvmf/subsystem.c/subsystem_ut.c b/test/unit/lib/nvmf/subsystem.c/subsystem_ut.c index 811334f45..e03e57cc2 100644 --- a/test/unit/lib/nvmf/subsystem.c/subsystem_ut.c +++ b/test/unit/lib/nvmf/subsystem.c/subsystem_ut.c @@ -64,12 +64,6 @@ DEFINE_STUB(spdk_nvmf_transport_stop_listen, (struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid), 0); -uint32_t -spdk_env_get_current_core(void) -{ - return 0; -} - struct spdk_event * spdk_event_allocate(uint32_t core, spdk_event_fn fn, void *arg1, void *arg2) { diff --git a/test/unit/lib/vhost/test_vhost.c b/test/unit/lib/vhost/test_vhost.c index 437e12301..e4f4fe912 100644 --- a/test/unit/lib/vhost/test_vhost.c +++ b/test/unit/lib/vhost/test_vhost.c @@ -76,11 +76,9 @@ DEFINE_STUB_P(spdk_conf_section_get_nmval, char, (struct spdk_conf_section *sp, DEFINE_STUB_V(spdk_vhost_dev_mem_unregister, (struct spdk_vhost_dev *vdev)); DEFINE_STUB(spdk_vhost_event_send, int, (struct spdk_vhost_dev *vdev, spdk_vhost_event_fn cb_fn, void *arg, unsigned timeout_sec, const char *errmsg), 0); -DEFINE_STUB(spdk_env_get_socket_id, uint32_t, (uint32_t core), 0); DEFINE_STUB_V(spdk_vhost_dev_backend_event_done, (void *event_ctx, int response)); DEFINE_STUB_V(spdk_vhost_lock, (void)); DEFINE_STUB_V(spdk_vhost_unlock, (void)); -DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); DEFINE_STUB_V(spdk_vhost_call_external_event, (const char *ctrlr_name, spdk_vhost_event_fn fn, void *arg)); DEFINE_STUB(spdk_vhost_vring_desc_has_next, bool, (struct vring_desc *cur_desc), false); diff --git a/test/unit/lib/vhost/vhost.c/vhost_ut.c b/test/unit/lib/vhost/vhost.c/vhost_ut.c index 8d53f7fb1..c5316a7a6 100644 --- a/test/unit/lib/vhost/vhost.c/vhost_ut.c +++ b/test/unit/lib/vhost/vhost.c/vhost_ut.c @@ -84,9 +84,6 @@ spdk_app_parse_core_mask(const char *mask, struct spdk_cpuset *cpumask) return 0; } -DEFINE_STUB(spdk_env_get_first_core, uint32_t, (void), 0); -DEFINE_STUB(spdk_env_get_next_core, uint32_t, (uint32_t prev_core), 0); -DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0); DEFINE_STUB_V(spdk_event_call, (struct spdk_event *event)); DEFINE_STUB(rte_vhost_get_mem_table, int, (int vid, struct rte_vhost_memory **mem), 0); DEFINE_STUB(rte_vhost_get_negotiated_features, int, (int vid, uint64_t *features), 0);