ut: Use unit/lib/json_mock.c for stubs
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I2cd488c17dbc92c381cd956ae0d6f5ca709a24dc Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11263 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
def45b4c07
commit
cc797456f4
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -36,9 +37,7 @@
|
||||
#include "thread/thread_internal.h"
|
||||
#include "common/lib/test_env.c"
|
||||
#include "accel/accel_engine.c"
|
||||
|
||||
DEFINE_STUB(spdk_json_write_array_begin, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_json_write_array_end, int, (struct spdk_json_write_ctx *w), 0);
|
||||
#include "unit/lib/json_mock.c"
|
||||
|
||||
/* global vars and setup/cleanup functions used for all test functions */
|
||||
struct spdk_accel_engine g_accel_engine = {};
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -40,6 +41,8 @@
|
||||
|
||||
#include "spdk_internal/mock.h"
|
||||
|
||||
#include "unit/lib/json_mock.c"
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT(iscsi)
|
||||
|
||||
DEFINE_STUB(iscsi_get_pdu, struct spdk_iscsi_pdu *,
|
||||
@ -47,12 +50,6 @@ DEFINE_STUB(iscsi_get_pdu, struct spdk_iscsi_pdu *,
|
||||
DEFINE_STUB(iscsi_param_eq_val, int,
|
||||
(struct iscsi_param *params, const char *key, const char *val), 0);
|
||||
DEFINE_STUB(iscsi_pdu_calc_data_digest, uint32_t, (struct spdk_iscsi_pdu *pdu), 0);
|
||||
DEFINE_STUB(spdk_json_write_object_begin, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_json_write_named_int32, int, (struct spdk_json_write_ctx *w,
|
||||
const char *name, int32_t val), 0);
|
||||
DEFINE_STUB(spdk_json_write_named_string, int, (struct spdk_json_write_ctx *w,
|
||||
const char *name, const char *val), 0);
|
||||
DEFINE_STUB(spdk_json_write_object_end, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB_V(spdk_sock_writev_async,
|
||||
(struct spdk_sock *sock, struct spdk_sock_request *req));
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -40,23 +41,14 @@
|
||||
|
||||
#include "rpc/rpc.c"
|
||||
|
||||
#include "unit/lib/json_mock.c"
|
||||
|
||||
static int g_rpc_err;
|
||||
void fn_rpc_method_handler(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params);
|
||||
|
||||
DEFINE_STUB_V(spdk_jsonrpc_end_result, (struct spdk_jsonrpc_request *request,
|
||||
struct spdk_json_write_ctx *w));
|
||||
DEFINE_STUB(spdk_json_write_array_begin, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_json_write_string, int, (struct spdk_json_write_ctx *w, const char *val), 0);
|
||||
DEFINE_STUB(spdk_json_write_object_begin, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_json_write_named_string_fmt, int, (struct spdk_json_write_ctx *w, const char *name,
|
||||
const char *fmt, ...), 0);
|
||||
DEFINE_STUB(spdk_json_write_named_object_begin, int, (struct spdk_json_write_ctx *w,
|
||||
const char *name), 0);
|
||||
DEFINE_STUB(spdk_json_write_named_uint32, int, (struct spdk_json_write_ctx *w, const char *name,
|
||||
uint32_t val), 0);
|
||||
DEFINE_STUB(spdk_json_write_object_end, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_json_write_array_end, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_jsonrpc_begin_result, struct spdk_json_write_ctx *,
|
||||
(struct spdk_jsonrpc_request *request), (void *)1);
|
||||
DEFINE_STUB(spdk_json_decode_bool, int, (const struct spdk_json_val *val, void *out), 0);
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2020 Mellanox Technologies LTD. All rights reserved.
|
||||
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -44,6 +45,8 @@
|
||||
#include "spdk_internal/mock.h"
|
||||
#include "common/lib/test_env.c"
|
||||
|
||||
#include "unit/lib/json_mock.c"
|
||||
|
||||
#define UT_IP "test_ip"
|
||||
#define UT_PORT 1234
|
||||
|
||||
@ -70,33 +73,6 @@ struct spdk_ut_sock_group_impl {
|
||||
#define __ut_sock(sock) (struct spdk_ut_sock *)sock
|
||||
#define __ut_group(group) (struct spdk_ut_sock_group_impl *)group
|
||||
|
||||
DEFINE_STUB(spdk_json_write_array_begin, int,
|
||||
(struct spdk_json_write_ctx *w), 0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_object_begin, int,
|
||||
(struct spdk_json_write_ctx *w), 0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_named_string, int,
|
||||
(struct spdk_json_write_ctx *w, const char *name,
|
||||
const char *val), 0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_named_object_begin, int,
|
||||
(struct spdk_json_write_ctx *w, const char *name), 0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_named_uint32, int,
|
||||
(struct spdk_json_write_ctx *w, const char *name, uint32_t val),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_named_bool, int,
|
||||
(struct spdk_json_write_ctx *w, const char *name, bool val),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_object_end, int,
|
||||
(struct spdk_json_write_ctx *w), 0);
|
||||
|
||||
DEFINE_STUB(spdk_json_write_array_end, int,
|
||||
(struct spdk_json_write_ctx *w), 0);
|
||||
|
||||
static int
|
||||
spdk_ut_sock_getaddr(struct spdk_sock *_sock, char *saddr, int slen, uint16_t *sport,
|
||||
char *caddr, int clen, uint16_t *cport)
|
||||
|
Loading…
Reference in New Issue
Block a user