Motr  M0
spiel_ut.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_SPIEL
24 #include "lib/trace.h"
25 
26 #include "spiel/spiel.h"
27 #include "spiel/ut/spiel_ut_common.h" /* m0_spiel_ut_reqh */
28 #include "ut/misc.h" /* M0_UT_PATH */
29 #include "ut/ut.h"
30 
31 static struct m0_spiel_ut_reqh *spl_reqh;
32 
33 static void spiel_start_stop(void)
34 {
35  int rc;
36  struct m0_spiel spiel;
37  const char *profile = M0_UT_CONF_PROFILE;
38 
40  M0_UT_ASSERT(rc == 0);
41 
43  M0_UT_ASSERT(rc == 0);
44 
46  M0_UT_ASSERT(rc == 0);
47 
50 }
51 
52 
53 static int spiel_ut_init()
54 {
55  int rc;
56  const char *ep = SERVER_ENDPOINT_ADDR;
57  const char *client_ep = CLIENT_ENDPOINT_ADDR;
58 
61 
62  rc = m0_spiel__ut_reqh_init(spl_reqh, client_ep);
63  M0_UT_ASSERT(rc == 0);
64 
66  M0_UT_PATH("conf.xc"));
67  M0_UT_ASSERT(rc == 0);
68 
69  return 0;
70 }
71 
72 static int spiel_ut_fini()
73 {
76 
78 
79  return 0;
80 }
81 
83  .ts_name = "spiel-ut",
84  .ts_init = spiel_ut_init,
85  .ts_fini = spiel_ut_fini,
86  .ts_tests = {
87  { "spiel-start-stop", spiel_start_stop },
88  { NULL, NULL },
89  },
90 };
91 M0_EXPORTED(spiel_ut);
92 
93 #undef M0_TRACE_SUBSYSTEM
94 
95 /*
96  * Local variables:
97  * c-indentation-style: "K&R"
98  * c-basic-offset: 8
99  * tab-width: 8
100  * fill-column: 80
101  * scroll-step: 1
102  * End:
103  */
int m0_spiel_cmd_profile_set(struct m0_spiel *spiel, const char *profile_str)
Definition: spiel.c:100
#define M0_UT_CONF_PROFILE
Definition: misc.h:43
#define NULL
Definition: misc.h:38
struct m0_rpc_server_ctx sur_confd_srv
void m0_spiel_fini(struct m0_spiel *spiel)
Definition: spiel.c:59
void m0_spiel_rconfc_stop(struct m0_spiel *spiel)
Definition: spiel.c:91
M0_INTERNAL int m0_spiel__ut_reqh_init(struct m0_spiel_ut_reqh *spl_reqh, const char *ep_addr)
#define CLIENT_ENDPOINT_ADDR
Definition: common.h:32
Definition: ut.h:77
struct m0_ut_suite spiel_ut
Definition: spiel_ut.c:82
static void spiel_start_stop(void)
Definition: spiel_ut.c:33
Definition: sock.c:754
M0_INTERNAL void m0_spiel__ut_reqh_fini(struct m0_spiel_ut_reqh *spl_reqh)
M0_INTERNAL int m0_spiel__ut_rpc_server_start(struct m0_rpc_server_ctx *rpc_srv, const char *ha_ep, const char *confdb_path)
struct m0_reqh sur_reqh
static int spiel_ut_init()
Definition: spiel_ut.c:53
static struct m0_spiel_ut_reqh * spl_reqh
Definition: spiel_ut.c:31
const char * ts_name
Definition: ut.h:99
static int spiel_ut_fini()
Definition: spiel_ut.c:72
static struct m0_fid profile
Definition: rconfc.c:49
int m0_spiel_rconfc_start(struct m0_spiel *spiel, m0_rconfc_cb_t expired_cb)
Definition: spiel.c:66
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
struct m0_spiel spiel
Definition: spiel_conf_ut.c:42
#define SERVER_ENDPOINT_ADDR
Definition: common.h:30
M0_INTERNAL void m0_spiel__ut_rpc_server_stop(struct m0_rpc_server_ctx *rpc_srv)
#define M0_UT_PATH(name)
Definition: misc.h:41
void m0_free(void *data)
Definition: memory.c:146
int32_t rc
Definition: trigger_fop.h:47
#define M0_UT_ASSERT(a)
Definition: ut.h:46
int m0_spiel_init(struct m0_spiel *spiel, struct m0_reqh *reqh)
Definition: spiel.c:44