diff mbox

[PATCHv5,2/2] example: packet make check tests

Message ID 1461666550-4805-3-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 577eb779447b889e6d34e7732576e474f47e7c70
Headers show

Commit Message

Maxim Uvarov April 26, 2016, 10:29 a.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 example/packet/.gitignore   |   3 +++
 example/packet/Makefile.am  |   7 +++++
 example/packet/pktio_run.sh |  62 ++++++++++++++++++++++++++++++++++++++++++++
 example/packet/udp64.pcap   | Bin 0 -> 7624 bytes
 4 files changed, 72 insertions(+)
 create mode 100755 example/packet/pktio_run.sh
 create mode 100644 example/packet/udp64.pcap

diff --git a/example/packet/udp64.pcap b/example/packet/udp64.pcap
new file mode 100644
index 0000000000000000000000000000000000000000..45f9d6e6341a331125e1e3e49ab8ad1e71b20712
GIT binary patch
literal 7624
zcmca|c+)~A1{MYw_+QV!zzF1AIDRVZQX4OW4Ui4OOdthJV3Lu8!IgnQ52VaNFl`SP
zPy-M%&2gOL#31#rG%+bTB{eNQBQq;ICpRy@ps;AvtkLiqO%tPeXtbOdEel8Mj?wyY
zv^_D}W*Ti5GK{vPNBat+eXG&_<7gilID#<RE*xzaj<yR&+l8a;!qKvDbPRcP%zboT
XVRY^UIO8<hE*$M6kM@y?=pzFFfL+O&

literal 0
HcmV?d00001
diff mbox

Patch

diff --git a/example/packet/.gitignore b/example/packet/.gitignore
index 0a5c1ed..4610a19 100644
--- a/example/packet/.gitignore
+++ b/example/packet/.gitignore
@@ -1 +1,4 @@ 
 odp_pktio
+*.log
+*.trs
+pcapout.pcap
diff --git a/example/packet/Makefile.am b/example/packet/Makefile.am
index a811234..af729b0 100644
--- a/example/packet/Makefile.am
+++ b/example/packet/Makefile.am
@@ -8,3 +8,10 @@  noinst_HEADERS = \
 		  $(top_srcdir)/example/example_debug.h
 
 dist_odp_pktio_SOURCES = odp_pktio.c
+
+if test_example
+if HAVE_PCAP
+TESTS = pktio_run.sh
+endif
+endif
+EXTRA_DIST = pktio_run.sh udp64.pcap
diff --git a/example/packet/pktio_run.sh b/example/packet/pktio_run.sh
new file mode 100755
index 0000000..3adb2d6
--- /dev/null
+++ b/example/packet/pktio_run.sh
@@ -0,0 +1,62 @@ 
+#!/bin/bash
+#
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:     BSD-3-Clause
+#
+
+PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit`
+PCAP_OUT="pcapout.pcap"
+PCAP_IN_SIZE=`stat -c %s ${PCAP_IN}`
+echo "using PCAP in=${PCAP_IN}:out=${PCAP_OUT} size %${PCAP_IN_SIZE}"
+
+# burst mode
+./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 0
+STATUS=$?
+PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}`
+rm -f ${PCAP_OUT}
+
+if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then
+	echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+	exit 1
+fi
+echo "Pass -m 0: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+
+# queue mode
+./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 1
+STATUS=$?
+PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}`
+rm -f ${PCAP_OUT}
+
+if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then
+	echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+	exit 2
+fi
+echo "Pass -m 1: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+
+# sched/queue mode
+./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 2
+STATUS=$?
+PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}`
+rm -f ${PCAP_OUT}
+
+if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then
+	echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+	exit 3
+fi
+echo "Pass -m 2: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+
+# cpu number option test 1
+./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 0 -c 1
+STATUS=$?
+PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}`
+rm -f ${PCAP_OUT}
+
+if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then
+	echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+	exit 4
+fi
+echo "Pass -m 0 -c 1: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+
+exit 0