Commit 6a41e84c authored by WANGHAILIANG's avatar WANGHAILIANG Committed by Tomasz Zawadzki
Browse files

test/blobfs: Drop .ini config in favor of json



Change-Id: I2a4db21149698e06389b280c875658a6a0d69e9b
Signed-off-by: default avatarWANGHAILIANG <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2894


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 8be2424a
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@
static void cli_start(void *arg1);

static const char *program_name = "blobcli";
/* default name for .conf file, any name can be used however with -c switch */
static const char *program_conf = "blobcli.conf";
/* default name for .json file, any name can be used however with -j switch */
static const char *program_conf = "blobcli.json";

/*
 * CMD mode runs one command at a time which can be annoying as the init takes
@@ -179,7 +179,7 @@ usage(struct cli_context_t *cli_context, char *msg)

	if (!cli_context || cli_context->cli_mode == CLI_MODE_CMD) {
		printf("Version %s\n", SPDK_VERSION_STRING);
		printf("Usage: %s [-c SPDK config_file] Command\n", program_name);
		printf("Usage: %s [-j SPDK josn_config_file] Command\n", program_name);
		printf("\n%s is a command line tool for interacting with blobstore\n",
		       program_name);
		printf("on the underlying device specified in the conf file passed\n");
@@ -1042,7 +1042,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
	int cmd_chosen = 0;
	char resp;

	while ((op = getopt(argc, argv, "b:c:d:f:hil:m:n:p:r:s:DST:Xx:")) != -1) {
	while ((op = getopt(argc, argv, "b:d:f:hij:l:m:n:p:r:s:DST:Xx:")) != -1) {
		switch (op) {
		case 'b':
			if (strcmp(cli_context->bdev_name, "") == 0) {
@@ -1052,13 +1052,6 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
				usage(cli_context, "ERROR: -b option can only be set once.\n");
			}
			break;
		case 'c':
			if (cli_context->app_started == false) {
				cli_context->config_file = optarg;
			} else {
				usage(cli_context, "ERROR: -c option not valid during shell mode.\n");
			}
			break;
		case 'D':
			cmd_chosen++;
			cli_context->action = CLI_DUMP_BS;
@@ -1106,6 +1099,13 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
				cli_context->action = CLI_INIT_BS;
			}
			break;
		case 'j':
			if (cli_context->app_started == false) {
				cli_context->config_file = optarg;
			} else {
				usage(cli_context, "ERROR: -j option not valid during shell mode.\n");
			}
			break;
		case 'r':
			if (argv[optind] != NULL) {
				cmd_chosen++;
@@ -1533,8 +1533,8 @@ main(int argc, char **argv)
	/* if the config file doesn't exist, tell them how to make one */
	if (access(cli_context->config_file, F_OK) == -1) {
		printf("Error: No config file found.\n");
		printf("To create a config file named 'blobcli.conf' for your NVMe device:\n");
		printf("   <path to spdk>/scripts/gen_nvme.sh > blobcli.conf\n");
		printf("To create a config file named 'blobcli.json' for your NVMe device:\n");
		printf("   <path to spdk>/scripts/gen_nvme.sh --json > blobcli.json\n");
		printf("and then re-run the cli tool.\n");
		exit(-1);
	}
@@ -1555,7 +1555,7 @@ main(int argc, char **argv)
	/* Set default values in opts struct along with name and conf file. */
	spdk_app_opts_init(&opts);
	opts.name = "blobcli";
	opts.config_file = cli_context->config_file;
	opts.json_config_file = cli_context->config_file;

	cli_context->app_started = true;
	rc = spdk_app_start(&opts, cli_start, cli_context);
+2 −1
Original line number Diff line number Diff line
@@ -734,8 +734,9 @@ SpdkEnv::SpdkEnv(Env *base_env, const std::string &dir, const std::string &conf,

	spdk_app_opts_init(opts);
	opts->name = "rocksdb";
	opts->config_file = mConfig.c_str();
	opts->json_config_file = mConfig.c_str();
	opts->shutdown_cb = rocksdb_shutdown;
	opts->tpoint_group_mask = "0x80";

	spdk_fs_set_cache_size(cache_size_in_mb);
	g_bdev_name = mBdev;
+22 −4
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ source $rootdir/test/common/autotest_common.sh
rpc_server=/var/tmp/spdk-blobfs.sock
rpc_py="$rootdir/scripts/rpc.py -s $rpc_server"
tmp_file=$SPDK_TEST_STORAGE/blobfs_file
conf_file=/tmp/blobfs.conf
conf_file=$testdir/config
bdevname=BlobfsBdev
mount_dir=/tmp/spdk_tmp_mount
test_cache_size=512
@@ -29,7 +29,7 @@ function cleanup() {
}

function blobfs_start_app() {
	$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -c ${conf_file} &
	$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server --json ${conf_file} &
	blobfs_pid=$!

	echo "Process blobfs pid: $blobfs_pid"
@@ -128,8 +128,26 @@ trap 'cleanup' EXIT

# Create one temp file as test bdev
dd if=/dev/zero of=${tmp_file} bs=4k count=1M
echo "[AIO]" > ${conf_file}
echo "AIO ${tmp_file} ${bdevname} 512" >> ${conf_file}

jq . <<- JSON > ${conf_file}
	{
	  "subsystems": [
	    {
	      "subsystem": "bdev",
	      "config": [
	        {
	          "method": "bdev_aio_create",
	          "params": {
	            "name": "${bdevname}",
	            "block_size": 512,
	            "filename": "${tmp_file}"
	          }
	        }
	      ]
	    }
	  ]
	}
JSON

blobfs_detect_test

+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ int main(int argc, char **argv)

	spdk_app_opts_init(&opts);
	opts.name = "spdk_fuse";
	opts.config_file = argv[1];
	opts.json_config_file = argv[1];
	opts.reactor_mask = "0x3";
	opts.shutdown_cb = spdk_fuse_shutdown;

+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ int main(int argc, char **argv)

	spdk_app_opts_init(&opts);
	opts.name = "spdk_mkfs";
	opts.config_file = argv[1];
	opts.json_config_file = argv[1];
	opts.reactor_mask = "0x3";
	opts.shutdown_cb = NULL;

Loading