test/blobfs: Drop .ini config in favor of json
Change-Id: I2a4db21149698e06389b280c875658a6a0d69e9b Signed-off-by: WANGHAILIANG <hailiangx.e.wang@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2894 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
8be2424adf
commit
6a41e84c06
@ -52,8 +52,8 @@
|
|||||||
static void cli_start(void *arg1);
|
static void cli_start(void *arg1);
|
||||||
|
|
||||||
static const char *program_name = "blobcli";
|
static const char *program_name = "blobcli";
|
||||||
/* default name for .conf file, any name can be used however with -c switch */
|
/* default name for .json file, any name can be used however with -j switch */
|
||||||
static const char *program_conf = "blobcli.conf";
|
static const char *program_conf = "blobcli.json";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CMD mode runs one command at a time which can be annoying as the init takes
|
* 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) {
|
if (!cli_context || cli_context->cli_mode == CLI_MODE_CMD) {
|
||||||
printf("Version %s\n", SPDK_VERSION_STRING);
|
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",
|
printf("\n%s is a command line tool for interacting with blobstore\n",
|
||||||
program_name);
|
program_name);
|
||||||
printf("on the underlying device specified in the conf file passed\n");
|
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;
|
int cmd_chosen = 0;
|
||||||
char resp;
|
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) {
|
switch (op) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (strcmp(cli_context->bdev_name, "") == 0) {
|
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");
|
usage(cli_context, "ERROR: -b option can only be set once.\n");
|
||||||
}
|
}
|
||||||
break;
|
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':
|
case 'D':
|
||||||
cmd_chosen++;
|
cmd_chosen++;
|
||||||
cli_context->action = CLI_DUMP_BS;
|
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;
|
cli_context->action = CLI_INIT_BS;
|
||||||
}
|
}
|
||||||
break;
|
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':
|
case 'r':
|
||||||
if (argv[optind] != NULL) {
|
if (argv[optind] != NULL) {
|
||||||
cmd_chosen++;
|
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 the config file doesn't exist, tell them how to make one */
|
||||||
if (access(cli_context->config_file, F_OK) == -1) {
|
if (access(cli_context->config_file, F_OK) == -1) {
|
||||||
printf("Error: No config file found.\n");
|
printf("Error: No config file found.\n");
|
||||||
printf("To create a config file named 'blobcli.conf' for your NVMe device:\n");
|
printf("To create a config file named 'blobcli.json' for your NVMe device:\n");
|
||||||
printf(" <path to spdk>/scripts/gen_nvme.sh > blobcli.conf\n");
|
printf(" <path to spdk>/scripts/gen_nvme.sh --json > blobcli.json\n");
|
||||||
printf("and then re-run the cli tool.\n");
|
printf("and then re-run the cli tool.\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@ -1555,7 +1555,7 @@ main(int argc, char **argv)
|
|||||||
/* Set default values in opts struct along with name and conf file. */
|
/* Set default values in opts struct along with name and conf file. */
|
||||||
spdk_app_opts_init(&opts);
|
spdk_app_opts_init(&opts);
|
||||||
opts.name = "blobcli";
|
opts.name = "blobcli";
|
||||||
opts.config_file = cli_context->config_file;
|
opts.json_config_file = cli_context->config_file;
|
||||||
|
|
||||||
cli_context->app_started = true;
|
cli_context->app_started = true;
|
||||||
rc = spdk_app_start(&opts, cli_start, cli_context);
|
rc = spdk_app_start(&opts, cli_start, cli_context);
|
||||||
|
@ -734,8 +734,9 @@ SpdkEnv::SpdkEnv(Env *base_env, const std::string &dir, const std::string &conf,
|
|||||||
|
|
||||||
spdk_app_opts_init(opts);
|
spdk_app_opts_init(opts);
|
||||||
opts->name = "rocksdb";
|
opts->name = "rocksdb";
|
||||||
opts->config_file = mConfig.c_str();
|
opts->json_config_file = mConfig.c_str();
|
||||||
opts->shutdown_cb = rocksdb_shutdown;
|
opts->shutdown_cb = rocksdb_shutdown;
|
||||||
|
opts->tpoint_group_mask = "0x80";
|
||||||
|
|
||||||
spdk_fs_set_cache_size(cache_size_in_mb);
|
spdk_fs_set_cache_size(cache_size_in_mb);
|
||||||
g_bdev_name = mBdev;
|
g_bdev_name = mBdev;
|
||||||
|
@ -13,7 +13,7 @@ source $rootdir/test/common/autotest_common.sh
|
|||||||
rpc_server=/var/tmp/spdk-blobfs.sock
|
rpc_server=/var/tmp/spdk-blobfs.sock
|
||||||
rpc_py="$rootdir/scripts/rpc.py -s $rpc_server"
|
rpc_py="$rootdir/scripts/rpc.py -s $rpc_server"
|
||||||
tmp_file=$SPDK_TEST_STORAGE/blobfs_file
|
tmp_file=$SPDK_TEST_STORAGE/blobfs_file
|
||||||
conf_file=/tmp/blobfs.conf
|
conf_file=$testdir/config
|
||||||
bdevname=BlobfsBdev
|
bdevname=BlobfsBdev
|
||||||
mount_dir=/tmp/spdk_tmp_mount
|
mount_dir=/tmp/spdk_tmp_mount
|
||||||
test_cache_size=512
|
test_cache_size=512
|
||||||
@ -29,7 +29,7 @@ function cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function blobfs_start_app() {
|
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=$!
|
blobfs_pid=$!
|
||||||
|
|
||||||
echo "Process blobfs pid: $blobfs_pid"
|
echo "Process blobfs pid: $blobfs_pid"
|
||||||
@ -128,8 +128,26 @@ trap 'cleanup' EXIT
|
|||||||
|
|
||||||
# Create one temp file as test bdev
|
# Create one temp file as test bdev
|
||||||
dd if=/dev/zero of=${tmp_file} bs=4k count=1M
|
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
|
blobfs_detect_test
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
spdk_app_opts_init(&opts);
|
spdk_app_opts_init(&opts);
|
||||||
opts.name = "spdk_fuse";
|
opts.name = "spdk_fuse";
|
||||||
opts.config_file = argv[1];
|
opts.json_config_file = argv[1];
|
||||||
opts.reactor_mask = "0x3";
|
opts.reactor_mask = "0x3";
|
||||||
opts.shutdown_cb = spdk_fuse_shutdown;
|
opts.shutdown_cb = spdk_fuse_shutdown;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
spdk_app_opts_init(&opts);
|
spdk_app_opts_init(&opts);
|
||||||
opts.name = "spdk_mkfs";
|
opts.name = "spdk_mkfs";
|
||||||
opts.config_file = argv[1];
|
opts.json_config_file = argv[1];
|
||||||
opts.reactor_mask = "0x3";
|
opts.reactor_mask = "0x3";
|
||||||
opts.shutdown_cb = NULL;
|
opts.shutdown_cb = NULL;
|
||||||
|
|
||||||
|
@ -43,13 +43,14 @@ run_step() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_bsdump() {
|
run_bsdump() {
|
||||||
$SPDK_EXAMPLE_DIR/blobcli -c $ROCKSDB_CONF -b Nvme0n1 -D &> bsdump.txt
|
# 0x80 is the bit mask for BlobFS tracepoints
|
||||||
|
$SPDK_EXAMPLE_DIR/blobcli -j $ROCKSDB_CONF -b Nvme0n1 --tpoint-group-mask 0x80 &> bsdump.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
# In the autotest job, we copy the rocksdb source to just outside the spdk directory.
|
# In the autotest job, we copy the rocksdb source to just outside the spdk directory.
|
||||||
DB_BENCH_DIR="$rootdir/../rocksdb"
|
DB_BENCH_DIR="$rootdir/../rocksdb"
|
||||||
DB_BENCH=$DB_BENCH_DIR/db_bench
|
DB_BENCH=$DB_BENCH_DIR/db_bench
|
||||||
ROCKSDB_CONF=$testdir/rocksdb.conf
|
ROCKSDB_CONF=$testdir/rocksdb.json
|
||||||
|
|
||||||
if [ ! -e $DB_BENCH_DIR ]; then
|
if [ ! -e $DB_BENCH_DIR ]; then
|
||||||
echo $DB_BENCH_DIR does not exist
|
echo $DB_BENCH_DIR does not exist
|
||||||
@ -74,15 +75,15 @@ popd
|
|||||||
|
|
||||||
timing_exit db_bench_build
|
timing_exit db_bench_build
|
||||||
|
|
||||||
$rootdir/scripts/gen_nvme.sh > $ROCKSDB_CONF
|
echo '{"subsystems": [' > $ROCKSDB_CONF
|
||||||
# 0x80 is the bit mask for BlobFS tracepoints
|
$rootdir/scripts/gen_nvme.sh --json >> $ROCKSDB_CONF
|
||||||
echo "[Global]" >> $ROCKSDB_CONF
|
echo ']}' >> $ROCKSDB_CONF
|
||||||
echo "TpointGroupMask 0x80" >> $ROCKSDB_CONF
|
|
||||||
|
|
||||||
trap 'dump_db_bench_on_err; run_bsdump || :; rm -f $ROCKSDB_CONF; sanitize_results; exit 1' SIGINT SIGTERM EXIT
|
trap 'dump_db_bench_on_err; run_bsdump || :; rm -f $ROCKSDB_CONF; sanitize_results; exit 1' SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
if [ -z "$SKIP_MKFS" ]; then
|
if [ -z "$SKIP_MKFS" ]; then
|
||||||
run_test "blobfs_mkfs" $rootdir/test/blobfs/mkfs/mkfs $ROCKSDB_CONF Nvme0n1
|
# 0x80 is the bit mask for BlobFS tracepoints
|
||||||
|
run_test "blobfs_mkfs" $rootdir/test/blobfs/mkfs/mkfs $ROCKSDB_CONF Nvme0n1 --tpoint-group-mask 0x80
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $output_dir/rocksdb
|
mkdir -p $output_dir/rocksdb
|
||||||
|
@ -11,13 +11,15 @@ rootdir=$(readlink -f $testdir/../..)
|
|||||||
source $rootdir/test/common/autotest_common.sh
|
source $rootdir/test/common/autotest_common.sh
|
||||||
|
|
||||||
# Nvme0 target configuration
|
# Nvme0 target configuration
|
||||||
$rootdir/scripts/gen_nvme.sh > $testdir/blobcli.conf
|
echo '{"subsystems": [' > $testdir/blobcli.json
|
||||||
|
$rootdir/scripts/gen_nvme.sh --json | jq -r "del(.config[] | select(.params.name!=\"Nvme0\"))" >> $testdir/blobcli.json
|
||||||
|
echo ']}' >> $testdir/blobcli.json
|
||||||
|
|
||||||
# generate random data file for import/export diff
|
# generate random data file for import/export diff
|
||||||
dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
|
dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
|
||||||
|
|
||||||
(cd $testdir \
|
(cd $testdir \
|
||||||
&& $SPDK_EXAMPLE_DIR/blobcli -c $testdir/blobcli.conf -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out)
|
&& $SPDK_EXAMPLE_DIR/blobcli -j $testdir/blobcli.json -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out)
|
||||||
|
|
||||||
# the test script will import the test pattern generated by dd and then export
|
# the test script will import the test pattern generated by dd and then export
|
||||||
# it to a file so we can compare and confirm basic read and write
|
# it to a file so we can compare and confirm basic read and write
|
||||||
@ -25,6 +27,6 @@ $rootdir/test/app/match/match -v $testdir/btest.out.match
|
|||||||
diff $testdir/test.pattern $testdir/test.pattern.blob
|
diff $testdir/test.pattern $testdir/test.pattern.blob
|
||||||
|
|
||||||
rm -rf $testdir/btest.out
|
rm -rf $testdir/btest.out
|
||||||
rm -rf $testdir/blobcli.conf
|
rm -rf $testdir/blobcli.json
|
||||||
rm -rf $testdir/*.blob
|
rm -rf $testdir/*.blob
|
||||||
rm -rf $testdir/test.pattern
|
rm -rf $testdir/test.pattern
|
||||||
|
Loading…
Reference in New Issue
Block a user