autotest: Use rpc_cmd() for rpc plugin-based tests

Also, create a common dir which will hold symlinks to all existing
plugins used in the tests. Location of the actual lib is not changed
so the relation to the given test suite is clearly preserved.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icb70bbc61fbfa3325a357d5dd93f554ff132a3b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7146
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Michal Berger 2021-03-30 12:14:26 +02:00 committed by Tomasz Zawadzki
parent 5ddb210e61
commit 7347f60bbc
6 changed files with 10 additions and 9 deletions

View File

@ -244,7 +244,9 @@ done
# start rpc.py coprocess if it's not started yet
if [[ -z $RPC_PIPE_PID ]] || ! kill -0 "$RPC_PIPE_PID" &> /dev/null; then
coproc RPC_PIPE { "$rootdir/scripts/rpc.py" --server; }
# Include list to all known plugins we use in the tests
PYTHONPATH+=":$rootdir/test/rpc_plugins"
coproc RPC_PIPE { PYTHONPATH="$PYTHONPATH" "$rootdir/scripts/rpc.py" --server; }
exec {RPC_PIPE_OUTPUT}<&${RPC_PIPE[0]} {RPC_PIPE_INPUT}>&${RPC_PIPE[1]}
# all descriptors will automatically close together with this bash
# process, this will make rpc.py stop reading and exit gracefully

View File

@ -22,8 +22,7 @@ function scheduler_create_thread() {
$rpc --plugin scheduler_plugin scheduler_thread_delete $thread_id
}
export PYTHONPATH=$testdir
rpc="$rootdir/scripts/rpc.py"
rpc=rpc_cmd
$testdir/scheduler -m 0xF -p 0x2 --wait-for-rpc &
scheduler_pid=$!

View File

@ -45,7 +45,7 @@ waitforlisten $spdk_pid
export PYTHONPATH=$testdir
# basic integrity test
rpc="$rootdir/scripts/rpc.py"
rpc=rpc_cmd
run_test "rpc_integrity" rpc_integrity
run_test "rpc_plugins" rpc_plugins
# same integrity test, but with rpc_cmd() instead

View File

@ -0,0 +1 @@
../rpc/rpc_plugin.py

View File

@ -0,0 +1 @@
../event/scheduler/scheduler_plugin.py

View File

@ -4,8 +4,6 @@ declare -r sysfs_system=/sys/devices/system
declare -r sysfs_cpu=$sysfs_system/cpu
declare -r sysfs_node=$sysfs_system/node
export PYTHONPATH=$rootdir/test/event/scheduler
declare -r scheduler=$rootdir/test/event/scheduler/scheduler
declare -r plugin=scheduler_plugin
@ -385,13 +383,13 @@ get_cpu_stat() {
}
create_thread() {
"$rootdir/scripts/rpc.py" --plugin "$plugin" scheduler_thread_create "$@"
rpc_cmd --plugin "$plugin" scheduler_thread_create "$@"
}
destroy_thread() {
"$rootdir/scripts/rpc.py" --plugin "$plugin" scheduler_thread_delete "$@"
rpc_cmd --plugin "$plugin" scheduler_thread_delete "$@"
}
active_thread() {
"$rootdir/scripts/rpc.py" --plugin "$plugin" scheduler_thread_set_active "$@"
rpc_cmd --plugin "$plugin" scheduler_thread_set_active "$@"
}