diff mbox

[PATCHv7,4/4] validation: add new test l2fwd_run

Message ID 1427895604-15031-5-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov April 1, 2015, 1:40 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/performance/Makefile.am   |  2 +-
 test/performance/odp_l2fwd_run | 57 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100755 test/performance/odp_l2fwd_run
diff mbox

Patch

diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
index b501584..63f73e0 100644
--- a/test/performance/Makefile.am
+++ b/test/performance/Makefile.am
@@ -6,7 +6,7 @@  EXECUTABLES = odp_atomic
 
 COMPILE_ONLY = odp_scheduling odp_l2fwd
 
-TESTSCRIPTS = odp_scheduling_run
+TESTSCRIPTS = odp_scheduling_run odp_l2fwd_run
 
 if test_perf
 TESTS = $(EXECUTABLES) $(TESTSCRIPTS)
diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run
new file mode 100755
index 0000000..72e508c
--- /dev/null
+++ b/test/performance/odp_l2fwd_run
@@ -0,0 +1,57 @@ 
+#!/bin/sh
+#
+# Copyright (c) 2015, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:	BSD-3-Clause
+#
+
+TEST_DIR=$(dirname $0)
+
+# exit codes expected by automake for skipped tests
+TEST_SKIPPED=77
+
+# Use installed pktio env or for make check take it from platform directory
+if [ -f "./pktio_env" ]; then
+	. ./pktio_env
+else if [ -f ${TEST_DIR}/../../platform/$ODP_PLATFORM/test/pktio_env ]; then
+	. ${TEST_DIR}/../../platform/$ODP_PLATFORM/test/pktio_env
+else
+	echo "BUG: unable to find platform specific set up script pktio_env!"
+	echo "pktio_env has to be in current directory or in platform/X/test."
+	exit 1
+	fi
+fi
+
+run_l2fwd_example()
+{
+	setup_pktio_env
+	if [ $? -ne 0 ]; then
+		echo "setup_pktio_env error $?"
+		exit $TEST_SKIPPED
+	fi
+
+	#@todo: limit odp_generator to cores
+	#https://bugs.linaro.org/show_bug.cgi?id=1398
+	($TEST_DIR/../../example/generator/odp_generator -I $IF0 \
+			--srcmac fe:0f:97:c9:e0:44  --dstmac 32:cb:9b:27:2f:1a \
+			--srcip 192.168.0.1 --dstip 192.168.0.2 -m u 2>&1 > /dev/null) \
+			2>&1 > /dev/null &
+
+	echo "Run $TEST_DIR/../../example/l2fwd/odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2"
+	$TEST_DIR/../../example/l2fwd/odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2
+
+	cleanup_pktio_env
+	if [ $? -ne 0 ]; then
+		echo "cleanup_pktio_env error $?"
+		exit $TEST_SKIPPED
+	fi
+
+	exit 0
+}
+
+case "$1" in
+	setup)   setup_pktio_env   ;;
+	cleanup) cleanup_pktio_env ;;
+	*)       run_l2fwd_example ;;
+esac