Motr  M0
console.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 <unistd.h> /* truncate(2) */
24 #include <sys/types.h> /* truncate(2) */
25 
26 #define CONSOLE_UT
27 #include "console/console.c" /* timeout */
28 #include "rpc/rpclib.h" /* m0_rpc_client_ctx */
29 #include "rpc/rpc_opcodes.h" /* M0_CONS_FOP_DEVICE_OPCODE */
30 #include "ut/misc.h" /* M0_UT_PATH */
31 #include "ut/ut.h"
32 
38 enum {
41 };
42 
43 static const char *yaml_file = "/tmp/console_ut.yaml";
44 static const char *err_file = "/tmp/stderr";
45 static const char *out_file = "/tmp/stdout";
46 static const char *in_file = "/tmp/stdin";
47 
48 static struct m0_ut_redirect in_redir;
49 static struct m0_ut_redirect out_redir;
50 static struct m0_ut_redirect err_redir;
51 static struct m0_rpc_machine cons_mach;
52 
53 #define CLIENT_ENDPOINT_ADDR "0@lo:12345:34:2"
54 #define SERVER_ENDPOINT_ADDR "0@lo:12345:34:1"
55 #define SERVER_ENDPOINT M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR
56 
57 #define SERVER_DB_FILE_NAME "cons_server_db"
58 #define SERVER_STOB_FILE_NAME "cons_server_stob"
59 #define SERVER_ADDB_STOB_FILE_NAME "linuxstob:cons_server_addb_stob"
60 #define SERVER_LOG_FILE_NAME "cons_server.log"
61 
62 #define ALIST(...) ((char *[]){ __VA_ARGS__, NULL})
63 
64 enum {
68 };
69 
70 static struct m0_net_domain client_net_dom = { };
71 
72 static struct m0_rpc_client_ctx cctx = {
74  .rcx_local_addr = CLIENT_ENDPOINT_ADDR,
75  .rcx_remote_addr = SERVER_ENDPOINT_ADDR,
76  .rcx_max_rpcs_in_flight = MAX_RPCS_IN_FLIGHT,
77  .rcx_fid = &g_process_fid,
78 };
79 
80 static char *server_argv[] = {
81  "console_ut", "-T", "AD", "-D", SERVER_DB_FILE_NAME,
83  "-w", "10", "-e", SERVER_ENDPOINT, "-H", SERVER_ENDPOINT_ADDR,
84  "-f", M0_UT_CONF_PROCESS,
85  "-c", M0_UT_PATH("conf.xc")
86 };
87 
88 static struct m0_rpc_server_ctx sctx;
89 
90 static int cons_init(void)
91 {
92  int result;
93  timeout = 10;
94  result = m0_console_fop_init();
95  M0_ASSERT(result == 0);
96 
98  M0_ASSERT(result == 0);
99 
101  return result;
102 }
103 
104 static int cons_fini(void)
105 {
109  return 0;
110 }
111 
112 static void file_redirect_init(void)
113 {
117 }
118 
119 static void file_redirect_fini(void)
120 {
121  int result;
122 
126 
127  result = remove(in_file);
128  M0_UT_ASSERT(result == 0);
129  result = remove(out_file);
130  M0_UT_ASSERT(result == 0);
131  result = remove(err_file);
132  M0_UT_ASSERT(result == 0);
133 }
134 
135 static int generate_yaml_file(const char *name)
136 {
137  FILE *fp;
138 
139  M0_PRE(name != NULL);
140 
141  fp = fopen(name, "w");
142  if (fp == NULL) {
143  fprintf(stderr, "Failed to create yaml file\n");
144  return -errno;
145  }
146 
147  fprintf(fp, "# Generated yaml file for console UT\n\n");
148  fprintf(fp, "server : localhost\n");
149  fprintf(fp, "sport : 23125\n");
150  fprintf(fp, "client : localhost\n");
151  fprintf(fp, "cport : 23126\n");
152  fprintf(fp, "\n\n");
153  fprintf(fp, "Test FOP:\n");
154  fprintf(fp, " - cons_test_type : A\n");
155  fprintf(fp, " cons_test_id : 495\n");
156  fprintf(fp, " cons_seq : 144\n");
157  fprintf(fp, " cons_oid : 233\n");
158  fprintf(fp, " cons_size : 5\n");
159  fprintf(fp, " cons_buf : abcde\n");
160 
161  fclose(fp);
162  return 0;
163 }
164 
165 static void check_values(struct m0_fop *fop)
166 {
168 
169  M0_UT_ASSERT(test->cons_test_type == 'A');
170  M0_UT_ASSERT(test->cons_test_id == 495);
171  M0_UT_ASSERT(test->cons_id.cons_seq == 144);
172  M0_UT_ASSERT(test->cons_id.cons_oid == 233);
173  M0_UT_ASSERT(test->cons_test_buf.cons_size == 5);
174  M0_UT_ASSERT(strncmp("abcde", (char *)test->cons_test_buf.cons_buf,
175  test->cons_test_buf.cons_size) == 0);
176 }
177 
178 static void yaml_basic_test(void)
179 {
180  int result;
181 
182  result = generate_yaml_file(yaml_file);
183  M0_UT_ASSERT(result == 0);
184  result = m0_cons_yaml_init(yaml_file);
185  M0_UT_ASSERT(result == 0);
186 
187  /* Init and Fini */
189  result = m0_cons_yaml_init(yaml_file);
190  M0_UT_ASSERT(result == 0);
192 
193  result = remove(yaml_file);
194  M0_UT_ASSERT(result == 0);
195 }
196 
197 static void input_test(void)
198 {
199  struct m0_fop *fop;
200  int result;
201 
203  result = generate_yaml_file(yaml_file);
204  M0_UT_ASSERT(result == 0);
205  result = m0_cons_yaml_init(yaml_file);
206  M0_UT_ASSERT(result == 0);
207 
209  M0_UT_ASSERT(fop != NULL);
210 
212  check_values(fop);
215  result = remove(yaml_file);
216  M0_UT_ASSERT(result == 0);
218 }
219 
220 static void file_compare(const char *in, const char *out)
221 {
222  FILE *infp;
223  FILE *outfp;
224  int inc;
225  int outc;
226 
227  infp = fopen(in, "r");
228  M0_UT_ASSERT(infp != NULL);
229  outfp = fopen(out, "r");
230  M0_UT_ASSERT(outfp != NULL);
231 
232  while ((inc = fgetc(infp)) != EOF &&
233  (outc = fgetc(outfp)) != EOF) {
234  M0_UT_ASSERT(inc == outc);
235  }
236 
237  fclose(infp);
238  fclose(outfp);
239 }
240 
241 static void output_test(void)
242 {
243  struct m0_fop *f;
244  int result;
245 
246  m0_console_verbose = true;
247  result = generate_yaml_file(yaml_file);
248  M0_UT_ASSERT(result == 0);
249  result = m0_cons_yaml_init(yaml_file);
250  M0_UT_ASSERT(result == 0);
251 
253  M0_UT_ASSERT(f != NULL);
254 
256 
259 
262 
263  m0_console_verbose = false;
266  result = remove(yaml_file);
267  M0_UT_ASSERT(result == 0);
268 }
269 
270 static void yaml_file_test(void)
271 {
272  int result;
273 
275  result = m0_cons_yaml_init(yaml_file);
276  M0_UT_ASSERT(result != 0);
278 }
279 
280 static void yaml_parser_test(void)
281 {
282  FILE *fp;
283  int result;
284 
286  fp = fopen(yaml_file, "w");
287  M0_UT_ASSERT(fp != NULL);
288  fprintf(fp, "# Generated yaml file for console UT\n\n");
289  fprintf(fp, "server : localhost\n");
290  fprintf(fp, "sport : 23125\n");
291  fprintf(fp, "client : localhost\n");
292  fprintf(fp, "cport : 23126\n");
293  fprintf(fp, "\n\n");
294  fprintf(fp, "Test FOP:\n");
295  fprintf(fp, " - cons_seq : 1\n");
296  /* Error introduced here */
297  fprintf(fp, "cons_oid : 2\n");
298  fprintf(fp, " cons_test_type : d\n");
299  fprintf(fp, " cons_test_id : 64\n");
300  fclose(fp);
301 
302  result = m0_cons_yaml_init(yaml_file);
303  M0_UT_ASSERT(result != 0);
304  result = remove(yaml_file);
305  M0_UT_ASSERT(result == 0);
307 }
308 
309 static void yaml_root_get_test(void)
310 {
311  FILE *fp;
312  int result;
313 
315  fp = fopen(yaml_file, "w");
316  M0_UT_ASSERT(fp != NULL);
317  fclose(fp);
318 
319  result = m0_cons_yaml_init(yaml_file);
320  M0_UT_ASSERT(result != 0);
321  result = remove(yaml_file);
322  M0_UT_ASSERT(result == 0);
324 }
325 
326 static void yaml_get_value_test(void)
327 {
328  uint32_t number;
329  int result;
330  char *value;
331 
332  result = generate_yaml_file(yaml_file);
333  M0_UT_ASSERT(result == 0);
334  result = m0_cons_yaml_init(yaml_file);
335  M0_UT_ASSERT(result == 0);
336 
337  value = m0_cons_yaml_get_value("server");
338  M0_UT_ASSERT(value != NULL);
339  M0_UT_ASSERT(strcmp("localhost", value) == 0);
340 
341  value = m0_cons_yaml_get_value("sport");
342  M0_UT_ASSERT(value != NULL);
343  number = strtoul(value, NULL, 10);
344  M0_UT_ASSERT(number == 23125);
345 
346  value = m0_cons_yaml_get_value("client");
347  M0_UT_ASSERT(value != NULL);
348  M0_UT_ASSERT(strcmp("localhost", value) == 0);
349 
350  value = m0_cons_yaml_get_value("cport");
351  M0_UT_ASSERT(value != NULL);
352  number = strtoul(value, NULL, 10);
353  M0_UT_ASSERT(number == 23126);
354 
355  value = m0_cons_yaml_get_value("cons_test_type");
356  M0_UT_ASSERT(value != NULL);
357  M0_UT_ASSERT(value[0] == 'A');
358 
359  value = m0_cons_yaml_get_value("cons_test_id");
360  M0_UT_ASSERT(value != NULL);
361  number = strtoul(value, NULL, 10);
362  M0_UT_ASSERT(number == 495);
363 
364  value = m0_cons_yaml_get_value("cons_seq");
365  M0_UT_ASSERT(value != NULL);
366  number = strtoul(value, NULL, 10);
367  M0_UT_ASSERT(number == 144);
368 
369  value = m0_cons_yaml_get_value("cons_oid");
370  M0_UT_ASSERT(value != NULL);
371  number = strtoul(value, NULL, 10);
372  M0_UT_ASSERT(number == 233);
373 
374  value = m0_cons_yaml_get_value("cons_size");
375  M0_UT_ASSERT(value != NULL);
376  number = strtoul(value, NULL, 10);
377  M0_UT_ASSERT(number == 5);
378 
379  value = m0_cons_yaml_get_value("cons_buf");
380  M0_UT_ASSERT(value != NULL);
381  M0_UT_ASSERT(strcmp("abcde", value) == 0);
382 
383  value = m0_cons_yaml_get_value("xxxx");
384  M0_UT_ASSERT(value == NULL);
385 
387  result = remove(yaml_file);
388  M0_UT_ASSERT(result == 0);
389 }
390 
391 
392 static int device_yaml_file(const char *name)
393 {
394  FILE *fp;
395 
396  M0_PRE(name != NULL);
397 
398  fp = fopen(name, "w");
399  if (fp == NULL) {
400  fprintf(stderr, "Failed to create yaml file\n");
401  return -errno;
402  }
403 
404  fprintf(fp, "# Generated yaml file for console UT\n\n");
405  fprintf(fp, "server : localhost\n");
406  fprintf(fp, "sport : 23125\n");
407  fprintf(fp, "client : localhost\n");
408  fprintf(fp, "cport : 23126\n");
409  fprintf(fp, "\n\n");
410  fprintf(fp, "Test FOP:\n");
411  fprintf(fp, " - cons_seq : 1\n");
412  fprintf(fp, " cons_oid : 2\n");
413  fprintf(fp, " cons_notify_type : 0\n");
414  fprintf(fp, " cons_dev_id : 64\n");
415  fprintf(fp, " cons_size : 8\n");
416  fprintf(fp, " cons_buf : console\n");
417 
418  fclose(fp);
419  return 0;
420 }
421 
423 {
424  int result;
425 
426  /* Init Test */
427  result = device_yaml_file(yaml_file);
428  M0_UT_ASSERT(result == 0);
429  result = m0_cons_yaml_init(yaml_file);
430  M0_UT_ASSERT(result == 0);
431  result = m0_rpc_client_start(cctx);
432  M0_UT_ASSERT(result == 0);
433 }
434 
436 {
437  int result;
438 
439  /* Fini Test */
440  result = m0_rpc_client_stop(cctx);
441  M0_UT_ASSERT(result == 0);
443  result = remove(yaml_file);
444  M0_UT_ASSERT(result == 0);
445 }
446 
448 {
449  int result;
450 
451  *sctx = (struct m0_rpc_server_ctx){
453  .rsx_xprts_nr = m0_net_xprt_nr(),
454  .rsx_argv = server_argv,
455  .rsx_argc = ARRAY_SIZE(server_argv),
456  .rsx_log_file_name = SERVER_LOG_FILE_NAME,
457  };
458  result = m0_rpc_server_start(sctx);
459  M0_UT_ASSERT(result == 0);
460 }
461 
463 {
465 }
466 
467 static void conn_basic_test(void)
468 {
473 }
474 
475 static void success_client(int dummy)
476 {
479 }
480 
481 static void conn_success_test(void)
482 {
483  struct m0_thread client_handle;
484  int result;
485 
487  M0_SET0(&client_handle);
488  result = M0_THREAD_INIT(&client_handle, int, NULL, &success_client,
489  0, "console-client");
490  M0_UT_ASSERT(result == 0);
491  m0_thread_join(&client_handle);
492  m0_thread_fini(&client_handle);
494 }
495 
496 static void mesg_send_client(int dummy)
497 {
498  struct m0_fop_type *ftype;
499  struct m0_fop *fop;
500  int result;
501 
503 
505  M0_UT_ASSERT(ftype != NULL);
506 
507  m0_cons_fop_name_print(ftype);
508  printf("\n");
509  fop = m0_fop_alloc(ftype, NULL, &cons_mach);
510  M0_UT_ASSERT(fop != NULL);
514  0 /* deadline */);
515  M0_UT_ASSERT(result == 0);
517  M0_UT_ASSERT(result == 0);
520 }
521 
522 static void mesg_send_test(void)
523 {
524  struct m0_thread client_handle;
525  int result;
526 
529  M0_SET0(&client_handle);
530  result = M0_THREAD_INIT(&client_handle, int, NULL, &mesg_send_client,
531  0, "console-client");
532  M0_UT_ASSERT(result == 0);
533  m0_thread_join(&client_handle);
534  m0_thread_fini(&client_handle);
537 }
538 
539 static int console_cmd(char **params)
540 {
541  int numparams;
542 
543  /* Count number of arguments */
544  for (numparams = 0; params[numparams] != NULL; ++numparams)
545  ;
546 
547  return console_main(numparams, params);
548 }
549 
550 static void console_input_test(void)
551 {
552  int result;
553  char buf[35];
554 
556  /* starts UT test for console main */
557  result = console_cmd(ALIST("no_input"));
558  M0_UT_ASSERT(result == EX_USAGE);
560  result = truncate(err_file, 0L);
561  M0_UT_ASSERT(result == 0);
562  fseek(stderr, 0L, SEEK_SET);
563 
564  result = console_cmd(ALIST("no_input", "-v"));
565  M0_UT_ASSERT(result == EX_USAGE);
567  result = truncate(err_file, 0L);
568  M0_UT_ASSERT(result == 0);
569  fseek(stderr, 0L, SEEK_SET);
570 
571  fseek(stdout, 0L, SEEK_SET);
572  result = console_cmd(ALIST("list_fops", "-l"));
573  M0_UT_ASSERT(result == EX_USAGE);
574  M0_UT_ASSERT(m0_error_mesg_match(stdout, "List of FOP's:"));
575  result = truncate(out_file, 0L);
576  M0_UT_ASSERT(result == 0);
577  fseek(stdout, 0L, SEEK_SET);
578 
579  sprintf(buf, "%d", M0_CONS_FOP_DEVICE_OPCODE);
580  result = console_cmd(ALIST("show_fops", "-l", "-f", buf));
581  M0_UT_ASSERT(result == EX_OK);
582  sprintf(buf, "%.2d Device Failed",
585  result = truncate(out_file, 0L);
586  M0_UT_ASSERT(result == 0);
587  fseek(stdout, 0L, SEEK_SET);
588 
589  sprintf(buf, "%d", M0_CONS_FOP_REPLY_OPCODE);
590  result = console_cmd(ALIST("show_fops", "-l", "-f", buf));
591  M0_UT_ASSERT(result == EX_OK);
592  sprintf(buf, "%.2d Console Reply",
595  result = truncate(out_file, 0L);
596  M0_UT_ASSERT(result == 0);
597  fseek(stdout, 0L, SEEK_SET);
598 
599  result = console_cmd(ALIST("show_fops", "-l", "-f", 0));
600  M0_UT_ASSERT(result == EX_USAGE);
602  result = truncate(err_file, 0L);
603  M0_UT_ASSERT(result == 0);
604  fseek(stderr, 0L, SEEK_SET);
605 
606  result = console_cmd(ALIST("yaml_input", "-i"));
607  M0_UT_ASSERT(result == EX_USAGE);
609  result = truncate(err_file, 0L);
610  M0_UT_ASSERT(result == 0);
611  fseek(stderr, 0L, SEEK_SET);
612 
613  result = console_cmd(ALIST("yaml_input", "-y", (char *)yaml_file));
614  M0_UT_ASSERT(result == EX_USAGE);
616  result = truncate(err_file, 0L);
617  M0_UT_ASSERT(result == 0);
618  fseek(stderr, 0L, SEEK_SET);
619 
620  /* last UT test for console main */
621  result = console_cmd(ALIST("yaml_input", "-i", "-y", (char *)yaml_file));
622  M0_UT_ASSERT(result == EX_NOINPUT);
623  M0_UT_ASSERT(m0_error_mesg_match(stderr, "YAML Init failed"));
624 
626 }
627 
629  .ts_name = "libconsole-ut",
630  .ts_init = cons_init,
631  .ts_fini = cons_fini,
632  .ts_tests = {
633  { "yaml_basic_test", yaml_basic_test },
634  { "input_test", input_test },
635  { "console_input_test", console_input_test },
636  { "output_test", output_test },
637  { "yaml_file_test", yaml_file_test },
638  { "yaml_parser_test", yaml_parser_test },
639  { "yaml_root_get_test", yaml_root_get_test },
640  { "yaml_get_value_test", yaml_get_value_test },
641  { "conn_basic_test", conn_basic_test },
642  { "conn_success_test", conn_success_test },
643  { "mesg_send_test", mesg_send_test },
644  { NULL, NULL }
645  }
646 };
647 
649 #undef CONSOLE_UT
650 
651 /*
652  * Local variables:
653  * c-indentation-style: "K&R"
654  * c-basic-offset: 8
655  * tab-width: 8
656  * fill-column: 80
657  * scroll-step: 1
658  * End:
659  */
static void cons_client_init(struct m0_rpc_client_ctx *cctx)
Definition: console.c:422
static int cons_init(void)
Definition: console.c:90
#define M0_PRE(cond)
static struct m0_be_active_record_domain dummy
Definition: active_record.c:35
M0_INTERNAL bool m0_error_mesg_match(FILE *fp, const char *mesg)
Definition: ut.c:123
void m0_net_domain_fini(struct m0_net_domain *dom)
Definition: domain.c:71
#define NULL
Definition: misc.h:38
M0_INTERNAL void m0_stream_restore(const struct m0_ut_redirect *redir)
Definition: ut.c:107
int m0_thread_join(struct m0_thread *q)
Definition: kthread.c:169
const m0_time_t M0_TIME_NEVER
Definition: time.c:108
static FILE * f
Definition: adieu.c:79
static struct m0_rpc_client_ctx cctx
Definition: console.c:72
static int device_yaml_file(const char *name)
Definition: console.c:392
int m0_rpc_server_start(struct m0_rpc_server_ctx *sctx)
Definition: rpclib.c:50
struct m0_fop_type m0_cons_fop_test_fopt
Definition: console_fop.c:40
#define ALIST(...)
Definition: console.c:62
static void yaml_root_get_test(void)
Definition: console.c:309
int const char const void * value
Definition: dir.c:325
static void cons_client_fini(struct m0_rpc_client_ctx *cctx)
Definition: console.c:435
static void input_test(void)
Definition: console.c:197
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
M0_INTERNAL int m0_cons_yaml_init(const char *file_path)
Inititalizes parser by opening given file. and also checks for error by getting root node...
Definition: console_yaml.c:94
static void conn_basic_test(void)
Definition: console.c:467
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
Definition: thread.h:139
static const char * in_file
Definition: console.c:46
#define M0_SET0(obj)
Definition: misc.h:64
Definition: ut.h:77
#define SERVER_ADDB_STOB_FILE_NAME
Definition: console.c:59
static void check_values(struct m0_fop *fop)
Definition: console.c:165
int m0_rpc_item_wait_for_reply(struct m0_rpc_item *item, m0_time_t timeout)
Definition: item.c:824
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
Definition: sm.c:65
Definition: sock.c:887
#define SERVER_ENDPOINT_ADDR
Definition: console.c:54
struct m0_sm_group rm_sm_grp
Definition: rpc_machine.h:82
#define SERVER_ENDPOINT
Definition: console.c:55
#define SERVER_DB_FILE_NAME
Definition: console.c:57
static void mesg_send_client(int dummy)
Definition: console.c:496
static void mesg_send_test(void)
Definition: console.c:522
static void file_redirect_init(void)
Definition: console.c:112
static void file_compare(const char *in, const char *out)
Definition: console.c:220
static void success_client(int dummy)
Definition: console.c:475
const char * name
Definition: trace.c:110
static void yaml_parser_test(void)
Definition: console.c:280
M0_INTERNAL void m0_cons_yaml_fini(void)
Deletes the parser and closes the YAML file.
Definition: console_yaml.c:147
static struct m0_ut_redirect err_redir
Definition: console.c:50
#define M0_ASSERT(cond)
static int console_cmd(char **params)
Definition: console.c:539
static void cons_server_init(struct m0_rpc_server_ctx *sctx)
Definition: console.c:447
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
Definition: sm.c:53
static void cons_server_fini(struct m0_rpc_server_ctx *sctx)
Definition: console.c:462
static void console_input_test(void)
Definition: console.c:550
void m0_thread_fini(struct m0_thread *q)
Definition: thread.c:92
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 int cons_fini(void)
Definition: console.c:104
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 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
uint64_t ri_nr_sent_max
Definition: item.h:146
M0_INTERNAL int m0_cons_fop_obj_output(struct m0_fop *fop)
Helper function for FOP output.
Definition: console_it.c:272
bool m0_console_verbose
Definition: console.c:50
struct m0_ut_suite console_ut
Definition: console.c:628
struct m0_net_domain * rcx_net_dom
Definition: rpclib.h:128
M0_INTERNAL struct m0_fop_type * m0_fop_type_find(uint32_t opcode)
Definition: fop.c:388
M0_INTERNAL int m0_cons_fop_obj_input(struct m0_fop *fop)
Helper function for FOP input.
Definition: console_it.c:267
static uint32_t timeout
Definition: console.c:52
static const char * usage_msg
Definition: console.c:142
static void conn_success_test(void)
Definition: console.c:481
const char * ts_name
Definition: ut.h:99
static struct m0_net_domain client_net_dom
Definition: console.c:70
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
Definition: domain.c:36
struct m0_rpc_session rcx_session
Definition: rpclib.h:147
static int generate_yaml_file(const char *name)
Definition: console.c:135
Definition: list.c:42
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
static void yaml_basic_test(void)
Definition: console.c:178
static const char * out_file
Definition: console.c:45
struct m0_net_xprt ** m0_net_all_xprt_get(void)
Definition: net.c:161
M0_INTERNAL void * m0_cons_yaml_get_value(const char *name)
Search for specified string and set the respctive value form YAML file. (like "name : console") ...
Definition: console_yaml.c:177
Definition: common.h:34
void m0_fop_put_lock(struct m0_fop *fop)
Definition: fop.c:199
static void yaml_file_test(void)
Definition: console.c:270
static struct m0_fop * fop
Definition: item.c:57
static char * server_argv[]
Definition: console.c:80
M0_INTERNAL void m0_stream_redirect(FILE *stream, const char *path, struct m0_ut_redirect *redir)
Definition: ut.c:87
static const char * yaml_file
Definition: console.c:43
void m0_rpc_server_stop(struct m0_rpc_server_ctx *sctx)
Definition: rpclib.c:85
static struct m0_rpc_machine cons_mach
Definition: console.c:51
#define M0_UT_PATH(name)
Definition: misc.h:41
static void file_redirect_fini(void)
Definition: console.c:119
#define out(...)
Definition: gen.c:41
Definition: rcv_session.c:58
M0_INTERNAL void m0_cons_fop_name_print(const struct m0_fop_type *ftype)
Definition: console_mesg.c:34
static void output_test(void)
Definition: console.c:241
static const char * err_file
Definition: console.c:44
M0_INTERNAL int m0_console_fop_init(void)
Definition: console_fop.c:51
M0_INTERNAL void m0_console_fop_fini(void)
Definition: console_fop.c:42
struct m0_rpc_item f_item
Definition: fop.h:83
#define CLIENT_ENDPOINT_ADDR
Definition: console.c:53
#define SERVER_LOG_FILE_NAME
Definition: console.c:60
static void yaml_get_value_test(void)
Definition: console.c:326
#define ARRAY_SIZE(a)
Definition: misc.h:45
struct m0_fid g_process_fid
Definition: ut.c:689
#define SERVER_STOB_FILE_NAME
Definition: console.c:58
static struct m0_ut_redirect out_redir
Definition: console.c:49
#define M0_UT_ASSERT(a)
Definition: ut.h:46
static struct m0_ut_redirect in_redir
Definition: console.c:48
Definition: fop.h:79
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)
Definition: fop.c:96