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

Change-Id: I08e8c124258bc95603bd6e954944eb66bde4f31b
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1378
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Michal Berger 2020-03-18 18:39:21 +01:00 committed by Tomasz Zawadzki
parent 22a1acce97
commit 1f7d7a78e8
5 changed files with 56 additions and 35 deletions

View File

@ -295,3 +295,40 @@ function get_nvme_devs()
(( ${#nvmes[@]} )) || return 1
echo "${#nvmes[@]}" >&2
}
function gen_nvmf_target_json()
{
local subsystem config=()
for subsystem in "${@:-1}"; do
config+=(
"$(
cat <<-EOF
{
"params": {
"name": "Nvme$subsystem",
"trtype": "$TEST_TRANSPORT",
"traddr": "$NVMF_FIRST_TARGET_IP",
"adrfam": "ipv4",
"trsvcid": "$NVMF_PORT",
"subnqn": "nqn.2016-06.io.spdk:cnode$subsystem"
},
"method": "bdev_nvme_attach_controller"
}
EOF
)"
)
done
jq . <<-JSON
{
"subsystems": [
{
"subsystem": "bdev",
"config": [
$(IFS=","; printf '%s\n' "${config[*]}")
]
}
]
}
JSON
}

View File

@ -32,11 +32,9 @@ fi
tgt_init
echo "[Nvme]" > $testdir/bdevperf.conf
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme0" >> $testdir/bdevperf.conf
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 128 -o 4096 -w verify -t 1
"$rootdir/test/bdev/bdevperf/bdevperf" --json <(gen_nvmf_target_json) -q 128 -o 4096 -w verify -t 1
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 128 -o 4096 -w verify -t 15 -f &
"$rootdir/test/bdev/bdevperf/bdevperf" --json <(gen_nvmf_target_json) -q 128 -o 4096 -w verify -t 15 -f &
bdevperfpid=$!
sleep 3
@ -47,7 +45,6 @@ tgt_init
wait $bdevperfpid
sync
rm -rf $testdir/bdevperf.conf
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT

View File

@ -23,15 +23,13 @@ $rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK0000000000000
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
echo "[Nvme]" > $testdir/bdevperf.conf
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme0" >> $testdir/bdevperf.conf
$rootdir/test/bdev/bdevperf/bdevperf -m 0x10 -i 1 -c $testdir/bdevperf.conf -q 128 -o 4096 -w write -t 1 &
"$rootdir/test/bdev/bdevperf/bdevperf" -m 0x10 -i 1 --json <(gen_nvmf_target_json) -q 128 -o 4096 -w write -t 1 &
WRITE_PID=$!
$rootdir/test/bdev/bdevperf/bdevperf -m 0x20 -i 2 -c $testdir/bdevperf.conf -q 128 -o 4096 -w read -t 1 &
"$rootdir/test/bdev/bdevperf/bdevperf" -m 0x20 -i 2 --json <(gen_nvmf_target_json) -q 128 -o 4096 -w read -t 1 &
READ_PID=$!
$rootdir/test/bdev/bdevperf/bdevperf -m 0x40 -i 3 -c $testdir/bdevperf.conf -q 128 -o 4096 -w flush -t 1 &
"$rootdir/test/bdev/bdevperf/bdevperf" -m 0x40 -i 3 --json <(gen_nvmf_target_json) -q 128 -o 4096 -w flush -t 1 &
FLUSH_PID=$!
$rootdir/test/bdev/bdevperf/bdevperf -m 0x80 -i 4 -c $testdir/bdevperf.conf -q 128 -o 4096 -w unmap -t 1 &
"$rootdir/test/bdev/bdevperf/bdevperf" -m 0x80 -i 4 --json <(gen_nvmf_target_json) -q 128 -o 4096 -w unmap -t 1 &
UNMAP_PID=$!
sync
@ -40,7 +38,6 @@ wait $READ_PID
wait $FLUSH_PID
wait $UNMAP_PID
rm -rf $testdir/bdevperf.conf
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT

View File

@ -20,12 +20,8 @@ $rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK0000000000000
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
echo "[Nvme]" > $testdir/bdevperf.conf
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme0" >> $testdir/bdevperf.conf
$rootdir/test/bdev/bdevio/bdevio --json <(gen_nvmf_target_json)
$rootdir/test/bdev/bdevio/bdevio -c $testdir/bdevperf.conf
rm -rf $testdir/bdevperf.conf
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT

View File

@ -16,30 +16,24 @@ function starttarget() {
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
num_subsystems=10
num_subsystems=({1..10})
# SoftRoce does not have enough queues available for
# this test. Detect if we're using software RDMA.
# If so, only use two subsystem.
if check_ip_is_soft_roce "$NVMF_FIRST_TARGET_IP"; then
num_subsystems=2
num_subsystems=({1..2})
fi
touch $testdir/bdevperf.conf
echo "[Nvme]" > $testdir/bdevperf.conf
timing_enter create_subsystems
# Create subsystems
rm -rf $testdir/rpcs.txt
for i in $(seq 1 $num_subsystems)
do
for i in "${num_subsystems[@]}"; do
cat <<- EOL >> $testdir/rpcs.txt
bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i
nvmf_create_subsystem nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i
nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i Malloc$i
nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
EOL
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode$i traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT hostaddr:$NVMF_FIRST_TARGET_IP\" Nvme$i" >> $testdir/bdevperf.conf
bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i
nvmf_create_subsystem nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i
nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i Malloc$i
nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
EOL
done
$rpc_py < $testdir/rpcs.txt
timing_exit create_subsystems
@ -83,7 +77,7 @@ function nvmf_shutdown_tc1 {
starttarget
# Run bdev_svc, which connects but does not issue I/O
$rootdir/test/app/bdev_svc/bdev_svc -m 0x1 -i 1 -r /var/tmp/bdevperf.sock -c $testdir/bdevperf.conf &
$rootdir/test/app/bdev_svc/bdev_svc -m 0x1 -i 1 -r /var/tmp/bdevperf.sock --json <(gen_nvmf_target_json "${num_subsystems[@]}") &
perfpid=$!
waitforlisten $perfpid /var/tmp/bdevperf.sock
$rpc_py -s /var/tmp/bdevperf.sock framework_wait_init
@ -97,7 +91,7 @@ function nvmf_shutdown_tc1 {
kill -0 $nvmfpid
# Connect with bdevperf and confirm it works
$rootdir/test/bdev/bdevperf/bdevperf -r /var/tmp/bdevperf.sock -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 1
$rootdir/test/bdev/bdevperf/bdevperf -r /var/tmp/bdevperf.sock --json <(gen_nvmf_target_json "${num_subsystems[@]}") -q 64 -o 65536 -w verify -t 1
stoptarget
}
@ -107,7 +101,7 @@ function nvmf_shutdown_tc2 {
starttarget
# Run bdevperf
$rootdir/test/bdev/bdevperf/bdevperf -r /var/tmp/bdevperf.sock -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 10 &
$rootdir/test/bdev/bdevperf/bdevperf -r /var/tmp/bdevperf.sock --json <(gen_nvmf_target_json "${num_subsystems[@]}") -q 64 -o 65536 -w verify -t 10 &
perfpid=$!
waitforlisten $perfpid /var/tmp/bdevperf.sock
$rpc_py -s /var/tmp/bdevperf.sock framework_wait_init
@ -129,7 +123,7 @@ function nvmf_shutdown_tc3 {
starttarget
# Run bdevperf
$rootdir/test/bdev/bdevperf/bdevperf -r /var/tmp/bdevperf.sock -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 10 &
$rootdir/test/bdev/bdevperf/bdevperf -r /var/tmp/bdevperf.sock --json <(gen_nvmf_target_json "${num_subsystems[@]}") -q 64 -o 65536 -w verify -t 10 &
perfpid=$!
waitforlisten $perfpid /var/tmp/bdevperf.sock
$rpc_py -s /var/tmp/bdevperf.sock framework_wait_init