diff mbox

[PATCHv2,4/4] linux-generic: pktio: add test for pcap pktio

Message ID 1441372829-12886-5-git-send-email-stuart.haslam@linaro.org
State Superseded
Headers show

Commit Message

Stuart Haslam Sept. 4, 2015, 1:20 p.m. UTC
If pcap is enabled in the build, add a validation test for it.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 platform/linux-generic/test/Makefile.am          |  5 ++++
 platform/linux-generic/test/pktio/Makefile.am    |  4 +++
 platform/linux-generic/test/pktio/pktio_run_pcap | 33 ++++++++++++++++++++++++
 3 files changed, 42 insertions(+)
 create mode 100755 platform/linux-generic/test/pktio/pktio_run_pcap
diff mbox

Patch

diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am
index 7d1ce1b..11648d4 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -26,6 +26,11 @@  TESTS = pktio/pktio_run \
 	${top_builddir}/test/validation/system/system_main$(EXEEXT)
 
 SUBDIRS = $(ODP_MODULES)
+
+if HAVE_PCAP
+TESTS += pktio/pktio_run_pcap
+endif
+
 endif
 
 #performance tests refer to pktio_env
diff --git a/platform/linux-generic/test/pktio/Makefile.am b/platform/linux-generic/test/pktio/Makefile.am
index 93281dd..6fe2013 100644
--- a/platform/linux-generic/test/pktio/Makefile.am
+++ b/platform/linux-generic/test/pktio/Makefile.am
@@ -1,2 +1,6 @@ 
 dist_bin_SCRIPTS = pktio_env \
 		   pktio_run
+
+if HAVE_PCAP
+dist_bin_SCRIPTS += pktio_run_pcap
+endif
diff --git a/platform/linux-generic/test/pktio/pktio_run_pcap b/platform/linux-generic/test/pktio/pktio_run_pcap
new file mode 100755
index 0000000..c130417
--- /dev/null
+++ b/platform/linux-generic/test/pktio/pktio_run_pcap
@@ -0,0 +1,33 @@ 
+#!/bin/sh
+#
+# Copyright (c) 2015, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:	BSD-3-Clause
+#
+
+# 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
+# -in the validation when running standalone intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/pktio:$PATH
+PATH=$(dirname $0):$PATH
+PATH=$(dirname $0)/../../../../test/validation/pktio:$PATH
+PATH=.:$PATH
+
+pktio_main_path=$(which pktio_main${EXEEXT})
+if [ -x "$pktio_main_path" ] ; then
+	echo "running with $pktio_main_path"
+else
+	echo "cannot find pktio_main${EXEEXT}: please set you PATH for it."
+fi
+
+PCAP_FNAME=vald.pcap
+export ODP_PKTIO_IF0="pcap:out=${PCAP_FNAME}"
+export ODP_PKTIO_IF1="pcap:in=${PCAP_FNAME}"
+pktio_main${EXEEXT}
+ret=$?
+rm -f ${PCAP_FNAME}
+exit $ret