aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMaxim Uvarov <maxim.uvarov@linaro.org>2016-04-26 13:29:10 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-04-26 15:47:24 +0300
commit577eb779447b889e6d34e7732576e474f47e7c70 (patch)
treefe9fa0d2ad02b93d5a07a7867f5e8a08e4b47670 /example
parent4a3e3fdad6d3031c030a4274ac4ff74a13ff3512 (diff)
example: packet make check tests
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-and-tested-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'example')
-rw-r--r--example/packet/.gitignore3
-rw-r--r--example/packet/Makefile.am7
-rwxr-xr-xexample/packet/pktio_run.sh62
-rw-r--r--example/packet/udp64.pcapbin0 -> 7624 bytes
4 files changed, 72 insertions, 0 deletions
diff --git a/example/packet/.gitignore b/example/packet/.gitignore
index 0a5c1edb9..4610a1922 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 a81123457..af729b098 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 000000000..3adb2d62e
--- /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
diff --git a/example/packet/udp64.pcap b/example/packet/udp64.pcap
new file mode 100644
index 000000000..45f9d6e63
--- /dev/null
+++ b/example/packet/udp64.pcap
Binary files differ