Commit 89abcd03 authored by Karol Latecki's avatar Karol Latecki Committed by Tomasz Zawadzki
Browse files

test/accel: verify module used for workloads



Verify that correct modules were used for workloads
run by accel_perf example app.

Accel_perf starts test immediately and there is not
enough time to call accel_get_opc_assignments or
accel_get_module_info before running the workload.
"--wait-for-rpc" cannot be used too, as these "get"
rpcs are only available after initializing the
framework.
Because of that accel modules used by accel_perf
are verified post-test, based on application text
output.

Signed-off-by: default avatarKarol Latecki <karol.latecki@intel.com>
Change-Id: I22630e0521bd0274dabe11f45c7abd686b3a0856
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20482


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent fba209c7
Loading
Loading
Loading
Loading
+61 −24
Original line number Diff line number Diff line
@@ -12,6 +12,22 @@ accel_perf() {
	"$SPDK_EXAMPLE_DIR/accel_perf" -c <(build_accel_config) "$@"
}

accel_test() {
	local accel_opc
	local accel_module
	out=$(accel_perf "$@")

	while IFS=":" read -r var val; do
		val=${val##+( )}
		case "$var" in
			"Module") accel_module=$val ;;
			"Workload Type") accel_opc=$val ;;
		esac
	done < <(accel_perf "$@")

	[[ -n $accel_module && -n $accel_opc && "$accel_module" == "${expected_opcs[$accel_opc]}" ]]
}

