aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/test
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@linaro.org>2016-06-09 15:46:17 +0100
committerZoltan Kiss <zoltan.kiss@linaro.org>2016-06-09 16:10:49 +0100
commit1d4e4be670e09f38c2f934232d221a8dd04e2fe6 (patch)
tree316d372cb22b685818c2104c68e7131f94c3b954 /platform/linux-dpdk/test
parente7aa846454f92b8b720f31a23e2a3e000c432d59 (diff)
linux-dpdk: test: sync up pktio_run to linux-generic
Among other smaller ones, port this patch: f7b9dd8f validation: pktio: adding command line argument parsing Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
Diffstat (limited to 'platform/linux-dpdk/test')
-rwxr-xr-xplatform/linux-dpdk/test/pktio/pktio_run47
1 files changed, 38 insertions, 9 deletions
diff --git a/platform/linux-dpdk/test/pktio/pktio_run b/platform/linux-dpdk/test/pktio/pktio_run
index 3dbf1b92a..58fcde128 100755
--- a/platform/linux-dpdk/test/pktio/pktio_run
+++ b/platform/linux-dpdk/test/pktio/pktio_run
@@ -6,6 +6,15 @@
# SPDX-License-Identifier: BSD-3-Clause
#
+# Proceed the pktio tests. This script expects at least one argument:
+# setup) setup the pktio test environment
+# cleanup) cleanup the pktio test environment
+# run) run the pktio tests (setup, run, cleanup)
+# extra arguments are passed unchanged to the test itself (pktio_main)
+# Without arguments, "run" is assumed and no extra argument is passed to the
+# test (legacy mode).
+#
+
# directories where pktio_main binary can be found:
# -in the validation dir when running make check (intree or out of tree)
# -in the script directory, when running after 'make install', or
@@ -15,7 +24,6 @@
PATH=${TEST_DIR}/pktio:$PATH
PATH=$(dirname $0):$PATH
PATH=$(dirname $0)/../../../../test/validation/pktio:$PATH
-PATH=${PWD}/../../../test/validation/pktio:$PATH
PATH=.:$PATH
pktio_main_path=$(which pktio_main${EXEEXT})
@@ -47,36 +55,57 @@ run_test()
{
local ret=0
- pktio_main${EXEEXT}
- ret=$?
+ pktio_main${EXEEXT} $*
+ if [ $? -ne 0 ]; then
+ ret=1
+ fi
if [ $ret -ne 0 ]; then
echo "!!! FAILED !!!"
fi
- exit $ret
+ return $ret
}
run()
{
- #need to be root to set the interface: if not, run with default loopback.
+ echo "pktio: using 'loop' device"
+ pktio_main${EXEEXT} $*
+ loop_ret=$?
+
+ # need to be root to run tests with real interfaces
if [ "$(id -u)" != "0" ]; then
- echo "pktio: using 'loop' device"
- pktio_main${EXEEXT}
- exit $?
+ exit $ret
fi
if [ "$ODP_PKTIO_IF0" = "" ]; then
+ # no interfaces specified, use default veth interfaces
+ # setup by the pktio_env script
setup_pktio_env clean
+ if [ $? != 0 ]; then
+ echo "Failed to setup test environment, skipping test."
+ exit $TEST_SKIPPED
+ fi
export ODP_PLATFORM_PARAMS="-n 4 --vdev eth_pcap0,iface=$IF0 --vdev eth_pcap1,iface=$IF1"
export ODP_PKTIO_IF0=0
export ODP_PKTIO_IF1=1
fi
run_test
+ ret=$?
+
+ [ $ret = 0 ] && ret=$loop_ret
+
+ exit $ret
}
-case "$1" in
+if [ $# != 0 ]; then
+ action=$1
+ shift
+fi
+
+case "$action" in
setup) setup_pktio_env ;;
cleanup) cleanup_pktio_env ;;
+ run) run ;;
*) run ;;
esac