Commit 89917733 authored by Maciej Wawryk's avatar Maciej Wawryk Committed by Jim Harris
Browse files

test/bdevperf: test config file



Signed-off-by: default avatarMaciej Wawryk <maciejx.wawryk@intel.com>
Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6a92345e1c3fae1f7f8b77bc68e0f715e7ac9ed9
Signed-off-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3291


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 6b41a086
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
	if [ $SPDK_TEST_BLOCKDEV -eq 1 ]; then
		run_test "blockdev_general" test/bdev/blockdev.sh
		run_test "bdev_raid" test/bdev/bdev_raid.sh
		run_test "bdevperf_config" test/bdev/bdevperf/test_config.sh
		if [[ $(uname -s) == Linux ]]; then
			run_test "spdk_dd" test/dd/dd.sh
		fi
+33 −0
Original line number Diff line number Diff line
bdevperf=$rootdir/test/bdev/bdevperf/bdevperf

function create_job() {
	local job_section=$1
	local rw=$2
	local filename=$3

	if [[ $job_section == "global" ]]; then
		cat <<- EOF >> "$testdir"/test.conf
			[global]
			filename=${filename}
		EOF
	fi
	job="[${job_section}]"
	echo $global
	cat <<- EOF >> "$testdir"/test.conf
		${job}
		filename=${filename}
		bs=1024
		rwmixread=70
		rw=${rw}
		iodepth=256
		cpumask=0xff
	EOF
}

function get_num_jobs() {
	echo "$1" | grep -oE "Using job config with [0-9]+ jobs" | grep -oE "[0-9]+"
}

function cleanup() {
	rm -f $testdir/test.conf
}
+25 −0
Original line number Diff line number Diff line
{
 "subsystems": [
    {
      "subsystem": "bdev",
      "config": [
        {
          "method": "bdev_malloc_create",
          "params": {
            "name": "Malloc0",
            "num_blocks": 102400,
            "block_size": 512
          }
        },
        {
          "method": "bdev_malloc_create",
          "params": {
            "name": "Malloc1",
            "num_blocks": 102400,
            "block_size": 512
          }
        }
      ]
    }
  ]
}
+41 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $testdir/common.sh

jsonconf=$testdir/conf.json
testconf=$testdir/test.conf

trap 'cleanup; exit 1' SIGINT SIGTERM EXIT
#Test inheriting filename and rw_mode parameters from global section.
create_job "global" "read" "Malloc0"
create_job "job0"
create_job "job1"
create_job "job2"
create_job "job3"
bdevperf_output=$($bdevperf -t 2 --json $jsonconf -j $testconf 2>&1)
[[ $(get_num_jobs "$bdevperf_output") == "4" ]]

bdevperf_output=$($bdevperf -C -t 2 --json $jsonconf -j $testconf)

cleanup
#Test missing global section.
create_job "job0" "write" "Malloc0"
create_job "job1" "write" "Malloc0"
create_job "job2" "write" "Malloc0"
bdevperf_output=$($bdevperf -t 2 --json $jsonconf -j $testconf 2>&1)
[[ $(get_num_jobs "$bdevperf_output") == "3" ]]

cleanup
#Test inheriting multiple filenames and rw_mode parameters from global section.
create_job "global" "rw" "Malloc0:Malloc1"
create_job "job0"
create_job "job1"
create_job "job2"
create_job "job3"
bdevperf_output=$($bdevperf -t 2 --json $jsonconf -j $testconf 2>&1)
[[ $(get_num_jobs "$bdevperf_output") == "4" ]]
cleanup
trap - SIGINT SIGTERM EXIT