Commit 4c42b933 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

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: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: default avatarSasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: default avatarEvgeniy Kochetov <evgeniik@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474005


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 6c3f93c7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
/*-
 *   BSD LICENSE
 *
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 *   Copyright (c) Intel Corporation.  All rights reserved.
 *   Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   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);

#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 {
	SPDK_APP_PARSE_ARGS_HELP = 0,
+10 −2
Original line number Diff line number Diff line
/*-
 *   BSD LICENSE
 *
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 *   Copyright (c) Intel Corporation. All rights reserved.
 *   Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
 */

#include "spdk/stdinc.h"
#include "spdk/version.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},
#define NO_PCI_OPT_IDX		'u'
	{"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'
	{"pci-blacklist",		required_argument,	NULL, PCI_BLACKLIST_OPT_IDX},
#define LOGFLAG_OPT_IDX	'L'
@@ -758,6 +761,7 @@ usage(void (*app_usage)(void))
	printf(" -B, --pci-blacklist <bdf>\n");
	printf("                           pci addr to blacklist (can be used more than once)\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("                           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");
@@ -989,6 +993,10 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
			fprintf(stderr,
				"Deprecation warning: The maximum allowed latency parameter is no longer supported.\n");
			break;
		case VERSION_OPT_IDX:
			printf(SPDK_VERSION_STRING"\n");
			retval = SPDK_APP_PARSE_ARGS_HELP;
			goto out;
		case '?':
			/*
			 * In the event getopt() above detects an option
+1 −1
Original line number Diff line number Diff line
@@ -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
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.
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.
At the end of each test run, a summary is printed for each namespace in the following format:

+5 −5
Original line number Diff line number Diff line
/*-
 *   BSD LICENSE
 *
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 *   Copyright (c) Intel Corporation. All rights reserved.
 *   Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   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,
		" -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
@@ -883,7 +883,7 @@ nvme_fuzz_parse(int ch, char *arg)
			return -1;
		}
		break;
	case 'v':
	case 'V':
		g_verbose_mode = true;
		break;
	case '?':
@@ -905,7 +905,7 @@ main(int argc, char **argv)
	g_runtime = DEFAULT_RUNTIME;
	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)) {
		return rc;
	}
+2 −2
Original line number Diff line number Diff line
@@ -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 &
./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 ./Vhost.1 -b -V
./scripts/rpc.py fuzz_vhost_create_dev -s ./naa.VhostScsi0.1 -l -V
./scripts/rpc.py framework_start_init
~~~
Loading