Skip to content

Commit

Permalink
fabtests: Add option to change progress model
Browse files Browse the repository at this point in the history
Adds options to change data/control progress models.

Signed-off-by: Seth Zegelstein <szegel@amazon.com>
  • Loading branch information
a-szegel authored and j-xiong committed Mar 5, 2024
1 parent f63359d commit 9de84b7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fabtests/common/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -4156,6 +4156,10 @@ void ft_longopts_usage()
FT_PRINT_OPTS_USAGE("--debug-assert",
"Replace asserts with while loops to force process to\n"
"spin until a debugger can be attached.");
FT_PRINT_OPTS_USAGE("--data-progress <progress_model>",
"manual, or auto");
FT_PRINT_OPTS_USAGE("--control-progress <progress_model>",
"manual, auto, or unified");
}

int debug_assert;
Expand All @@ -4165,9 +4169,25 @@ struct option long_opts[] = {
{"pin-core", required_argument, NULL, LONG_OPT_PIN_CORE},
{"timeout", required_argument, NULL, LONG_OPT_TIMEOUT},
{"debug-assert", no_argument, &debug_assert, LONG_OPT_DEBUG_ASSERT},
{"data-progress", required_argument, NULL, LONG_OPT_DATA_PROGRESS},
{"control-progress", required_argument, NULL, LONG_OPT_CONTROL_PROGRESS},
{NULL, 0, NULL, 0},
};

int ft_parse_progress_model_string(char* progress_str)
{
int ret = -1;

if (!strcasecmp("manual", progress_str))
ret = FI_PROGRESS_MANUAL;
else if (!strcasecmp("auto", progress_str))
ret = FI_PROGRESS_AUTO;
else if (!strcasecmp("unified", progress_str))
ret = FI_PROGRESS_CONTROL_UNIFIED;

return ret;
}

int ft_parse_long_opts(int op, char *optarg)
{
switch (op) {
Expand All @@ -4178,6 +4198,16 @@ int ft_parse_long_opts(int op, char *optarg)
return 0;
case LONG_OPT_DEBUG_ASSERT:
return 0;
case LONG_OPT_DATA_PROGRESS:
hints->domain_attr->data_progress = ft_parse_progress_model_string(optarg);
if (hints->domain_attr->data_progress == -1)
return EXIT_FAILURE;
return 0;
case LONG_OPT_CONTROL_PROGRESS:
hints->domain_attr->control_progress = ft_parse_progress_model_string(optarg);
if (hints->domain_attr->control_progress == -1)
return EXIT_FAILURE;
return 0;
default:
return EXIT_FAILURE;
}
Expand Down
2 changes: 2 additions & 0 deletions fabtests/include/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@ enum {
LONG_OPT_PIN_CORE = 1,
LONG_OPT_TIMEOUT,
LONG_OPT_DEBUG_ASSERT,
LONG_OPT_DATA_PROGRESS,
LONG_OPT_CONTROL_PROGRESS,
};

extern int debug_assert;
Expand Down

0 comments on commit 9de84b7

Please sign in to comment.