Motr  M0
net.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_UT
23 
24 #include "ut/ut.h"
25 #include "addb2/net.h"
26 
27 static struct m0_addb2_net *net;
28 
29 static bool stopped;
30 static void stop_callback(struct m0_addb2_net *n, void *datum)
31 {
33  M0_UT_ASSERT(n == net);
34  M0_UT_ASSERT(datum == &stopped);
35  stopped = true;
36 }
37 
41 static void net_init_fini(void)
42 {
43  stopped = false;
45  M0_UT_ASSERT(net != NULL);
50 }
51 
53  .ts_name = "addb2-net",
54  .ts_init = NULL,
55  .ts_fini = NULL,
56  .ts_tests = {
57  { "net-init-fini", &net_init_fini },
58  { NULL, NULL }
59  }
60 };
61 
62 #undef M0_TRACE_SUBSYSTEM
63 
64 /*
65  * Local variables:
66  * c-indentation-style: "K&R"
67  * c-basic-offset: 8
68  * tab-width: 8
69  * fill-column: 80
70  * scroll-step: 1
71  * End:
72  */
static void net_init_fini(void)
Definition: net.c:41
M0_INTERNAL void m0_addb2_net_fini(struct m0_addb2_net *net)
Definition: net.c:142
#define NULL
Definition: misc.h:38
static void stop_callback(struct m0_addb2_net *n, void *datum)
Definition: net.c:30
Definition: ut.h:77
static bool stopped
Definition: net.c:29
M0_INTERNAL struct m0_addb2_net * m0_addb2_net_init(void)
Definition: net.c:128
struct m0_ut_suite addb2_net_ut
Definition: net.c:52
const char * ts_name
Definition: ut.h:99
uint64_t n
Definition: fops.h:107
M0_INTERNAL void m0_addb2_net_stop(struct m0_addb2_net *net, void(*callback)(struct m0_addb2_net *, void *), void *datum)
Definition: net.c:225
static struct m0_addb2_net * net
Definition: net.c:27
M0_INTERNAL void m0_addb2_net_tick(struct m0_addb2_net *net)
Definition: net.c:214
#define M0_UT_ASSERT(a)
Definition: ut.h:46