Motr  M0
cs_ut_main.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-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 #include "motr/setup.c"
24 
25 #include "net/bulk_mem.h" /* m0_net_bulk_mem_xprt */
26 #include "ut/cs_fop.h" /* CS_UT_SERVICE1 */
27 #include "ut/misc.h" /* M0_UT_PATH */
28 #include "ut/ut.h"
29 #include "motr/iem.h"
30 #include "rm/st/wlock_helper.h"
31 
32 #include "net/bulk_mem.h" /* m0_net_bulk_mem_xprt */
33 
34 #define SERVER_ENDPOINT_ADDR "0@lo:12345:34:1"
35 #define SERVER_ENDPOINT M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR
36 
37 extern const struct m0_tl_descr ndoms_descr;
38 
39 /* Client context */
40 struct cl_ctx {
41  /* Client network domain.*/
42  struct m0_net_domain cl_ndom;
43  /* Client rpc context.*/
45 };
46 
47 /* Configures motr environment with given parameters. */
48 static char *cs_ut_service_one_cmd[] = { "m0d", "-T", "linux",
49  "-D", "cs_sdb", "-S", "cs_stob",
50  "-A", "linuxstob:cs_addb_stob",
51  "-e", SERVER_ENDPOINT,
53  "-w", "10",
54  "-f", M0_UT_CONF_PROCESS,
55  "-c", M0_UT_PATH("conf.xc")};
56 
57 static char *cs_ut_services_many_cmd[] = { "m0d", "-T", "AD",
58  "-D", "cs_sdb", "-S", "cs_stob",
59  "-A", "linuxstob:cs_addb_stob",
60  "-w", "10",
61  "-e", SERVER_ENDPOINT,
62  "-e", "bulk-mem:127.0.0.1:35678",
64  "-f", M0_UT_CONF_PROCESS,
65  "-c", M0_UT_PATH("conf.xc")};
66 
67 static char *cs_ut_opts_jumbled_cmd[] = { "m0d", "-D",
68  "cs_sdb", "-T", "AD",
69  "-w", "10",
70  "-e", SERVER_ENDPOINT,
72  "-S", "cs_stob", "-A", "linuxstob:cs_addb_stob",
73  "-f", M0_UT_CONF_PROCESS,
74  "-c", M0_UT_PATH("conf.xc")};
75 
76 static char *cs_ut_dev_stob_cmd[] = { "m0d", "-T", "AD",
77  "-D", "cs_sdb", "-S", "cs_stob",
78  "-A", "linuxstob:cs_addb_stob",
79  "-w", "10",
80  "-U",
81  "-e", SERVER_ENDPOINT,
83  "-f", M0_UT_CONF_PROCESS,
84  "-c", M0_UT_PATH("conf.xc")};
85 
86 static char *cs_ut_stype_bad_cmd[] = { "m0d", "-T", "asdadd",
87  "-D", "cs_sdb", "-S", "cs_stob",
88  "-A", "linuxstob:cs_addb_sdb",
89  "-w", "10",
90  "-e", SERVER_ENDPOINT,
92  "-f", M0_UT_CONF_PROCESS,
93  "-c", M0_UT_PATH("conf.xc")};
94 
95 static char *cs_ut_xprt_bad_cmd[] = { "m0d", "-T", "AD",
96  "-D", "cs_sdb", "-S", "cs_stob",
97  "-A", "linuxstob:cs_addb_sdb",
98  "-w", "10",
99  "-e", "asdasdada:172.18.50.40@o2ib1:34567:2",
100  "-f", M0_UT_CONF_PROCESS,
101  "-c", M0_UT_PATH("conf.xc")};
102 
103 static char *cs_ut_ep_bad_cmd[] = { "m0d", "-T", "AD",
104  "-D", "cs_sdb", "-S", "cs_stob",
105  "-A", "linuxstob:cs_addb_sdb", "-w", "10",
106  "-e", "lnet:asdad:asdsd:sadasd",
107  "-f", M0_UT_CONF_PROCESS,
108  "-c", M0_UT_PATH("conf.xc")};
109 
110 static char *cs_ut_service_bad_cmd[] = { "m0d", "-T", "AD",
111  "-D", "cs_sdb", "-S", "cs_stob",
112  "-A", "linuxstob:cs_addb_sdb", "-w", "10",
113  "-e", "lnet:172.18.50.40@o2ib1:12345:34:1",
114  "-f", M0_UT_CONF_PROCESS,
115  "-c", M0_UT_PATH("conf.xc")};
116 
117 static char *cs_ut_args_bad_cmd[] = { "m0d", "-D", "cs_sdb",
118  "-S", "cs_stob", "-A", "linuxstob:cs_addb_sdb",
119  "-w", "10",
120  "-e", "lnet:172.18.50.40@o2ib1:12345:34:1",
121  "-f", M0_UT_CONF_PROCESS,
122  "-c", M0_UT_PATH("conf.xc")};
123 
124 static char *cs_ut_buffer_pool_cmd[] = { "m0d", "-T", "linux",
125  "-D", "cs_sdb", "-S", "cs_stob",
126  "-A", "linuxstob:cs_addb_stob", "-w", "10",
127  "-e", SERVER_ENDPOINT,
128  "-H", SERVER_ENDPOINT_ADDR,
129  /*
130  * -m is temporary set to 32768.
131  * It's required to handle m0_ha_msg transfer.
132  */
133  "-q", "4", "-m", "32768",
134  "-f", M0_UT_CONF_PROCESS,
135  "-c", M0_UT_PATH("conf.xc")};
136 
137 static char *cs_ut_lnet_cmd[] = { "m0d", "-T", "linux",
138  "-D", "cs_sdb", "-S", "cs_stob",
139  "-A", "linuxstob:cs_addb_sdb",
140  "-w", "10",
141  "-e", SERVER_ENDPOINT,
142  "-H", SERVER_ENDPOINT_ADDR,
143  "-f", M0_UT_CONF_PROCESS,
144  "-c", M0_UT_PATH("conf.xc")};
145 
146 static char *cs_ut_lnet_mult_if_cmd[] = { "m0d", "-T", "linux",
147  "-D", "cs_sdb", "-S", "cs_stob",
148  "-A", "linuxstob:cs_addb_stob",
149  "-w", "10",
150  "-e", SERVER_ENDPOINT,
151  "-e", "lnet:172.18.50.40@tcp:12345:30:101",
152  "-e", "lnet:172.18.50.40@o2ib0:12345:34:101",
153  "-H", SERVER_ENDPOINT_ADDR,
154  "-f", M0_UT_CONF_PROCESS,
155  "-c", M0_UT_PATH("conf.xc")};
156 
159 static char *cs_ut_ep_mixed_dup_cmd[] = { "m0d", "-T", "AD",
160  "-D", "cs_sdb", "-S", "cs_stob",
161  "-A", "linuxstob:cs_addb_stob",
162  "-w", "10",
163  "-e", SERVER_ENDPOINT,
164  "-e", "lnet:172.18.50.40@tcp:12345:30:101",
165  "-e", "lnet:172.18.50.40@o2ib0:12345:34:101",
166  "-e", "lnet:172.18.50.40@o2ib1:12345:30:101",
167  "-e", "lnet:172.18.50.40@o2ib1:12345:30:101",
168  "-H", SERVER_ENDPOINT_ADDR,
169  "-f", M0_UT_CONF_PROCESS,
170  "-c", M0_UT_PATH("conf.xc")};
171 
172 static char *cs_ut_lnet_dup_tcp_if_cmd[] = { "m0d", "-T", "AD",
173  "-D", "cs_sdb", "-S", "cs_stob",
174  "-A", "linuxstob:cs_addb_stob",
175  "-w", "10",
176  "-e", SERVER_ENDPOINT,
177  "-e", "lnet:172.18.50.40@tcp:12345:30:101",
178  "-e", "lnet:172.18.50.40@tcp:12345:32:105",
179  "-H", SERVER_ENDPOINT_ADDR,
180  "-f", M0_UT_CONF_PROCESS,
181  "-c", M0_UT_PATH("conf.xc")};
182 
183 static char *cs_ut_lnet_ep_bad_cmd[] = { "m0d", "-T", "AD",
184  "-D", "cs_sdb", "-S", "cs_stob",
185  "-A", "linuxstob:cs_addb_stob",
186  "-w", "10",
187  "-e", "lnet:asdad:asdsd:sadasd",
188  "-f", M0_UT_CONF_PROCESS,
189  "-c", M0_UT_PATH("conf.xc")};
190 
191 static const char *cdbnames[] = { "cdb1", "cdb2" };
192 static const char *cl_ep_addrs[] = { "0@lo:12345:34:2", "127.0.0.1:34569" };
193 static const char *srv_ep_addrs[] = { SERVER_ENDPOINT_ADDR, "127.0.0.1:35678" };
194 
195 enum { MAX_RPCS_IN_FLIGHT = 10 };
196 
197 #define SERVER_LOG_FILE_NAME "cs_ut.errlog"
198 
199 static int cs_ut_client_init(struct cl_ctx *cctx, const char *cl_ep_addr,
200  const char *srv_ep_addr, const char* dbname,
201  const struct m0_net_xprt *xprt)
202 {
203  int rc;
204  struct m0_rpc_client_ctx *cl_ctx;
205 
206  M0_PRE(cctx != NULL && cl_ep_addr != NULL && srv_ep_addr != NULL &&
207  dbname != NULL && xprt != NULL);
208 
209  rc = m0_net_domain_init(&cctx->cl_ndom, xprt);
210  M0_UT_ASSERT(rc == 0);
211 
212  cl_ctx = &cctx->cl_ctx;
213 
214  cl_ctx->rcx_net_dom = &cctx->cl_ndom;
215  cl_ctx->rcx_local_addr = cl_ep_addr;
216  cl_ctx->rcx_remote_addr = srv_ep_addr;
217  cl_ctx->rcx_max_rpcs_in_flight = MAX_RPCS_IN_FLIGHT;
218  cl_ctx->rcx_fid = &g_process_fid;
219 
221  M0_UT_ASSERT(rc == 0);
222 
223  return rc;
224 }
225 
226 static void cs_ut_client_fini(struct cl_ctx *cctx)
227 {
228  int rc;
229 
230  rc = m0_rpc_client_stop(&cctx->cl_ctx);
231  M0_UT_ASSERT(rc == 0);
232 
233  m0_net_domain_fini(&cctx->cl_ndom);
234 }
235 
237 int m0_cs_ut_send_fops(struct m0_rpc_session *cl_rpc_session, int dstype)
238 {
239  int rc;
240  uint32_t i;
241  struct m0_fop *fop[10] = { 0 };
242  struct cs_ds1_req_fop *cs_ds1_fop;
243  struct cs_ds2_req_fop *cs_ds2_fop;
244 
245  M0_PRE(cl_rpc_session != NULL && dstype > 0);
246 
247  switch (dstype) {
248  case CS_UT_SERVICE1:
249  for (i = 0; i < 10; ++i) {
250  fop[i] = m0_fop_alloc_at(cl_rpc_session,
252  cs_ds1_fop = m0_fop_data(fop[i]);
253  cs_ds1_fop->csr_value = i;
254  rc = m0_rpc_post_sync(fop[i], cl_rpc_session,
256  0 /* deadline */);
257  M0_UT_ASSERT(rc == 0);
259  }
260  break;
261  case CS_UT_SERVICE2:
262  for (i = 0; i < 10; ++i) {
263  fop[i] = m0_fop_alloc_at(cl_rpc_session,
265  cs_ds2_fop = m0_fop_data(fop[i]);
266  cs_ds2_fop->csr_value = i;
267  rc = m0_rpc_post_sync(fop[i], cl_rpc_session,
269  0 /* deadline */);
270  M0_UT_ASSERT(rc == 0);
272  }
273  break;
274  default:
275  M0_ASSERT("Invalid service type" == 0);
276  rc = -EINVAL;
277  break;
278  }
279 
280  return rc;
281 }
282 
283 static int cs_ut_test_helper_success(struct cl_ctx *cctx, size_t cctx_nr,
284  char *cs_argv[], int cs_argc)
285 {
286  int rc;
287  int i;
288  int stype;
289  struct m0_net_xprt *xprts[] = {
292  };
293  struct m0_rpc_server_ctx sctx = {
294  .rsx_xprts = xprts,
295  .rsx_xprts_nr = ARRAY_SIZE(xprts),
296  .rsx_argv = cs_argv,
297  .rsx_argc = cs_argc,
298  .rsx_log_file_name = SERVER_LOG_FILE_NAME
299  };
300 
302  M0_UT_ASSERT(rc == 0);
303  for (i = 0; i < cctx_nr; ++i) {
306  sctx.rsx_xprts[i]);
307  M0_UT_ASSERT(rc == 0);
308  }
309 
311  for (i = 0; i < cctx_nr; ++i, ++stype)
312  m0_cs_ut_send_fops(&cctx[i].cl_ctx.rcx_session, stype);
313 
314  for (i = 0; i < cctx_nr; ++i)
316 
318 
319  return rc;
320 }
321 
322 static void cs_ut_test_helper_failure(char *cs_argv[], int cs_argc)
323 {
324  int rc;
325  struct m0_net_xprt *xprts[] = {
328  };
329  struct m0_rpc_server_ctx sctx = {
330  .rsx_xprts = xprts,
331  .rsx_xprts_nr = ARRAY_SIZE(xprts),
332  .rsx_argv = cs_argv,
333  .rsx_argc = cs_argc,
334  .rsx_log_file_name = SERVER_LOG_FILE_NAME
335  };
336 
338  M0_UT_ASSERT(rc != 0);
339 
340  /*
341  * If, for some reason, m0_rpc_server_start() completed without error,
342  * we need to stop server.
343  */
344  if (rc == 0)
346 }
347 
348 static void test_cs_ut_cs_start_err(void)
349 {
350  m0_fi_enable_once("cs_level_enter", "pools_cleanup");
353 }
354 
355 static void test_cs_ut_service_one(void)
356 {
357  struct cl_ctx cctx[1] = {};
358 
361 }
362 
363 static void dev_conf_file_create(void)
364 {
365  FILE *f;
366  char cwd[MAXPATHLEN];
367  char *path;
368 
369  path = getcwd(cwd, ARRAY_SIZE(cwd));
370  M0_UT_ASSERT(path != NULL);
371 
372  /* touch d1 d2 */
373  f = fopen("d1", "w");
374  M0_UT_ASSERT(f != NULL);
375  fclose(f);
376  f = fopen("d2", "w");
377  M0_UT_ASSERT(f != NULL);
378  fclose(f);
379 }
380 
381 static void test_cs_ut_dev_stob(void)
382 {
383  struct cl_ctx cctx[1] = {};
384 
388 }
389 
390 static void test_cs_ut_services_many(void)
391 {
392  struct cl_ctx cctx[2] = {};
393 
397 }
398 
399 static void test_cs_ut_opts_jumbled(void)
400 {
401  struct cl_ctx cctx[1] = {};
402 
406 }
407 
410 {
412  m0_fi_enable_once("storage_dev_new", "ad_domain_locate_fail");
415 }
416 
417 static void test_cs_ut_stype_bad(void)
418 {
421 }
422 
423 static void test_cs_ut_xprt_bad(void)
424 {
427 }
428 
429 static void test_cs_ut_ep_bad(void)
430 {
433 }
434 
435 static void test_cs_ut_lnet_ep_bad(void)
436 {
439 }
440 
442 {
443  /* Duplicate tcp interfaces in a request handler context. */
446 }
447 
449 {
450  struct m0_motr motr_ctx = {};
451  int rc;
452 
454  stderr, true);
455  M0_UT_ASSERT(rc == 0);
456 
459  M0_UT_ASSERT(rc == 0);
460 
461  rc = cs_reqh_ctx_validate(&motr_ctx);
462  M0_UT_ASSERT(rc == 0);
463 
464  m0_cs_fini(&motr_ctx);
465 }
466 
468 {
469  struct m0_motr motr_ctx = {};
470  FILE *out;
471  int rc;
472 
473  out = fopen("temp", "w");
474 
476  out, true);
477  M0_UT_ASSERT(rc == 0);
478 
481  M0_UT_ASSERT(rc == 0);
482 
483  rc = cs_reqh_ctx_validate(&motr_ctx);
484  M0_UT_ASSERT(rc != 0);
485 
486  m0_cs_fini(&motr_ctx);
487  fclose(out);
488 }
489 
490 static void test_cs_ut_service_bad(void)
491 {
494 }
495 
496 static void test_cs_ut_args_bad(void)
497 {
500 }
501 
502 static void test_cs_ut_buffer_pool(void)
503 {
504  struct cl_ctx cctx[1] = {};
505 
508 }
509 
510 static void test_cs_ut_lnet(void)
511 {
512  struct cl_ctx cctx[1] = {};
513 
516 }
517 
518 static void test_cs_ut_setup_fail(void)
519 {
520  /* m0_pools_common_init() is to fail inside cs_conf_setup() */
521  m0_fi_enable_once("m0_conf_devices_count", "diter_fail");
524  /* m0_pools_setup() is to fail inside cs_conf_setup() */
525  m0_fi_enable_once("m0_pools_setup", "diter_fail");
528 
529  /* cs_conf_services_init() is to fail inside cs_conf_setup() */
530  m0_fi_enable_once("cs_conf_services_init", "diter_fail");
533 }
534 
535 static void test_cs_ut_rconfc_fail(void)
536 {
537  /* Standalone confc instance the dummy HA to work on */
538  M0_INTERNAL struct m0_confc *m0_ha_entrypoint_confc_override(void);
539  /*
540  * Server configuration making no local conf available. Therefore, motr
541  * instance is to request entrypoint info during rconfc start.
542  */
543  static char *setup_conf[] = { "m0d", "-T", "linux",
544  "-D", "cs_sdb", "-S", "cs_stob",
545  "-A", "linuxstob:cs_addb_stob",
546  "-e", SERVER_ENDPOINT,
547  "-H", SERVER_ENDPOINT_ADDR,
548  "-w", "10" };
550  char *confstr;
551  int rc;
552 
553  /*
554  * We have to let dummy HA respond with entrypoint info working on a
555  * standalone confc instead of the one returned by m0_reqh2confc(). So
556  * need to pre-load it with standard configuration beforehand.
557  */
558  rc = m0_file_read(M0_UT_PATH("conf.xc"), &confstr);
559  M0_UT_ASSERT(rc == 0);
561  confstr);
562  M0_UT_ASSERT(rc == 0);
563  m0_free0(&confstr);
564  /* Now wire it up */
565  m0_fi_enable("motr_ha_entrypoint_request_cb", "ut_confc");
566  /*
567  * m0_rconfc_start_sync() is to fail inside cs_conf_setup() because
568  * dummy HA breaks rconfc operation by reporting no RMS.
569  */
570  m0_fi_enable("motr_ha_entrypoint_rep_rm_fill", "no_rms_fid");
571  cs_ut_test_helper_failure(setup_conf, ARRAY_SIZE(setup_conf));
572 
574  m0_fi_disable("motr_ha_entrypoint_rep_rm_fill", "no_rms_fid");
575  m0_fi_disable("motr_ha_entrypoint_request_cb", "ut_confc");
576 }
577 
578 extern volatile sig_atomic_t gotsignal;
579 
580 static void cs_ut_term_sig_handler(int signum)
581 {
582  gotsignal = signum;
583 }
584 
585 static int cs_ut_register_signal(void)
586 {
587  struct sigaction term_act;
588  int rc;
589 
590  gotsignal = 0;
591  term_act.sa_handler = cs_ut_term_sig_handler;
592  sigemptyset(&term_act.sa_mask);
593  term_act.sa_flags = 0;
594 
595  rc = sigaction(SIGUSR2, &term_act, NULL);
596  M0_UT_ASSERT(rc == 0);
597  return rc;
598 }
599 
601 {
602  struct m0_rpc_machine *rmach;
603 
604  rmach = m0_reqh_rpc_mach_tlist_head(&reqh->rh_rpc_machines);
605  M0_UT_ASSERT(rmach != NULL);
606  return rmach;
607 }
608 
610 {
613  M0_UT_ASSERT(rc == 0);
614  sleep(2);
616 }
617 
628 static void test_cs_ut_rconfc_fatal(void)
629 {
630  struct m0_rpc_server_ctx sctx = {
632  .rsx_argc = ARRAY_SIZE(cs_ut_service_one_cmd),
633  .rsx_log_file_name = SERVER_LOG_FILE_NAME
634  };
636  struct m0_rconfc rconfc;
637  int rc;
638 
641 
643  M0_UT_ASSERT(rc == 0);
644  /* Prepare and launch standalone rconfc */
646  m0_locality0_get()->lo_grp,
648  M0_UT_ASSERT(rc == 0);
650  M0_UT_ASSERT(rc == 0);
651  /*
652  * Register SIGUSR2 handler. The signal is to be sent by
653  * cs_rconfc_fatal_cb() and caught by cs_ut_term_sig_handler().
654  */
656  M0_UT_ASSERT(gotsignal == 0);
657  M0_UT_ASSERT(rc == 0);
658  /* Install fatal callback to the rconfc instance. */
662  /* Make sure read lock go and come does not cause any issue. */
664  sleep(1);
665  M0_UT_ASSERT(gotsignal == 0);
666  /* Imitate issue with read lock acquisition. */
667  m0_fi_enable_once("cs_rconfc_fatal_cb", "ut_signal");
668  m0_fi_enable_once("rconfc_read_lock_complete", "rlock_req_failed");
669  m0_fi_enable_once("_failure_ast_cb", "rlock_req_failed");
671  sleep(1);
672  /* Make sure SIGUSR2 has been got. */
673  M0_UT_ASSERT(gotsignal == SIGUSR2);
674  /* Make sure failed rconfc is able to stop regular way. */
678 
680 }
681 
682 static void test_cs_ut_iem(void)
683 {
686 
689  "DUMMY Description, Dummy number[%d], Dummy text [%s]",
690  __LINE__, __FUNCTION__);
691 
694  "DUMMY Description, Dummy number[%d], Dummy text [%s]",
695  __LINE__, __FUNCTION__);
696 
699  "DUMMY Description, Dummy number[%d], Dummy text [%s]",
700  __LINE__, __FUNCTION__);
701 
704  "DUMMY Description, Dummy number[%d], Dummy text [%s]",
705  __LINE__, __FUNCTION__);
706 
709  "DUMMY Description, Dummy number[%d], Dummy text [%s]",
710  __LINE__, __FUNCTION__);
711 }
712 
713 struct m0_ut_suite m0d_ut = {
714  .ts_name = "m0d-ut",
715  .ts_tests = {
716  { "cs-single-service", test_cs_ut_service_one},
717  { "cs-multiple-services", test_cs_ut_services_many},
718  { "cs-command-options-jumbled", test_cs_ut_opts_jumbled},
719  { "cs-device-stob", test_cs_ut_dev_stob},
720  { "cs-fail-linux-stob-cleanup", test_cs_ut_linux_stob_cleanup},
721  { "cs-bad-storage-type", test_cs_ut_stype_bad},
722  { "cs-bad-network-xprt", test_cs_ut_xprt_bad},
723  { "cs-bad-network-ep", test_cs_ut_ep_bad},
724  { "cs-bad-service", test_cs_ut_service_bad},
725  { "cs-missing-options", test_cs_ut_args_bad},
726  { "cs-buffer_pool-options", test_cs_ut_buffer_pool},
727  { "cs-bad-lnet-ep", test_cs_ut_lnet_ep_bad},
728  { "cs-duplicate-lnet-ep", test_cs_ut_lnet_ep_duplicate},
729  { "cs-duplicate-lnet-mixed-ep", test_cs_ut_lnet_ep_mixed_dup},
730  { "cs-lnet-multiple-interfaces", test_cs_ut_lnet_multiple_if},
731  { "cs-lnet-options", test_cs_ut_lnet},
732  { "cs-setup-fail", test_cs_ut_setup_fail},
733  { "cs-rconfc-fail", test_cs_ut_rconfc_fail},
734  { "cs-rconfc-fatal", test_cs_ut_rconfc_fatal},
735  { "cs-start-err", test_cs_ut_cs_start_err},
736  { "cs-iem", test_cs_ut_iem},
737  { NULL, NULL },
738  }
739 };
740 
741 /*
742  * Local variables:
743  * c-indentation-style: "K&R"
744  * c-basic-offset: 8
745  * tab-width: 8
746  * fill-column: 80
747  * scroll-step: 1
748  * End:
749  */
static const char * srv_ep_addr
Definition: idx_dix.c:72
#define SERVER_ENDPOINT
Definition: cs_ut_main.c:35
struct m0_sm rc_sm
Definition: rconfc.h:247
M0_INTERNAL int rm_write_lock_get(struct m0_rpc_machine *rpc_mach, const char *rm_ep)
Definition: wlock_helper.c:195
static const char * cl_ep_addrs[]
Definition: cs_ut_main.c:192
struct m0_ut_suite m0d_ut
Definition: cs_ut_main.c:713
m0_rconfc_cb_t rc_fatal_cb
Definition: rconfc.h:315
#define M0_PRE(cond)
static void test_cs_ut_rconfc_fatal(void)
Definition: cs_ut_main.c:628
void m0_net_domain_fini(struct m0_net_domain *dom)
Definition: domain.c:71
static void cs_ut_test_helper_failure(char *cs_argv[], int cs_argc)
Definition: cs_ut_main.c:322
static void test_cs_ut_lnet(void)
Definition: cs_ut_main.c:510
#define MAXPATHLEN
Definition: stob.h:41
static void test_cs_ut_services_many(void)
Definition: cs_ut_main.c:390
#define NULL
Definition: misc.h:38
static void test_cs_ut_lnet_ep_mixed_dup(void)
Definition: cs_ut_main.c:467
static char * cs_ut_lnet_mult_if_cmd[]
Definition: cs_ut_main.c:146
static char * cs_ut_service_one_cmd[]
Definition: cs_ut_main.c:48
int m0_cs_ut_send_fops(struct m0_rpc_session *cl_rpc_session, int dstype)
Definition: cs_ut_main.c:237
static void test_cs_ut_service_one(void)
Definition: cs_ut_main.c:355
static FILE * f
Definition: adieu.c:79
static char * cs_ut_stype_bad_cmd[]
Definition: cs_ut_main.c:86
static int cs_args_parse(struct m0_motr *cctx, int argc, char **argv)
Definition: setup.c:2341
static void test_cs_ut_service_bad(void)
Definition: cs_ut_main.c:490
char ** rsx_argv
Definition: rpclib.h:77
M0_INTERNAL int m0_file_read(const char *path, char **out)
Definition: fs.c:61
int m0_rpc_server_start(struct m0_rpc_server_ctx *sctx)
Definition: rpclib.c:50
void m0_cs_fini(struct m0_motr *cctx)
Definition: setup.c:3029
static struct m0_rpc_machine * cs_ut_reqh2rmach(struct m0_reqh *reqh)
Definition: cs_ut_main.c:600
M0_INTERNAL int m0_confc_init(struct m0_confc *confc, struct m0_sm_group *sm_group, const char *confd_addr, struct m0_rpc_machine *rpc_mach, const char *local_conf)
Definition: confc.c:560
static void dev_conf_file_create(void)
Definition: cs_ut_main.c:363
M0_INTERNAL void m0_rconfc_stop_sync(struct m0_rconfc *rconfc)
Definition: rconfc.c:2995
static struct m0_rpc_client_ctx cctx
Definition: rconfc.c:69
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
M0_INTERNAL void m0_rconfc_fatal_cb_set(struct m0_rconfc *rconfc, m0_rconfc_cb_t cb)
Definition: rconfc.c:3067
M0_INTERNAL void m0_confc_fini(struct m0_confc *confc)
Definition: confc.c:570
volatile sig_atomic_t gotsignal
Definition: setup.c:2415
static void test_cs_ut_buffer_pool(void)
Definition: cs_ut_main.c:502
Definition: ut.h:77
static char * cs_ut_args_bad_cmd[]
Definition: cs_ut_main.c:117
static int cs_ut_client_init(struct cl_ctx *cctx, const char *cl_ep_addr, const char *srv_ep_addr, const char *dbname, const struct m0_net_xprt *xprt)
Definition: cs_ut_main.c:199
M0_INTERNAL struct m0_confc * m0_ha_entrypoint_confc_override(void)
Definition: ha.c:254
static const char * cl_ep_addr
Definition: pool_trigger.c:49
static void test_cs_ut_dev_stob(void)
Definition: cs_ut_main.c:381
M0_INTERNAL struct m0_fid * m0_reqh2profile(struct m0_reqh *reqh)
Definition: reqh.c:758
static void cs_ut_write_lock_trigger(struct m0_reqh *reqh)
Definition: cs_ut_main.c:609
int i
Definition: dir.c:1033
static void test_cs_ut_lnet_ep_duplicate(void)
Definition: cs_ut_main.c:441
static char * cs_ut_lnet_ep_bad_cmd[]
Definition: cs_ut_main.c:183
#define M0_MOTR_IEM(_sev_id, _mod_id, _evt_id)
Definition: iem.h:99
static int cs_ut_test_helper_success(struct cl_ctx *cctx, size_t cctx_nr, char *cs_argv[], int cs_argc)
Definition: cs_ut_main.c:283
static void test_cs_ut_rconfc_fail(void)
Definition: cs_ut_main.c:535
const struct m0_rpc_item_ops cs_ds_req_fop_rpc_item_ops
Definition: cs_fop.c:47
static int cs_ut_register_signal(void)
Definition: cs_ut_main.c:585
static const struct socktype stype[]
Definition: sock.c:1156
M0_INTERNAL void m0_fi_disable(const char *fp_func, const char *fp_tag)
Definition: finject.c:485
static void m0_fi_enable(const char *func, const char *tag)
Definition: finject.h:276
#define m0_free0(pptr)
Definition: memory.h:77
#define M0_ASSERT(cond)
static struct m0_confc * confc
Definition: file.c:94
static int cs_reqh_ctx_validate(struct m0_motr *cctx)
Definition: setup.c:1933
static void test_cs_ut_setup_fail(void)
Definition: cs_ut_main.c:518
struct m0_tl rh_rpc_machines
Definition: reqh.h:135
struct m0_net_domain cl_ndom
Definition: client_ut.c:75
struct m0_reqh rc_reqh
Definition: setup.h:312
struct m0_rpc_client_ctx cl_ctx
int m0_net_xprt_nr(void)
Definition: net.c:168
int m0_rpc_client_stop(struct m0_rpc_client_ctx *cctx)
Definition: rpclib.c:217
static void test_cs_ut_ep_bad(void)
Definition: cs_ut_main.c:429
#define SERVER_ENDPOINT_ADDR
Definition: cs_ut_main.c:34
struct m0_net_xprt * m0_net_xprt_default_get(void)
Definition: net.c:151
int m0_rpc_client_start(struct m0_rpc_client_ctx *cctx)
Definition: rpclib.c:160
struct m0_net_xprt ** rsx_xprts
Definition: rpclib.h:69
static void test_cs_ut_linux_stob_cleanup(void)
Definition: cs_ut_main.c:409
static struct m0_rpc_server_ctx sctx
Definition: console.c:88
int m0_rpc_post_sync(struct m0_fop *fop, struct m0_rpc_session *session, const struct m0_rpc_item_ops *ri_ops, m0_time_t deadline)
Definition: rpclib.c:284
static int m0_rconfc_start_sync(struct m0_rconfc *rconfc)
Definition: rconfc.h:502
M0_INTERNAL void m0_rconfc_lock(struct m0_rconfc *rconfc)
Definition: rconfc.c:2841
Definition: reqh.h:94
static void test_cs_ut_opts_jumbled(void)
Definition: cs_ut_main.c:399
static char * cs_ut_service_bad_cmd[]
Definition: cs_ut_main.c:110
struct ping_xprt xprts[1]
Definition: main.c:71
#define SERVER_LOG_FILE_NAME
Definition: cs_ut_main.c:197
struct m0_fop_type cs_ds2_req_fop_fopt
Definition: cs_fop.c:53
#define M0_MOTR_IEM_DESC(_sev_id, _mod_id, _evt_id, _desc,...)
Definition: iem.h:103
struct m0_fop_type cs_ds1_req_fop_fopt
Definition: cs_fop.c:51
M0_INTERNAL void m0_rconfc_fini(struct m0_rconfc *rconfc)
Definition: rconfc.c:3009
static void cs_ut_term_sig_handler(int signum)
Definition: cs_ut_main.c:580
const char * ts_name
Definition: ut.h:99
static void test_cs_ut_lnet_multiple_if(void)
Definition: cs_ut_main.c:448
M0_INTERNAL void m0_rconfc_unlock(struct m0_rconfc *rconfc)
Definition: rconfc.c:2855
int m0_cs_init(struct m0_motr *cctx, struct m0_net_xprt **xprts, size_t xprts_nr, FILE *out, bool mkfs)
Definition: setup.c:2999
Definition: setup.h:354
struct m0_reqh reqh
Definition: rm_foms.c:48
static char * cs_ut_lnet_dup_tcp_if_cmd[]
Definition: cs_ut_main.c:172
static void test_cs_ut_xprt_bad(void)
Definition: cs_ut_main.c:423
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
Definition: domain.c:36
int rsx_xprts_nr
Definition: rpclib.h:71
M0_INTERNAL struct m0_locality * m0_locality0_get(void)
Definition: locality.c:169
struct m0_reqh_context cc_reqh_ctx
Definition: setup.h:361
static char * cs_ut_lnet_cmd[]
Definition: cs_ut_main.c:137
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
M0_INTERNAL void rm_write_lock_put()
Definition: wlock_helper.c:186
struct m0_net_xprt ** m0_net_all_xprt_get(void)
Definition: net.c:161
uint64_t csr_value
Definition: cs_fop.h:86
static char * cs_ut_dev_stob_cmd[]
Definition: cs_ut_main.c:76
struct m0_fop * m0_fop_alloc_at(struct m0_rpc_session *sess, struct m0_fop_type *fopt)
Definition: fop.c:122
uint64_t csr_value
Definition: cs_fop.h:78
void m0_fop_put_lock(struct m0_fop *fop)
Definition: fop.c:199
static struct m0_fop * fop
Definition: item.c:57
static char * cs_ut_services_many_cmd[]
Definition: cs_ut_main.c:57
static void test_cs_ut_iem(void)
Definition: cs_ut_main.c:682
static void m0_fi_enable_once(const char *func, const char *tag)
Definition: finject.h:301
static struct m0_rconfc * rconfc(struct m0_client *m0c)
Definition: client_init.c:310
struct m0_rconfc rh_rconfc
Definition: reqh.h:166
void m0_rpc_server_stop(struct m0_rpc_server_ctx *sctx)
Definition: rpclib.c:85
static void test_cs_ut_cs_start_err(void)
Definition: cs_ut_main.c:348
M0_INTERNAL int m0_rconfc_init(struct m0_rconfc *rconfc, const struct m0_fid *profile, struct m0_sm_group *sm_group, struct m0_rpc_machine *rmach, m0_rconfc_cb_t expired_cb, m0_rconfc_cb_t ready_cb)
Definition: rconfc.c:2860
#define M0_UT_PATH(name)
Definition: misc.h:41
#define out(...)
Definition: gen.c:41
static void test_cs_ut_stype_bad(void)
Definition: cs_ut_main.c:417
struct m0_net_xprt * xprt
Definition: module.c:61
static char * cs_ut_buffer_pool_cmd[]
Definition: cs_ut_main.c:124
const struct m0_tl_descr ndoms_descr
static char * cs_ut_xprt_bad_cmd[]
Definition: cs_ut_main.c:95
static void cs_ut_client_fini(struct cl_ctx *cctx)
Definition: cs_ut_main.c:226
static void test_cs_ut_args_bad(void)
Definition: cs_ut_main.c:496
static char * cs_ut_opts_jumbled_cmd[]
Definition: cs_ut_main.c:67
uint32_t sm_state
Definition: sm.h:307
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
struct m0_fid g_process_fid
Definition: ut.c:689
static void test_cs_ut_lnet_ep_bad(void)
Definition: cs_ut_main.c:435
static const char * cdbnames[]
Definition: cs_ut_main.c:191
static char * cs_ut_ep_mixed_dup_cmd[]
Definition: cs_ut_main.c:159
#define M0_UT_ASSERT(a)
Definition: ut.h:46
struct m0_motr rsx_motr_ctx
Definition: rpclib.h:84
Definition: fop.h:79
static const char * srv_ep_addrs[]
Definition: cs_ut_main.c:193
static char * cs_ut_ep_bad_cmd[]
Definition: cs_ut_main.c:103
const struct m0_net_xprt m0_net_bulk_mem_xprt
Definition: mem_xprt_xo.c:761