Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/control/lib/daos/api/libdaos_selftest.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2024 Intel Corporation.
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand All @@ -23,7 +24,7 @@ func run_self_test(sizes *C.struct_st_size_params, numSizes C.int, repCount C.in
sizeLatencies ****C.struct_st_latency, bufAlignment C.int16_t) C.int {
return C.run_self_test(sizes, numSizes, repCount, maxInflight, groupName,
optMsEndpoints, numOptMsEndpoints, tgtEndpoints, numTgtEndpoints,
msEndpoints, numMsEndpoints, sizeLatencies, bufAlignment, nil, true, true)
msEndpoints, numMsEndpoints, sizeLatencies, bufAlignment, nil, true, true, false)
}

func self_test_fini(agent_used C.bool) {
Expand Down
20 changes: 16 additions & 4 deletions src/utils/self_test/self_test.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -412,6 +412,11 @@ print_usage(const char *prog_name, const char *msg_sizes_str, int rep_count, int
" the address information in: prefix/group_name.attach_info_tmp.\n"
" Note the = sign in the option.\n"
"\n"
" --dump-info\n"
" Short version: -d\n"
" Initialize CART, dump the self transport URI and attached group\n"
" summary, then exit cleanly without starting the self-test workload.\n"
"\n"
" --use-daos-agent-env\n"
" Short version: -u\n"
" This option sets the following env vars through a running daos_agent.\n"
Expand Down Expand Up @@ -929,6 +934,7 @@ int main(int argc, char *argv[])
bool randomize_eps = false;
bool use_agent = false;
bool no_sync = false;
bool dump_info = false;

ret = d_log_init();
if (ret != 0) {
Expand All @@ -950,10 +956,11 @@ int main(int argc, char *argv[])
{"path", required_argument, 0, 'p'},
{"use-daos-agent-env", no_argument, 0, 'u'},
{"no-sync", no_argument, 0, 'n'},
{"dump-info", no_argument, 0, 'd'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}};

c = getopt_long(argc, argv, "g:m:e:s:r:i:a:bhqp:un", long_options, NULL);
c = getopt_long(argc, argv, "g:m:e:s:r:i:a:bdhqp:un", long_options, NULL);
if (c == -1)
break;

Expand Down Expand Up @@ -1002,6 +1009,9 @@ int main(int argc, char *argv[])
case 'b':
output_megabits = 1;
break;
case 'd':
dump_info = true;
break;
case 'p':
attach_info_path = optarg;
break;
Expand Down Expand Up @@ -1210,12 +1220,14 @@ int main(int argc, char *argv[])
ret = run_self_test(all_params, num_msg_sizes, rep_count, max_inflight, dest_name,
ms_endpts_opt, num_ms_endpts_opt, tgt_endpts, num_tgt_endpts,
&ms_endpts, &num_ms_endpts, &size_latencies, buf_alignment,
attach_info_path, use_agent, no_sync);
attach_info_path, use_agent, no_sync, dump_info);
if (ret != 0) {
DL_ERROR(ret, "run_self_test() failed");
D_GOTO(cleanup, ret);
}

if (dump_info)
D_GOTO(cleanup, ret);

/********************* Print the results *********************/
for (j = 0; j < num_msg_sizes; j++) {
struct crt_st_start_params test_params = {0};
Expand Down
72 changes: 60 additions & 12 deletions src/utils/self_test/self_test_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,50 @@
pthread_exit(NULL);
}

static int
self_test_dump_info(crt_group_t *grp, crt_context_t ctx, char *dest_name, char *attach_info_path,
d_rank_list_t *rank_list, bool use_agent)
{
char *uri;
d_rank_t rank;
int rc;
int i;

rc = crt_context_uri_get(ctx, &uri);
D_ASSERTF(rc == 0, "crt_context_uri_get() failed; rc=%d\n", rc);

printf("\nDumping info:\n");
printf("----------------------------\n");
printf("self_uri: %s\n", uri);
free(uri);

printf("group: '%s'\n", dest_name);
printf("group size: %d\n", rank_list->rl_nr);
printf("daos_agent: %s\n", use_agent ? "yes" : "no");

if (!use_agent)
printf("attach_path: %s/%s.attach_info\n", attach_info_path, dest_name);

printf("ranks:\n");
for (i = 0; i < rank_list->rl_nr; i++) {
rank = rank_list->rl_ranks[i];
rc = crt_rank_uri_get(grp, rank, 0, &uri);
if (rc != 0) {
DL_ERROR(rc, "crt_rank_uri_get() failed for rank=%d\n", rank);

Check warning on line 80 in src/utils/self_test/self_test_lib.c

View workflow job for this annotation

GitHub Actions / Logging macro checking

check-return, Line contains too many newlines
continue;
}

printf("\t%d : %s\n", rank, uri);
free(uri);
}

printf("\n----------------------------\n\n");
return 0;
}

static int
self_test_init(char *dest_name, crt_context_t *crt_ctx, crt_group_t **srv_grp, pthread_t *tid,
char *attach_info_path, bool listen, bool use_agent, bool no_sync)
char *attach_info_path, bool listen, bool use_agent, bool no_sync, bool dump_info)
{
uint32_t init_flags = 0;
uint32_t grp_size;
Expand Down Expand Up @@ -139,12 +180,6 @@

g_shutdown_flag = 0;

ret = pthread_create(tid, NULL, progress_fn, crt_ctx);
if (ret != 0) {
D_ERROR("failed to create progress thread: %s\n", strerror(errno));
return -DER_MISC;
}

ret = crt_group_size(*srv_grp, &grp_size);
D_ASSERTF(ret == 0, "crt_group_size() failed; rc=%d\n", ret);

Expand All @@ -156,6 +191,17 @@
D_ASSERTF(rank_list->rl_nr == grp_size, "rank_list differs in size. expected %d got %d\n",
grp_size, rank_list->rl_nr);

if (dump_info) {
ret = self_test_dump_info(*srv_grp, *crt_ctx, dest_name, attach_info_path,
rank_list, use_agent);
return ret;
}

ret = pthread_create(tid, NULL, progress_fn, crt_ctx);
if (ret != 0) {
D_ERROR("failed to create progress thread: %s\n", strerror(errno));
return -DER_MISC;
}
/* waiting to sync with the following parameters
* 0 - tag 0
* 1 - total ctx
Expand Down Expand Up @@ -546,7 +592,7 @@
uint32_t num_ms_endpts_in, struct st_endpoint *endpts, uint32_t num_endpts,
struct st_master_endpt **ms_endpts_out, uint32_t *num_ms_endpts_out,
struct st_latency ****size_latencies_out, int16_t buf_alignment,
char *attach_info_path, bool use_agent, bool no_sync)
char *attach_info_path, bool use_agent, bool no_sync, bool dump_info)
{
crt_context_t crt_ctx;
crt_group_t *srv_grp;
Expand Down Expand Up @@ -580,11 +626,12 @@
listen = true;
/* Initialize CART */
ret = self_test_init(dest_name, &crt_ctx, &srv_grp, &tid, attach_info_path,
listen /* run as server */, use_agent, no_sync);
if (ret != 0) {
D_ERROR("self_test_init failed; ret = %d\n", ret);
listen /* run as server */, use_agent, no_sync, dump_info);
if (ret != 0)
D_GOTO(cleanup_nothread, ret);
}

