aboutsummaryrefslogtreecommitdiff
path: root/example/switch
diff options
context:
space:
mode:
authorSunil Kumar Kori <skori@marvell.com>2020-09-22 14:25:31 +0530
committerMatias Elo <matias.elo@nokia.com>2020-10-14 09:23:15 +0300
commit9a4244c786122d9bf56c0e5c497ddf2bc9e71576 (patch)
treeed7715836a78817aa5a6299e9821a2c3c7685b69 /example/switch
parente278ff4f4a705691a18ea7d7013d12288a3c747e (diff)
example: script: enhance application run script
Currently example applications uses pcap based pktio to validate the functionality on linux-generic platform during make check but other platforms may not be supporting pcap interfaces as pktio. So example application's run scripts are enhanced to use generic framework to define pktio interfaces and corresponding interface environment scripts are placed under platform implementation. Signed-off-by: Sunil Kumar Kori <skori@marvell.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'example/switch')
-rw-r--r--example/switch/.gitignore1
-rw-r--r--example/switch/Makefile.am2
-rwxr-xr-xexample/switch/switch_run.sh30
3 files changed, 15 insertions, 18 deletions
diff --git a/example/switch/.gitignore b/example/switch/.gitignore
index 1bd93e32d..63ef8af6e 100644
--- a/example/switch/.gitignore
+++ b/example/switch/.gitignore
@@ -1,3 +1,4 @@
odp_switch
+pktio_env
*.log
*.trs
diff --git a/example/switch/Makefile.am b/example/switch/Makefile.am
index 6244fec74..b39ac29ee 100644
--- a/example/switch/Makefile.am
+++ b/example/switch/Makefile.am
@@ -24,6 +24,8 @@ all-local:
fi \
done \
fi
+ ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/switch/pktio_env \
+ pktio_env
clean-local:
if [ "x$(srcdir)" != "x$(builddir)" ]; then \
for f in $(EXTRA_DIST); do \
diff --git a/example/switch/switch_run.sh b/example/switch/switch_run.sh
index 5fa1ae1cd..3b6212239 100755
--- a/example/switch/switch_run.sh
+++ b/example/switch/switch_run.sh
@@ -6,33 +6,27 @@
# SPDX-License-Identifier: BSD-3-Clause
#
-NUM_RX_PORT=3
RETVAL=0
-PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit`
-
-echo "Switch test using PCAP_IN = ${PCAP_IN}"
+if [ -f ./pktio_env ]; then
+ . ./pktio_env
+else
+ echo "BUG: unable to find pktio_env!"
+ echo "pktio_env has to be in current directory"
+ exit 1
+fi
-RX_PORTS=""
-for i in `seq 1 $NUM_RX_PORT`;
-do
- RX_PORTS="${RX_PORTS},pcap:out=pcapout${i}.pcap"
-done
+setup_interfaces
-./odp_switch${EXEEXT} -i pcap:in=${PCAP_IN}${RX_PORTS} -t 1
+./odp_switch${EXEEXT} -i $IF0,$IF1,$IF2,$IF3 -t 1
STATUS=$?
if [ "$STATUS" -ne 0 ]; then
echo "Error: status was: $STATUS, expected 0"
RETVAL=1
fi
-for i in `seq 1 $NUM_RX_PORT`;
-do
- if [ `stat -c %s pcapout${i}.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then
- echo "Error: Output file $i size not matching"
- RETVAL=1
- fi
- rm -f pcapout${i}.pcap
-done
+validate_result
+
+cleanup_interfaces
exit $RETVAL