diff mbox

[2/2] example/l3fwd: add test script

Message ID 1469695909-24615-2-git-send-email-forrest.shi@linaro.org
State Superseded
Headers show

Commit Message

Forrest Shi July 28, 2016, 8:51 a.m. UTC
From: Xuelin Shi <forrest.shi@linaro.org>


Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

---
 example/l3fwd/Makefile.am      |   8 ++++++++
 example/l3fwd/odp_l3fwd_run.sh |  27 +++++++++++++++++++++++++++
 example/l3fwd/udp64.pcap       | Bin 0 -> 7624 bytes
 3 files changed, 35 insertions(+)
 create mode 100755 example/l3fwd/odp_l3fwd_run.sh
 create mode 100644 example/l3fwd/udp64.pcap

diff --git a/example/l3fwd/udp64.pcap b/example/l3fwd/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

-- 
2.1.4
diff mbox

Patch

diff --git a/example/l3fwd/Makefile.am b/example/l3fwd/Makefile.am
index f926717..422a3bf 100644
--- a/example/l3fwd/Makefile.am
+++ b/example/l3fwd/Makefile.am
@@ -10,3 +10,11 @@  noinst_HEADERS = \
 		  $(top_srcdir)/example/example_debug.h
 
 dist_odp_l3fwd_SOURCES = odp_l3fwd.c odp_l3fwd_db.c odp_l3fwd_lpm.c
+
+if test_example
+if HAVE_PCAP
+TESTS = odp_l3fwd_run.sh
+endif
+endif
+
+EXTRA_DIST = odp_l3fwd_run.sh udp64.pcap
diff --git a/example/l3fwd/odp_l3fwd_run.sh b/example/l3fwd/odp_l3fwd_run.sh
new file mode 100755
index 0000000..f5f371c
--- /dev/null
+++ b/example/l3fwd/odp_l3fwd_run.sh
@@ -0,0 +1,27 @@ 
+#!/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}, PCAP_OUT = ${PCAP_OUT}"
+
+./odp_l3fwd -i pcap:in=${PCAP_IN},pcap:out=${PCAP_OUT} -r "10.0.0.0/24,pcap:out=${PCAP_OUT}" -d 30
+
+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: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+
+exit 0