Skip to content

Commit

Permalink
ci: add some basic vhost_user+virtio_user test
Browse files Browse the repository at this point in the history
This script is based on Thomas test-null.sh script.

Quickly check that initialisation (with multiqueue) and basic forwarding
are not broken between two testpmd: one testpmd polling from a vhost-user
client port and the other testpmd polling one virtio_user port.

Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Jun 24, 2024
1 parent 8ab3de4 commit 114ee60
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .ci/linux-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ if [ -z "$cross_file" ]; then
[ "$failed" != "true" ]
fi

if [ -z "$cross_file" ] && [ "$MINI" != "true" ]; then
failed=
configure_coredump
devtools/test-vhost.sh || failed="true"
catch_coredump
[ "$failed" != "true" ]
fi

if [ "$ABI_CHECKS" = "true" ]; then
if [ "$(cat libabigail/VERSION 2>/dev/null)" != "$LIBABIGAIL_VERSION" ]; then
rm -rf libabigail
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ M: Maxime Coquelin <[email protected]>
M: Chenbo Xia <[email protected]>
T: git://dpdk.org/next/dpdk-next-virtio
F: lib/vhost/
F: devtools/test-vhost.sh
F: doc/guides/prog_guide/vhost_lib.rst
F: examples/vhost/
F: doc/guides/sample_app_ug/vhost.rst
Expand Down
73 changes: 73 additions & 0 deletions devtools/test-vhost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#! /bin/sh -e
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015 6WIND S.A.
# Copyright 2019 Mellanox Technologies, Ltd
# Copyright (c) 2024 Red Hat, Inc.

# Run a quick forwarding test without hugepage, with one testpmd using
# virtio-user and another using vhost-user.

build=${1:-build} # first argument can be the build directory
testpmd=$1 # or first argument can be the testpmd path
corelist_server=${2:-0,1,2} # default using cores 0, 1, 2
corelist_client=${3:-0,1,3} # default using cores 0, 1, 3
eal_options=$4
testpmd_options=$5

sock=$(mktemp -t dpdk.virtio-user.XXXXXX.sock)
pid_client=
pid_server=
cleanup() {
rm -f $sock
[ "$pid_client $pid_server" != " " ] || return
if kill -0 $pid_client $pid_server >/dev/null 2>/dev/null; then
sleep 2
fi
if kill -0 $pid_client >/dev/null 2>/dev/null ; then
echo ============================
echo Force killing client testpmd
kill -9 $pid_client
fi
if kill -0 $pid_server >/dev/null 2>/dev/null ; then
echo ============================
echo Force killing server testpmd
kill -9 $pid_server
fi
}

trap cleanup EXIT

[ -f "$testpmd" ] && build=$(dirname $(dirname $testpmd))
[ -f "$testpmd" ] || testpmd=$build/app/dpdk-testpmd
[ -f "$testpmd" ] || testpmd=$build/app/testpmd
if [ ! -f "$testpmd" ] ; then
echo 'ERROR: testpmd cannot be found' >&2
exit 1
fi

if ldd $testpmd | grep -q librte_ ; then
export LD_LIBRARY_PATH=$build/lib:$LD_LIBRARY_PATH
libs="-d $build/drivers"
else
libs=
fi

rm -f $sock
( $testpmd -l $corelist_server --file-prefix=virtio-user --no-huge -m 1024 \
--single-file-segments --no-pci $libs \
--vdev net_virtio_user0,path=$sock,queues=2,server=1 $eal_options -- \
--no-mlockall --stats-period 1 --rxq 2 --txq 2 --nb-cores=2 --tx-first -a $testpmd_options \
>/dev/null 2>/dev/null) &
pid_server=$!

( $testpmd -l $corelist_client --file-prefix=vhost --no-huge -m 1024 \
--single-file-segments --no-pci $libs \
--vdev net_vhost0,iface=$sock,queues=8,client=1 $eal_options -- \
--no-mlockall --stats-period 1 --rxq 8 --txq 8 --nb-cores=2 --tx-first -a $testpmd_options \
) &
pid_client=$!

sleep 2
kill $pid_client
sleep 1
kill $pid_server

0 comments on commit 114ee60

Please sign in to comment.