build_accel_config() {
	accel_json_cfg=()
	[[ $SPDK_TEST_ACCEL_DSA -gt 0 ]] && accel_json_cfg+=('{"method": "dsa_scan_accel_module"}')
@@ -37,6 +53,26 @@ build_accel_config() {
	JSON
}

function get_expected_opcs() {
	trap 'killprocess $spdk_tgt_pid; exit 1' ERR
	$SPDK_BIN_DIR/spdk_tgt -c <(build_accel_config) &
	spdk_tgt_pid=$!
	waitforlisten $spdk_tgt_pid

	exp_opcs=($($rpc_py accel_get_opc_assignments | jq -r ". | to_entries | map(\"\(.key)=\(.value)\") | .[]"))
	for opc_opt in "${exp_opcs[@]}"; do
		IFS="=" read -r opc module <<< $opc_opt
		expected_opcs["$opc"]=$module
	done
	killprocess $spdk_tgt_pid
	trap - ERR
}

# Run spdk_bin once and initialize accel modules based on SPDK_TEST_ACCEL_* flags.
# Create a list of opcodes and assigned modules to be used later for post-accel_perf test runs.
declare -A expected_opcs
get_expected_opcs

# Run some additional simple tests; mostly focused
# around accel_perf example app itself, not necessarily
# testing actual accel modules.
@@ -54,34 +90,35 @@ run_test "accel_negative_buffers" NOT accel_perf -t 1 -w xor -y -x -1

#Run through all SW ops with defaults for a quick sanity check
#To save time, only use verification case
run_test "accel_crc32c" accel_perf -t 1 -w crc32c -y
run_test "accel_crc32c_C2" accel_perf -t 1 -w crc32c -y -C 2
run_test "accel_copy" accel_perf -t 1 -w copy -y
run_test "accel_fill" accel_perf -t 1 -w fill -y
run_test "accel_copy_crc32c" accel_perf -t 1 -w copy_crc32c -y
run_test "accel_copy_crc32c_C2" accel_perf -t 1 -w copy_crc32c -y -C 2
run_test "accel_dualcast" accel_perf -t 1 -w dualcast -y
run_test "accel_compare" accel_perf -t 1 -w compare -y
run_test "accel_xor" accel_perf -t 1 -w xor -y
run_test "accel_xor" accel_perf -t 1 -w xor -y -x 3
run_test "accel_crc32c" accel_test -t 1 -w crc32c -y
run_test "accel_crc32c_C2" accel_test -t 1 -w crc32c -y -C 2
run_test "accel_copy" accel_test -t 1 -w copy -y
run_test "accel_fill" accel_test -t 1 -w fill -y
run_test "accel_copy_crc32c" accel_test -t 1 -w copy_crc32c -y
run_test "accel_copy_crc32c_C2" accel_test -t 1 -w copy_crc32c -y -C 2
run_test "accel_dualcast" accel_test -t 1 -w dualcast -y
run_test "accel_compare" accel_test -t 1 -w compare -y
run_test "accel_xor" accel_test -t 1 -w xor -y
run_test "accel_xor" accel_test -t 1 -w xor -y -x 3
# do not run compress/decompress unless ISAL is installed
if [[ $CONFIG_ISAL == y ]]; then
	run_test "accel_comp" accel_perf -t 1 -w compress -l $testdir/bib
	run_test "accel_decomp" accel_perf -t 1 -w decompress -l $testdir/bib -y
	run_test "accel_decmop_full" accel_perf -t 1 -w decompress -l $testdir/bib -y -o 0
	run_test "accel_decomp_mcore" accel_perf -t 1 -w decompress -l $testdir/bib -y -m 0xf
	run_test "accel_decomp_full_mcore" accel_perf -t 1 -w decompress -l $testdir/bib -y -o 0 -m 0xf
	run_test "accel_decomp_mthread" accel_perf -t 1 -w decompress -l $testdir/bib -y -T 2
	run_test "accel_deomp_full_mthread" accel_perf -t 1 -w decompress -l $testdir/bib -y -o 0 -T 2
	run_test "accel_comp" accel_test -t 1 -w compress -l $testdir/bib
	run_test "accel_decomp" accel_test -t 1 -w decompress -l $testdir/bib -y
	run_test "accel_decmop_full" accel_test -t 1 -w decompress -l $testdir/bib -y -o 0
	run_test "accel_decomp_mcore" accel_test -t 1 -w decompress -l $testdir/bib -y -m 0xf
	run_test "accel_decomp_full_mcore" accel_test -t 1 -w decompress -l $testdir/bib -y -o 0 -m 0xf
	run_test "accel_decomp_mthread" accel_test -t 1 -w decompress -l $testdir/bib -y -T 2
	run_test "accel_deomp_full_mthread" accel_test -t 1 -w decompress -l $testdir/bib -y -o 0 -T 2
fi
if [[ $CONFIG_DPDK_COMPRESSDEV == y ]]; then
	COMPRESSDEV=1
	run_test "accel_cdev_comp" accel_perf -t 1 -w compress -l $testdir/bib
	run_test "accel_cdev_decomp" accel_perf -t 1 -w decompress -l $testdir/bib -y
	run_test "accel_cdev_decmop_full" accel_perf -t 1 -w decompress -l $testdir/bib -y -o 0
	run_test "accel_cdev_decomp_mcore" accel_perf -t 1 -w decompress -l $testdir/bib -y -m 0xf
	run_test "accel_cdev_decomp_full_mcore" accel_perf -t 1 -w decompress -l $testdir/bib -y -o 0 -m 0xf
	run_test "accel_cdev_decomp_mthread" accel_perf -t 1 -w decompress -l $testdir/bib -y -T 2
	run_test "accel_cdev_deomp_full_mthread" accel_perf -t 1 -w decompress -l $testdir/bib -y -o 0 -T 2
	get_expected_opcs
	run_test "accel_cdev_comp" accel_test -t 1 -w compress -l $testdir/bib
	run_test "accel_cdev_decomp" accel_test -t 1 -w decompress -l $testdir/bib -y
	run_test "accel_cdev_decmop_full" accel_test -t 1 -w decompress -l $testdir/bib -y -o 0
	run_test "accel_cdev_decomp_mcore" accel_test -t 1 -w decompress -l $testdir/bib -y -m 0xf
	run_test "accel_cdev_decomp_full_mcore" accel_test -t 1 -w decompress -l $testdir/bib -y -o 0 -m 0xf
	run_test "accel_cdev_decomp_mthread" accel_test -t 1 -w decompress -l $testdir/bib -y -T 2
	run_test "accel_cdev_deomp_full_mthread" accel_test -t 1 -w decompress -l $testdir/bib -y -o 0 -T 2
	unset COMPRESSDEV
fi