Motr  M0
client_server.c File Reference
#include "ut/ut.h"
#include "lib/memory.h"
#include "lib/thread.h"
#include "lib/semaphore.h"
#include "lib/misc.h"
#include "lib/trace.h"
#include "net/lnet/lnet.h"
#include "net/test/node.h"
#include "net/test/console.h"
#include "net/bulk_emulation/mem_xprt.h"
#include "net/test/debug.h"
Include dependency graph for client_server.c:

Go to the source code of this file.

Macros

#define NET_TEST_MODULE_NAME   ut_client_server
 
#define nrchk(nr1, nr2)
 

Enumerations

enum  {
  NTCS_PID = M0_NET_LNET_PID, NTCS_PORTAL = 42, NTCS_NODES_MAX = 128, NTCS_NODE_ADDR_MAX = 0x100,
  NTCS_TIMEOUT = 20, NTCS_TIMEOUT_GDB = 1200, NTCS_TMID_CONSOLE4CLIENTS = 298, NTCS_TMID_CONSOLE4SERVERS = 299,
  NTCS_TMID_NODES = 300, NTCS_TMID_CMD_CLIENTS = NTCS_TMID_NODES, NTCS_TMID_DATA_CLIENTS = NTCS_TMID_NODES + NTCS_NODES_MAX * 1, NTCS_TMID_CMD_SERVERS = NTCS_TMID_NODES + NTCS_NODES_MAX * 2,
  NTCS_TMID_DATA_SERVERS = NTCS_TMID_NODES + NTCS_NODES_MAX * 3, NTCS_ACCEPTABLE_MSG_LOSS = 20
}
 

Functions

static char * addr_get (const char *nid, int tmid)
 
static void addr_free (char *addr)
 
static void net_test_node (struct m0_net_test_node_cfg *node_cfg)
 
static void node_cfg_fill (struct m0_net_test_node_cfg *ncfg, char *addr_cmd, char *addr_cmd_list, char *addr_data, char *addr_data_list, char *addr_console, bool last_node)
 
static void msg_nr_print (const char *prefix, const struct m0_net_test_msg_nr *msg_nr)
 
static bool msg_nr_in_range (size_t nr1, size_t nr2)
 
static void net_test_client_server (const char *nid, enum m0_net_test_type type, size_t clients_nr, size_t servers_nr, size_t concurrency_client, size_t concurrency_server, size_t msg_nr, m0_bcount_t msg_size, size_t bd_buf_nr_client, size_t bd_buf_nr_server, m0_bcount_t bd_buf_size, size_t bd_nr_max)
 
void m0_net_test_client_server_stub_ut (void)
 
void m0_net_test_client_server_ping_ut (void)
 
void m0_net_test_client_server_bulk_ut (void)
 
void m0_net_test_xprt_dynamic_reg_dereg_ut (void)
 

Variables

static struct m0_net_test_node_cfg node_cfg [NTCS_NODES_MAX *2]
 
static struct m0_thread node_thread [NTCS_NODES_MAX *2]
 
static struct m0_semaphore node_init_sem
 
static char * addr_console4clients
 
static char * addr_console4servers
 
