Commit 90fbb94c authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

test/nvme: Don't inject python code into the test



This only introduces unnecessary performance penalty and makes the
code a bit less readable. Instead, use dedicated tools for the
task and execute them directly.

Change-Id: I2d7037f7655f7589f91b72b853682a398eb41f96
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17420


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 0ed1f4f8
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -7,6 +7,14 @@ testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh

function base64_decode_bits() {
	local bin_array status

	bin_array=($(base64 -d <(printf '%s' "$1") | hexdump -ve '/1 "0x%02x\n"'))
	status=$((bin_array[-1] << 8 | bin_array[-2]))
	printf '0x%x' $(((status >> $2) & $3))
}

ctrlr_name="nvme0"
# Error injection timeout - 15 sec (in usec)
err_injection_timeout=15000000
@@ -24,16 +32,6 @@ if [ -z "${bdf}" ]; then
	exit 1
fi

function base64_decode_bits() {
	python3 <<- EOF
		import base64
		bin_array = bytearray(base64.b64decode("$1"))
		array_length = len(bin_array)
		status = (bin_array[array_length-1] << 8) | bin_array[array_length-2]
		print("0x%x" % ((status >> $2) & $3))
	EOF
}

"$SPDK_BIN_DIR/spdk_tgt" -m 0xF &
spdk_target_pid=$!
trap 'killprocess "$spdk_target_pid"; exit 1' SIGINT SIGTERM EXIT