#include "main.h"
+
/* Defines how many testcases can be specified as cmdline args */
#define MAX_CMDLINE_TESTCASES 8
static const char tc_sep = ',';
+/* Declare structure for command line test parameters and options */
static struct test_params {
struct test_command *test_to_run[MAX_CMDLINE_TESTCASES];
unsigned int num_tests;
unsigned int burst_sz;
unsigned int num_lcores;
char test_vector_filename[PATH_MAX];
+ bool init_device;
} test_params;
static struct test_commands_list commands_list =
unsigned int total = 0, skipped = 0, succeeded = 0, failed = 0;
uint64_t start, end;
- printf(
- "\n + ------------------------------------------------------- +\n");
- printf(" + Starting Test Suite : %s\n", suite->suite_name);
+ printf("\n===========================================================\n");
+ printf("Starting Test Suite : %s\n", suite->suite_name);
start = rte_rdtsc_precise();
if (test_result == TEST_FAILED) {
printf(" + Test suite setup %s failed!\n",
suite->suite_name);
- printf(
- " + ------------------------------------------------------- +\n");
+ printf(" + ------------------------------------------------------- +\n");
return 1;
}
if (test_result == TEST_SKIPPED) {
printf(" + Test suite setup %s skipped!\n",
suite->suite_name);
- printf(
- " + ------------------------------------------------------- +\n");
+ printf(" + ------------------------------------------------------- +\n");
return 0;
}
}
if (test_result == TEST_SUCCESS) {
succeeded++;
- printf(" + TestCase [%2d] : %s passed\n", total,
+ printf("TestCase [%2d] : %s passed\n", total,
suite->unit_test_cases[total].name);
} else if (test_result == TEST_SKIPPED) {
skipped++;
- printf(" + TestCase [%2d] : %s skipped\n", total,
+ printf("TestCase [%2d] : %s skipped\n", total,
suite->unit_test_cases[total].name);
} else {
failed++;
- printf(" + TestCase [%2d] : %s failed\n", total,
+ printf("TestCase [%2d] : %s failed\n", total,
suite->unit_test_cases[total].name);
}
end = rte_rdtsc_precise();
- printf(" + ------------------------------------------------------- +\n");
+ printf(" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n");
printf(" + Test Suite Summary : %s\n", suite->suite_name);
printf(" + Tests Total : %2d\n", total);
printf(" + Tests Skipped : %2d\n", skipped);
printf(" + Tests Failed : %2d\n", failed);
printf(" + Tests Lasted : %lg ms\n",
((end - start) * 1000) / (double)rte_get_tsc_hz());
- printf(" + ------------------------------------------------------- +\n");
+ printf(" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n");
return (failed > 0) ? 1 : 0;
}
return test_params.num_lcores;
}
+bool
+get_init_device(void)
+{
+ return test_params.init_device;
+}
+
static void
print_usage(const char *prog_name)
{
struct test_command *t;
- printf("Usage: %s [EAL params] [-- [-n/--num-ops NUM_OPS]\n"
+ printf("***Usage: %s [EAL params] [-- [-n/--num-ops NUM_OPS]\n"
"\t[-b/--burst-size BURST_SIZE]\n"
"\t[-v/--test-vector VECTOR_FILE]\n"
"\t[-c/--test-cases TEST_CASE[,TEST_CASE,...]]]\n",
{ "test-cases", 1, 0, 'c' },
{ "test-vector", 1, 0, 'v' },
{ "lcores", 1, 0, 'l' },
+ { "init-device", 0, 0, 'i'},
{ "help", 0, 0, 'h' },
{ NULL, 0, 0, 0 }
};
- while ((opt = getopt_long(argc, argv, "hn:b:c:v:l:", lgopts,
+ while ((opt = getopt_long(argc, argv, "hin:b:c:v:l:", lgopts,
&option_index)) != EOF)
switch (opt) {
case 'n':
TEST_ASSERT(strlen(optarg) > 0,
"Config file name is null");
- strncpy(tp->test_vector_filename, optarg,
- sizeof(tp->test_vector_filename));
+ snprintf(tp->test_vector_filename,
+ sizeof(tp->test_vector_filename),
+ "%s", optarg);
break;
case 'l':
TEST_ASSERT(strlen(optarg) > 0,
"Num of lcores mustn't be greater than %u",
RTE_MAX_LCORE);
break;
+ case 'i':
+ /* indicate fpga fec config required */
+ tp->init_device = true;
+ break;
case 'h':
print_usage(argv[0]);
return 0;
struct test_command *t;
TAILQ_FOREACH(t, &commands_list, next)
- ret |= t->callback();
+ ret |= (int) t->callback();
return ret;
}
unsigned int i;
for (i = 0; i < tp->num_tests; ++i)
- ret |= tp->test_to_run[i]->callback();
+ ret |= (int) tp->test_to_run[i]->callback();
return ret;
}
return 1;
}
- rte_log_set_global_level(RTE_LOG_INFO);
-
/* If no argument provided - run all tests */
if (test_params.num_tests == 0)
return run_all_tests();