git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/ice/base: fix PF ID for DCF
[dpdk.git]
/
app
/
test-bbdev
/
main.c
diff --git
a/app/test-bbdev/main.c
b/app/test-bbdev/main.c
index
7af2522
..
ff65173
100644
(file)
--- a/
app/test-bbdev/main.c
+++ b/
app/test-bbdev/main.c
@@
-16,18
+16,23
@@
#include "main.h"
#include "main.h"
+
/* Defines how many testcases can be specified as cmdline args */
#define MAX_CMDLINE_TESTCASES 8
static const char tc_sep = ',';
/* 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 num_ops;
unsigned int burst_sz;
unsigned int num_lcores;
static struct test_params {
struct test_command *test_to_run[MAX_CMDLINE_TESTCASES];
unsigned int num_tests;
unsigned int num_ops;
unsigned int burst_sz;
unsigned int num_lcores;
+ double snr;
+ unsigned int iter_max;
char test_vector_filename[PATH_MAX];
char test_vector_filename[PATH_MAX];
+ bool init_device;
} test_params;
static struct test_commands_list commands_list =
} test_params;
static struct test_commands_list commands_list =
@@
-46,9
+51,8
@@
unit_test_suite_runner(struct unit_test_suite *suite)
unsigned int total = 0, skipped = 0, succeeded = 0, failed = 0;
uint64_t start, end;
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();
start = rte_rdtsc_precise();
@@
-57,15
+61,13
@@
unit_test_suite_runner(struct unit_test_suite *suite)
if (test_result == TEST_FAILED) {
printf(" + Test suite setup %s failed!\n",
suite->suite_name);
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);
return 1;
}
if (test_result == TEST_SKIPPED) {
printf(" + Test suite setup %s skipped!\n",
suite->suite_name);
- printf(
- " + ------------------------------------------------------- +\n");
+ printf(" + ------------------------------------------------------- +\n");
return 0;
}
}
return 0;
}
}
@@
-82,15
+84,15
@@
unit_test_suite_runner(struct unit_test_suite *suite)
if (test_result == TEST_SUCCESS) {
succeeded++;
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++;
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++;
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);
}
suite->unit_test_cases[total].name);
}
@@
-103,7
+105,7
@@
unit_test_suite_runner(struct unit_test_suite *suite)
end = rte_rdtsc_precise();
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(" + Test Suite Summary : %s\n", suite->suite_name);
printf(" + Tests Total : %2d\n", total);
printf(" + Tests Skipped : %2d\n", skipped);
@@
-111,7
+113,7
@@
unit_test_suite_runner(struct unit_test_suite *suite)
printf(" + Tests Failed : %2d\n", failed);
printf(" + Tests Lasted : %lg ms\n",
((end - start) * 1000) / (double)rte_get_tsc_hz());
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 (failed > 0) ? 1 : 0;
}
@@
-140,12
+142,30
@@
get_num_lcores(void)
return test_params.num_lcores;
}
return test_params.num_lcores;
}
+double
+get_snr(void)
+{
+ return test_params.snr;
+}
+
+unsigned int
+get_iter_max(void)
+{
+ return test_params.iter_max;
+}
+
+bool
+get_init_device(void)
+{
+ return test_params.init_device;
+}
+
static void
print_usage(const char *prog_name)
{
struct test_command *t;
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",
"\t[-b/--burst-size BURST_SIZE]\n"
"\t[-v/--test-vector VECTOR_FILE]\n"
"\t[-c/--test-cases TEST_CASE[,TEST_CASE,...]]]\n",
@@
-174,11
+194,15
@@
parse_args(int argc, char **argv, struct test_params *tp)
{ "test-cases", 1, 0, 'c' },
{ "test-vector", 1, 0, 'v' },
{ "lcores", 1, 0, 'l' },
{ "test-cases", 1, 0, 'c' },
{ "test-vector", 1, 0, 'v' },
{ "lcores", 1, 0, 'l' },
+ { "snr", 1, 0, 's' },
+ { "iter_max", 6, 0, 't' },
+ { "init-device", 0, 0, 'i'},
{ "help", 0, 0, 'h' },
{ NULL, 0, 0, 0 }
};
{ "help", 0, 0, 'h' },
{ NULL, 0, 0, 0 }
};
+ tp->iter_max = DEFAULT_ITER;
- while ((opt = getopt_long(argc, argv, "h
n:b:c:v:l
:", lgopts,
+ while ((opt = getopt_long(argc, argv, "h
in:b:c:v:l:s:t
:", lgopts,
&option_index)) != EOF)
switch (opt) {
case 'n':
&option_index)) != EOF)
switch (opt) {
case 'n':
@@
-230,6
+254,16
@@
parse_args(int argc, char **argv, struct test_params *tp)
sizeof(tp->test_vector_filename),
"%s", optarg);
break;
sizeof(tp->test_vector_filename),
"%s", optarg);
break;
+ case 's':
+ TEST_ASSERT(strlen(optarg) > 0,
+ "SNR is not provided");
+ tp->snr = strtod(optarg, NULL);
+ break;
+ case 't':
+ TEST_ASSERT(strlen(optarg) > 0,
+ "Iter_max is not provided");
+ tp->iter_max = strtol(optarg, NULL, 10);
+ break;
case 'l':
TEST_ASSERT(strlen(optarg) > 0,
"Num of lcores is not provided");
case 'l':
TEST_ASSERT(strlen(optarg) > 0,
"Num of lcores is not provided");
@@
-238,6
+272,10
@@
parse_args(int argc, char **argv, struct test_params *tp)
"Num of lcores mustn't be greater than %u",
RTE_MAX_LCORE);
break;
"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;
case 'h':
print_usage(argv[0]);
return 0;
@@
-280,7
+318,7
@@
run_all_tests(void)
struct test_command *t;
TAILQ_FOREACH(t, &commands_list, next)
struct test_command *t;
TAILQ_FOREACH(t, &commands_list, next)
- ret |= t->callback();
+ ret |=
(int)
t->callback();
return ret;
}
return ret;
}
@@
-292,7
+330,7
@@
run_parsed_tests(struct test_params *tp)
unsigned int i;
for (i = 0; i < tp->num_tests; ++i)
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 ret;
}