Skip to content

Commit

Permalink
fix: change perf test config
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Dec 19, 2023
1 parent 30d1bed commit 2a371f0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions tests/z_perf_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,30 @@ void on_sample(const z_sample_t *sample, void *context) {

int main(int argc, char **argv) {
char *keyexpr = "test/thr";
const char *mode = "client";
const char *mode = NULL;
char *llocator = NULL;
char *clocator = NULL;
(void)argv;

// Check if peer mode
// Check if peer or client mode
if (argc > 1) {
mode = "peer";
llocator = "udp/224.0.0.224:7447#iface=lo";
} else {
mode = "client";
clocator = "tcp/127.0.0.1:7447";
}
// Set config
z_owned_config_t config = z_config_default();
zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(mode));
if (mode != NULL) {
zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(mode));
}
if (llocator != NULL) {
zp_config_insert(z_loan(config), Z_CONFIG_LISTEN_KEY, z_string_make(llocator));
}
if (clocator != NULL) {
zp_config_insert(z_loan(config), Z_CONFIG_CONNECT_KEY, z_string_make(clocator));
}
// Open session
z_owned_session_t s = z_open(z_move(config));
if (!z_check(s)) {
Expand Down
15 changes: 12 additions & 3 deletions tests/z_perf_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,30 @@ int main(int argc, char **argv) {
uint8_t *value = (uint8_t *)malloc(len_array[0]);
memset(value, 1, len_array[0]);
char *keyexpr = "test/thr";
const char *mode = "client";
const char *mode = NULL;
char *llocator = NULL;
char *clocator = NULL;
(void)argv;

// Check if peer mode
// Check if peer or client mode
if (argc > 1) {
mode = "peer";
llocator = "udp/224.0.0.224:7447#iface=lo";
} else {
mode = "client";
clocator = "tcp/127.0.0.1:7447";
}
// Set config
z_owned_config_t config = z_config_default();
zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(mode));
if (mode != NULL) {
zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(mode));
}
if (llocator != NULL) {
zp_config_insert(z_loan(config), Z_CONFIG_LISTEN_KEY, z_string_make(llocator));
}
if (clocator != NULL) {
zp_config_insert(z_loan(config), Z_CONFIG_CONNECT_KEY, z_string_make(clocator));
}
// Open session
z_owned_session_t s = z_open(z_move(config));
if (!z_check(s)) {
Expand Down

0 comments on commit 2a371f0

Please sign in to comment.