xref: /spdk/test/bdev/bdevperf/common.sh (revision 784b9d48746955f210926648a0131f84f58de76f)
1#  SPDX-License-Identifier: BSD-3-Clause
2#  Copyright (C) 2020 Intel Corporation.
3#  All rights reserved.
4
5bdevperf=$rootdir/build/examples/bdevperf
6
7function create_job() {
8	local job_section=$1
9	local rw=$2
10	local filename=$3
11
12	if [[ $job_section == "global" ]]; then
13		cat <<- EOF >> "$testdir"/test.conf
14			[global]
15			filename=${filename}
16		EOF
17	fi
18	job="[${job_section}]"
19	echo $global
20	cat <<- EOF >> "$testdir"/test.conf
21		${job}
22		filename=${filename}
23		bs=1024
24		rwmixread=70
25		rw=${rw}
26		iodepth=256
27		cpumask=0xff
28	EOF
29}
30
31function get_num_jobs() {
32	echo "$1" | grep -oE "Using job config with [0-9]+ jobs" | grep -oE "[0-9]+"
33}
34
35function cleanup() {
36	rm -f $testdir/test.conf
37}
38