mock: move MOCK_SET{,_P} semicolons to call sites

This makes them look more like regular function calls and keeps the
coding style consistent.

Change-Id: I019980bb381abb0dec0aae041340a44bbffe23f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368205
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-07-05 09:12:16 -07:00 committed by Jim Harris
parent 7f6c737a25
commit 12d75f6323
2 changed files with 12 additions and 12 deletions

View File

@ -43,10 +43,10 @@
/* and getting values from the stub, the _P macros are */
/* for mocking functions that return pointer values */
#define MOCK_SET(fn, ret, val) \
ut_ ## fn = (ret){val};
ut_ ## fn = (ret){val}
#define MOCK_SET_P(fn, ret, val) \
ut_p_ ## fn = (ret){val};
ut_p_ ## fn = (ret){val}
#define MOCK_GET(fn) \
ut_ ## fn

View File

@ -165,21 +165,21 @@ test_nvme_ctrlr_probe(void)
struct spdk_nvme_ctrlr *dummy = NULL;
/* test when probe_cb returns false */
MOCK_SET(dummy_probe_cb, bool, false)
MOCK_SET(dummy_probe_cb, bool, false);
rc = nvme_ctrlr_probe(trid, devhandle, dummy_probe_cb, cb_ctx);
CU_ASSERT(rc == 1);
/* probe_cb returns true but we can't construct a ctrl */
MOCK_SET(dummy_probe_cb, bool, true)
MOCK_SET(dummy_probe_cb, bool, true);
MOCK_SET_P(nvme_transport_ctrlr_construct,
struct spdk_nvme_ctrlr *, NULL)
struct spdk_nvme_ctrlr *, NULL);
rc = nvme_ctrlr_probe(trid, devhandle, dummy_probe_cb, cb_ctx);
CU_ASSERT(rc == -1);
/* happy path */
g_spdk_nvme_driver = malloc(sizeof(struct nvme_driver));
SPDK_CU_ASSERT_FATAL(g_spdk_nvme_driver != NULL);
MOCK_SET(dummy_probe_cb, bool, true)
MOCK_SET(dummy_probe_cb, bool, true);
MOCK_SET_P(nvme_transport_ctrlr_construct,
struct spdk_nvme_ctrlr *, &ut_nvme_transport_ctrlr_construct);
TAILQ_INIT(&g_spdk_nvme_driver->init_ctrlrs);
@ -198,14 +198,14 @@ test_nvme_robust_mutex_init_shared(void)
int rc = 0;
/* test where both pthread calls succeed */
MOCK_SET(pthread_mutexattr_init, int, 0)
MOCK_SET(pthread_mutex_init, int, 0)
MOCK_SET(pthread_mutexattr_init, int, 0);
MOCK_SET(pthread_mutex_init, int, 0);
rc = nvme_robust_mutex_init_shared(&mtx);
CU_ASSERT(rc == 0);
/* test where we can't init attr's but init mutex works */
MOCK_SET(pthread_mutexattr_init, int, -1)
MOCK_SET(pthread_mutex_init, int, 0)
MOCK_SET(pthread_mutexattr_init, int, -1);
MOCK_SET(pthread_mutex_init, int, 0);
rc = nvme_robust_mutex_init_shared(&mtx);
/* for FreeBSD the only possible return value is 0 */
#ifndef __FreeBSD__
@ -215,8 +215,8 @@ test_nvme_robust_mutex_init_shared(void)
#endif
/* test where we can init attr's but the mutex init fails */
MOCK_SET(pthread_mutexattr_init, int, 0)
MOCK_SET(pthread_mutex_init, int, -1)
MOCK_SET(pthread_mutexattr_init, int, 0);
MOCK_SET(pthread_mutex_init, int, -1);
rc = nvme_robust_mutex_init_shared(&mtx);
/* for FreeBSD the only possible return value is 0 */
#ifndef __FreeBSD__