app/compress-perf: add --ptest option
This patch adds --ptest option to make possible to choose test case from command line. Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com> Acked-by: Artur Trybula <arturx.trybula@intel.com> Acked-by: Shally Verma <shallyv@marvell.com>
This commit is contained in:
parent
424dd6c8c1
commit
1a9b0f3504
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "comp_perf_options.h"
|
#include "comp_perf_options.h"
|
||||||
|
|
||||||
|
#define CPERF_PTEST_TYPE ("ptest")
|
||||||
#define CPERF_DRIVER_NAME ("driver-name")
|
#define CPERF_DRIVER_NAME ("driver-name")
|
||||||
#define CPERF_TEST_FILE ("input-file")
|
#define CPERF_TEST_FILE ("input-file")
|
||||||
#define CPERF_SEG_SIZE ("seg-sz")
|
#define CPERF_SEG_SIZE ("seg-sz")
|
||||||
@ -37,6 +38,7 @@ static void
|
|||||||
usage(char *progname)
|
usage(char *progname)
|
||||||
{
|
{
|
||||||
printf("%s [EAL options] --\n"
|
printf("%s [EAL options] --\n"
|
||||||
|
" --ptest benchmark / verify :"
|
||||||
" --driver-name NAME: compress driver to use\n"
|
" --driver-name NAME: compress driver to use\n"
|
||||||
" --input-file NAME: file to compress and decompress\n"
|
" --input-file NAME: file to compress and decompress\n"
|
||||||
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
|
" --extended-input-sz N: extend file data up to this size (default: no extension)\n"
|
||||||
@ -75,6 +77,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
|
||||||
|
{
|
||||||
|
struct name_id_map cperftest_namemap[] = {
|
||||||
|
{
|
||||||
|
cperf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
|
||||||
|
CPERF_TEST_TYPE_BENCHMARK
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
|
||||||
|
CPERF_TEST_TYPE_VERIFY
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int id = get_str_key_id_mapping(
|
||||||
|
(struct name_id_map *)cperftest_namemap,
|
||||||
|
RTE_DIM(cperftest_namemap), arg);
|
||||||
|
if (id < 0) {
|
||||||
|
RTE_LOG(ERR, USER1, "failed to parse test type");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
test_data->test = (enum cperf_perf_test_type)id;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_uint32_t(uint32_t *value, const char *arg)
|
parse_uint32_t(uint32_t *value, const char *arg)
|
||||||
{
|
{
|
||||||
@ -501,6 +530,8 @@ struct long_opt_parser {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct option lgopts[] = {
|
static struct option lgopts[] = {
|
||||||
|
|
||||||
|
{ CPERF_PTEST_TYPE, required_argument, 0, 0 },
|
||||||
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
|
{ CPERF_DRIVER_NAME, required_argument, 0, 0 },
|
||||||
{ CPERF_TEST_FILE, required_argument, 0, 0 },
|
{ CPERF_TEST_FILE, required_argument, 0, 0 },
|
||||||
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
|
{ CPERF_SEG_SIZE, required_argument, 0, 0 },
|
||||||
@ -519,6 +550,7 @@ static int
|
|||||||
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
|
comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
|
||||||
{
|
{
|
||||||
struct long_opt_parser parsermap[] = {
|
struct long_opt_parser parsermap[] = {
|
||||||
|
{ CPERF_PTEST_TYPE, parse_cperf_test_type },
|
||||||
{ CPERF_DRIVER_NAME, parse_driver_name },
|
{ CPERF_DRIVER_NAME, parse_driver_name },
|
||||||
{ CPERF_TEST_FILE, parse_test_file },
|
{ CPERF_TEST_FILE, parse_test_file },
|
||||||
{ CPERF_SEG_SIZE, parse_seg_sz },
|
{ CPERF_SEG_SIZE, parse_seg_sz },
|
||||||
|
@ -30,6 +30,8 @@ Limitations
|
|||||||
Command line options
|
Command line options
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
``--ptest [benchmark/verify]``: set test type (default: benchmark)
|
||||||
|
|
||||||
``--driver-name NAME``: compress driver to use
|
``--driver-name NAME``: compress driver to use
|
||||||
|
|
||||||
``--input-file NAME``: file to compress and decompress
|
``--input-file NAME``: file to compress and decompress
|
||||||
|
Loading…
Reference in New Issue
Block a user