static char clients [NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
 
static char servers [NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
 
static char clients_data [NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
 
static char servers_data [NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
 
static m0_time_t timeout = M0_MKTIME(NTCS_TIMEOUT, 0)
 

Macro Definition Documentation

◆ NET_TEST_MODULE_NAME

#define NET_TEST_MODULE_NAME   ut_client_server

Definition at line 36 of file client_server.c.

◆ nrchk

#define nrchk (   nr1,
  nr2 
)
Value:
{ \
size_t total1 = (nr1)->ntmn_total; \
size_t total2 = (nr2)->ntmn_total; \
M0_UT_ASSERT(msg_nr_in_range(total1, total2)); \
M0_UT_ASSERT(msg_nr_in_range(total2, total1)); \
}
static bool msg_nr_in_range(size_t nr1, size_t nr2)

Definition at line 147 of file client_server.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NTCS_PID 
NTCS_PORTAL 
NTCS_NODES_MAX 
NTCS_NODE_ADDR_MAX 
NTCS_TIMEOUT 
NTCS_TIMEOUT_GDB 

20min for debugging in gdb

NTCS_TMID_CONSOLE4CLIENTS 
NTCS_TMID_CONSOLE4SERVERS 
NTCS_TMID_NODES 
NTCS_TMID_CMD_CLIENTS 
NTCS_TMID_DATA_CLIENTS 
NTCS_TMID_CMD_SERVERS 
NTCS_TMID_DATA_SERVERS 
NTCS_ACCEPTABLE_MSG_LOSS 

20%

Definition at line 39 of file client_server.c.

Function Documentation

◆ addr_free()

static void addr_free ( char *  addr)
static

Definition at line 85 of file client_server.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addr_get()

static char* addr_get ( const char *  nid,
int  tmid 
)
static

Definition at line 70 of file client_server.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_client_server_bulk_ut()

void m0_net_test_client_server_bulk_ut ( void  )
Todo:
investigate strange m0_net_tm_stop() time on the bulk test client.

Definition at line 384 of file client_server.c.

Here is the call graph for this function:

◆ m0_net_test_client_server_ping_ut()

void m0_net_test_client_server_ping_ut ( void  )

Definition at line 369 of file client_server.c.

Here is the call graph for this function:

◆ m0_net_test_client_server_stub_ut()

void m0_net_test_client_server_stub_ut ( void  )

Definition at line 361 of file client_server.c.

Here is the call graph for this function:

◆ m0_net_test_xprt_dynamic_reg_dereg_ut()

void m0_net_test_xprt_dynamic_reg_dereg_ut ( void  )

Definition at line 405 of file client_server.c.

Here is the call graph for this function:

◆ msg_nr_in_range()

static bool msg_nr_in_range ( size_t  nr1,
size_t  nr2 
)
static

Definition at line 140 of file client_server.c.

◆ msg_nr_print()

static void msg_nr_print ( const char *  prefix,
const struct m0_net_test_msg_nr msg_nr 
)
static

Definition at line 133 of file client_server.c.

Here is the caller graph for this function:

◆ net_test_client_server()

static void net_test_client_server ( const char *  nid,
enum m0_net_test_type  type,
size_t  clients_nr,
size_t  servers_nr,
size_t  concurrency_client,
size_t  concurrency_server,
size_t  msg_nr,
m0_bcount_t  msg_size,
size_t  bd_buf_nr_client,
size_t  bd_buf_nr_server,
m0_bcount_t  bd_buf_size,
size_t  bd_nr_max 
)
static

Definition at line 159 of file client_server.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_node()

static void net_test_node ( struct m0_net_test_node_cfg node_cfg)
static

Definition at line 90 of file client_server.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_cfg_fill()

static void node_cfg_fill ( struct m0_net_test_node_cfg ncfg,
char *  addr_cmd,
char *  addr_cmd_list,
char *  addr_data,
char *  addr_data_list,
char *  addr_console,
bool  last_node 
)
static

Definition at line 111 of file client_server.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ addr_console4clients

char* addr_console4clients
static

Definition at line 60 of file client_server.c.

◆ addr_console4servers

char* addr_console4servers
static

Definition at line 61 of file client_server.c.

◆ clients

char clients[NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
static

Definition at line 62 of file client_server.c.

◆ clients_data

char clients_data[NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
static

Definition at line 64 of file client_server.c.

◆ node_cfg

struct m0_net_test_node_cfg node_cfg[NTCS_NODES_MAX *2]
static

Definition at line 56 of file client_server.c.

◆ node_init_sem

struct m0_semaphore node_init_sem
static

Definition at line 58 of file client_server.c.

◆ node_thread

struct m0_thread node_thread[NTCS_NODES_MAX *2]
static

Definition at line 57 of file client_server.c.

◆ servers

char servers[NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
static

Definition at line 63 of file client_server.c.

◆ servers_data

char servers_data[NTCS_NODES_MAX *NTCS_NODE_ADDR_MAX]
static

Definition at line 65 of file client_server.c.

◆ timeout

m0_time_t timeout = M0_MKTIME(NTCS_TIMEOUT, 0)
static

Definition at line 68 of file client_server.c.