if (dump_info)
D_GOTO(cart_cleanup, ret);

/* Get the group/rank/tag for this application (self_endpt) */
ret = crt_group_rank(NULL, &self_endpt.ep_rank);
Expand Down Expand Up @@ -786,6 +833,7 @@
*num_ms_endpts_out = num_ms_endpts;
}

cart_cleanup:
if (srv_grp != NULL && g_group_inited) {
cleanup_ret = crt_group_detach(srv_grp);
if (cleanup_ret != 0)
Expand Down
5 changes: 3 additions & 2 deletions src/utils/self_test/self_test_lib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2026 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -48,7 +49,7 @@ run_self_test(struct st_size_params all_params[], int num_msg_sizes, int rep_cou
uint32_t num_ms_endpts_in, struct st_endpoint *endpts, uint32_t num_endpts,
struct st_master_endpt **ms_endpts_out, uint32_t *num_ms_endpts_out,
struct st_latency ****size_latencies, int16_t buf_alignment, char *attach_info_path,
bool use_agent, bool no_sync);
bool use_agent, bool no_sync, bool dump_info);
int
st_compare_endpts(const void *a_in, const void *b_in);
int
Expand All @@ -60,4 +61,4 @@ free_size_latencies(struct st_latency ***latencies, uint32_t num_msg_sizes, uint
void
self_test_fini(bool agent_used);

#endif /* __SELF_TEST_LIB_H__ */
#endif /* __SELF_TEST_LIB_H__ */
Loading