MCPcopy Create free account
hub / github.com/F-Stack/f-stack / main

Function main

dpdk/app/test-dma-perf/main.c:477–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475}
476
477int
478main(int argc, char *argv[])
479{
480 int ret;
481 uint16_t case_nb;
482 uint32_t i, nb_lcores;
483 pid_t cpid, wpid;
484 int wstatus;
485 char args[MAX_EAL_PARAM_NB][MAX_EAL_PARAM_LEN];
486 char *pargs[MAX_EAL_PARAM_NB];
487 char *cfg_path_ptr = NULL;
488 char *rst_path_ptr = NULL;
489 char rst_path[PATH_MAX];
490 int new_argc;
491
492 memset(args, 0, sizeof(args));
493
494 for (i = 0; i < RTE_DIM(pargs); i++)
495 pargs[i] = args[i];
496
497 for (i = 0; i < (uint32_t)argc; i++) {
498 if (strncmp(argv[i], CMDLINE_CONFIG_ARG, MAX_LONG_OPT_SZ) == 0)
499 cfg_path_ptr = argv[i + 1];
500 if (strncmp(argv[i], CMDLINE_RESULT_ARG, MAX_LONG_OPT_SZ) == 0)
501 rst_path_ptr = argv[i + 1];
502 }
503 if (cfg_path_ptr == NULL) {
504 printf("Config file not assigned.\n");
505 return -1;
506 }
507 if (rst_path_ptr == NULL) {
508 strlcpy(rst_path, cfg_path_ptr, PATH_MAX);
509 char *token = strtok(basename(rst_path), ".");
510 if (token == NULL) {
511 printf("Config file error.\n");
512 return -1;
513 }
514 strcat(token, "_result.csv");
515 rst_path_ptr = rst_path;
516 }
517
518 case_nb = load_configs(cfg_path_ptr);
519 fd = fopen(rst_path_ptr, "w");
520 if (fd == NULL) {
521 printf("Open output CSV file error.\n");
522 return -1;
523 }
524 fclose(fd);
525
526 printf("Running cases...\n");
527 for (i = 0; i < case_nb; i++) {
528 if (!test_cases[i].is_valid) {
529 printf("Invalid test case %d.\n\n", i + 1);
530 snprintf(output_str[0], MAX_OUTPUT_STR_LEN, "Invalid case %d\n", i + 1);
531
532 fd = fopen(rst_path_ptr, "a");
533 if (!fd) {
534 printf("Open output CSV file error.\n");

Callers

nothing calls this directly

Calls 15

memsetFunction · 0.85
strncmpFunction · 0.85
strtokFunction · 0.85
strcatFunction · 0.85
load_configsFunction · 0.85
snprintfFunction · 0.85
output_csvFunction · 0.85
append_eal_argsFunction · 0.85
rte_exitFunction · 0.85
rte_lcore_countFunction · 0.85
output_env_infoFunction · 0.85
run_testFunction · 0.70

Tested by

no test coverage detected