Add test for the single-threaded l2fwd. This test utilizes .pcap pktio.
Because I did not want to modify the application itself to make fast
testing possible, the test needs to wait for a specific number of seconds
that is currently 1. The sizes of the .pcap files are compared, but the
actual contents are not, because the timestamps in the .pcap files differ.

Signed-off-by: Juha-Matti Tilli <[email protected]>
---
 example/l2fwd_simple/.gitignore  |   2 ++
 example/l2fwd_simple/Makefile.am |   5 +++++
 example/l2fwd_simple/run_pcap.sh |  20 ++++++++++++++++++++
 example/l2fwd_simple/udp64.pcap  | Bin 0 -> 7624 bytes
 4 files changed, 27 insertions(+)
 create mode 100755 example/l2fwd_simple/run_pcap.sh
 create mode 100644 example/l2fwd_simple/udp64.pcap

diff --git a/example/l2fwd_simple/.gitignore b/example/l2fwd_simple/.gitignore
index 1326732..b59fa7e 100644
--- a/example/l2fwd_simple/.gitignore
+++ b/example/l2fwd_simple/.gitignore
@@ -1 +1,3 @@
 odp_l2fwd_simple
+*.log
+*.trs
diff --git a/example/l2fwd_simple/Makefile.am b/example/l2fwd_simple/Makefile.am
index 88d2915..adb80b8 100644
--- a/example/l2fwd_simple/Makefile.am
+++ b/example/l2fwd_simple/Makefile.am
@@ -8,3 +8,8 @@ noinst_HEADERS = \
                  $(top_srcdir)/example/example_debug.h
 
 dist_odp_l2fwd_simple_SOURCES = odp_l2fwd_simple.c
+
+if HAVE_PCAP
+TESTS = run_pcap.sh
+endif
+EXTRA_DIST = run_pcap.sh udp64.pcap
diff --git a/example/l2fwd_simple/run_pcap.sh b/example/l2fwd_simple/run_pcap.sh
new file mode 100755
index 0000000..ee3b4f3
--- /dev/null
+++ b/example/l2fwd_simple/run_pcap.sh
@@ -0,0 +1,20 @@
+./odp_l2fwd_simple pcap:in=udp64.pcap pcap:out=pcapout.pcap 02:00:00:00:00:01 
02:00:00:00:00:02 &
+
+sleep 1
+kill $!
+wait $!
+STATUS=$?
+
+if [ "$STATUS" -ne 143 ]; then
+  echo "Error: status was: $STATUS, expected 143"
+  exit 1
+fi
+
+if [ `stat -c %s pcapout.pcap` -ne `stat -c %s udp64.pcap` ]; then
+  echo "File sizes disagree"
+  exit 1
+fi
+
+rm -f pcapout.pcap
+
+exit 0
diff --git a/example/l2fwd_simple/udp64.pcap b/example/l2fwd_simple/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

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to