app: Add cli options to print SPDK version

Change verbose mode parameter of fuzz test app from -v to -V to avoid
collisions with app framework parameters

Change-Id: Ibe562fa82408366aa487a19fad9a99e1e692b48c
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474005
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Alexey Marchuk 2019-11-12 20:12:00 +03:00 committed by Tomasz Zawadzki
parent 6c3f93c7fb
commit 4c42b933c9
6 changed files with 26 additions and 18 deletions

View File

@ -1,8 +1,8 @@
/*- /*-
* BSD LICENSE * BSD LICENSE
* *
* Copyright (c) Intel Corporation. * Copyright (c) Intel Corporation. All rights reserved.
* All rights reserved. * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -228,7 +228,7 @@ int spdk_app_parse_core_mask(const char *mask, struct spdk_cpuset *cpumask);
*/ */
struct spdk_cpuset *spdk_app_get_core_mask(void); struct spdk_cpuset *spdk_app_get_core_mask(void);
#define SPDK_APP_GETOPT_STRING "c:de:ghi:m:n:p:r:s:uB:L:RW:" #define SPDK_APP_GETOPT_STRING "c:de:ghi:m:n:p:r:s:uvB:L:RW:"
enum spdk_app_parse_args_rvals { enum spdk_app_parse_args_rvals {
SPDK_APP_PARSE_ARGS_HELP = 0, SPDK_APP_PARSE_ARGS_HELP = 0,

View File

@ -1,8 +1,8 @@
/*- /*-
* BSD LICENSE * BSD LICENSE
* *
* Copyright (c) Intel Corporation. * Copyright (c) Intel Corporation. All rights reserved.
* All rights reserved. * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -32,6 +32,7 @@
*/ */
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/version.h"
#include "spdk_internal/event.h" #include "spdk_internal/event.h"
@ -105,6 +106,8 @@ static const struct option g_cmdline_options[] = {
{"mem-size", required_argument, NULL, MEM_SIZE_OPT_IDX}, {"mem-size", required_argument, NULL, MEM_SIZE_OPT_IDX},
#define NO_PCI_OPT_IDX 'u' #define NO_PCI_OPT_IDX 'u'
{"no-pci", no_argument, NULL, NO_PCI_OPT_IDX}, {"no-pci", no_argument, NULL, NO_PCI_OPT_IDX},
#define VERSION_OPT_IDX 'v'
{"version", no_argument, NULL, VERSION_OPT_IDX},
#define PCI_BLACKLIST_OPT_IDX 'B' #define PCI_BLACKLIST_OPT_IDX 'B'
{"pci-blacklist", required_argument, NULL, PCI_BLACKLIST_OPT_IDX}, {"pci-blacklist", required_argument, NULL, PCI_BLACKLIST_OPT_IDX},
#define LOGFLAG_OPT_IDX 'L' #define LOGFLAG_OPT_IDX 'L'
@ -758,6 +761,7 @@ usage(void (*app_usage)(void))
printf(" -B, --pci-blacklist <bdf>\n"); printf(" -B, --pci-blacklist <bdf>\n");
printf(" pci addr to blacklist (can be used more than once)\n"); printf(" pci addr to blacklist (can be used more than once)\n");
printf(" -R, --huge-unlink unlink huge files after initialization\n"); printf(" -R, --huge-unlink unlink huge files after initialization\n");
printf(" -v, --version print SPDK version\n");
printf(" -W, --pci-whitelist <bdf>\n"); printf(" -W, --pci-whitelist <bdf>\n");
printf(" pci addr to whitelist (-B and -W cannot be used at the same time)\n"); printf(" pci addr to whitelist (-B and -W cannot be used at the same time)\n");
printf(" --huge-dir <path> use a specific hugetlbfs mount to reserve memory from\n"); printf(" --huge-dir <path> use a specific hugetlbfs mount to reserve memory from\n");
@ -989,6 +993,10 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
fprintf(stderr, fprintf(stderr,
"Deprecation warning: The maximum allowed latency parameter is no longer supported.\n"); "Deprecation warning: The maximum allowed latency parameter is no longer supported.\n");
break; break;
case VERSION_OPT_IDX:
printf(SPDK_VERSION_STRING"\n");
retval = SPDK_APP_PARSE_ARGS_HELP;
goto out;
case '?': case '?':
/* /*
* In the event getopt() above detects an option * In the event getopt() above detects an option

View File

@ -19,7 +19,7 @@ By default, the fuzzer will print commands that:
Commands are dumped as named objects in json format which can then be supplied back to the Commands are dumped as named objects in json format which can then be supplied back to the
script for targeted debugging on a subsequent run. See `Debugging` below. script for targeted debugging on a subsequent run. See `Debugging` below.
By default no output is generated when a specific command is returned with a failed status. By default no output is generated when a specific command is returned with a failed status.
This can be overridden with the -v flag. if -v is specified, each command will be dumped as This can be overridden with the -V flag. if -V is specified, each command will be dumped as
it is completed in the JSON format specified above. it is completed in the JSON format specified above.
At the end of each test run, a summary is printed for each namespace in the following format: At the end of each test run, a summary is printed for each namespace in the following format:

View File

@ -1,8 +1,8 @@
/*- /*-
* BSD LICENSE * BSD LICENSE
* *
* Copyright (c) Intel Corporation. * Copyright (c) Intel Corporation. All rights reserved.
* All rights reserved. * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -846,7 +846,7 @@ This helps dig deeper into other errors besides invalid namespace.\n");
fprintf(stderr, " -S <integer> Seed value for test.\n"); fprintf(stderr, " -S <integer> Seed value for test.\n");
fprintf(stderr, fprintf(stderr,
" -t <integer> Time in seconds to run the fuzz test. Only valid if -j is not specified.\n"); " -t <integer> Time in seconds to run the fuzz test. Only valid if -j is not specified.\n");
fprintf(stderr, " -v Enable logging of each submitted command.\n"); fprintf(stderr, " -V Enable logging of each submitted command.\n");
} }
static int static int
@ -883,7 +883,7 @@ nvme_fuzz_parse(int ch, char *arg)
return -1; return -1;
} }
break; break;
case 'v': case 'V':
g_verbose_mode = true; g_verbose_mode = true;
break; break;
case '?': case '?':
@ -905,7 +905,7 @@ main(int argc, char **argv)
g_runtime = DEFAULT_RUNTIME; g_runtime = DEFAULT_RUNTIME;
g_run = true; g_run = true;
if ((rc = spdk_app_parse_args(argc, argv, &opts, "aC:j:NS:t:v", NULL, nvme_fuzz_parse, if ((rc = spdk_app_parse_args(argc, argv, &opts, "aC:j:NS:t:V", NULL, nvme_fuzz_parse,
nvme_fuzz_usage) != SPDK_APP_PARSE_ARGS_SUCCESS)) { nvme_fuzz_usage) != SPDK_APP_PARSE_ARGS_SUCCESS)) {
return rc; return rc;
} }

View File

@ -39,7 +39,7 @@ always be started with the --wait-for-rpc argument. Please see below for an exam
~~~ ~~~
./test/app/fuzz/vhost_fuzz/vhost_fuzz -t 30 --wait-for-rpc & ./test/app/fuzz/vhost_fuzz/vhost_fuzz -t 30 --wait-for-rpc &
./scripts/rpc.py fuzz_vhost_create_dev -s ./Vhost.1 -b -v ./scripts/rpc.py fuzz_vhost_create_dev -s ./Vhost.1 -b -V
./scripts/rpc.py fuzz_vhost_create_dev -s ./naa.VhostScsi0.1 -l -v ./scripts/rpc.py fuzz_vhost_create_dev -s ./naa.VhostScsi0.1 -l -V
./scripts/rpc.py framework_start_init ./scripts/rpc.py framework_start_init
~~~ ~~~

View File

@ -1,8 +1,8 @@
/*- /*-
* BSD LICENSE * BSD LICENSE
* *
* Copyright (c) Intel Corporation. * Copyright (c) Intel Corporation. All rights reserved.
* All rights reserved. * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -1066,7 +1066,7 @@ fuzz_vhost_usage(void)
" -k Keep the iov pointer addresses from the json file. only valid with -j.\n"); " -k Keep the iov pointer addresses from the json file. only valid with -j.\n");
fprintf(stderr, " -S <integer> Seed value for test.\n"); fprintf(stderr, " -S <integer> Seed value for test.\n");
fprintf(stderr, " -t <integer> Time in seconds to run the fuzz test.\n"); fprintf(stderr, " -t <integer> Time in seconds to run the fuzz test.\n");
fprintf(stderr, " -v Enable logging of each submitted command.\n"); fprintf(stderr, " -V Enable logging of each submitted command.\n");
} }
static int static int
@ -1097,7 +1097,7 @@ fuzz_vhost_parse(int ch, char *arg)
return -1; return -1;
} }
break; break;
case 'v': case 'V':
g_verbose_mode = true; g_verbose_mode = true;
break; break;
case '?': case '?':
@ -1117,7 +1117,7 @@ main(int argc, char **argv)
opts.name = "vhost_fuzz"; opts.name = "vhost_fuzz";
g_runtime = DEFAULT_RUNTIME; g_runtime = DEFAULT_RUNTIME;
rc = spdk_app_parse_args(argc, argv, &opts, "j:kS:t:v", NULL, fuzz_vhost_parse, fuzz_vhost_usage); rc = spdk_app_parse_args(argc, argv, &opts, "j:kS:t:V", NULL, fuzz_vhost_parse, fuzz_vhost_usage);
if (rc != SPDK_APP_PARSE_ARGS_SUCCESS) { if (rc != SPDK_APP_PARSE_ARGS_SUCCESS) {
fprintf(stderr, "Unable to parse the application arguments.\n"); fprintf(stderr, "Unable to parse the application arguments.\n");
return -1; return -1;