diff options
author | Kiran Kumar K <kirankumark@marvell.com> | 2020-11-30 13:47:19 +0530 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2020-12-03 11:21:54 +0200 |
commit | 1cf1fd4f30004c9a957a7f35ae980e45be049e10 (patch) | |
tree | 6ccba6f914197aaed28738607b0325d68a6fc30c | |
parent | f00f240ccb7f3aa4c499c162b3b6d64055bbd86e (diff) |
example: cls: add application test script
Add test for the classifier example application. The test configures one
PMR to match source IP addresses. The test traffic is read from a
capture file using pcap pktio. The number of received packets is verified
from both the target queue and default queue. Classifier example test
is now run during 'make check'.
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | example/classifier/Makefile.am | 29 | ||||
-rwxr-xr-x | example/classifier/odp_classifier_run.sh | 34 | ||||
-rw-r--r-- | example/classifier/udp64.pcap | bin | 0 -> 18544 bytes | |||
-rw-r--r-- | platform/linux-generic/m4/configure.m4 | 1 | ||||
-rw-r--r-- | platform/linux-generic/test/example/Makefile.am | 1 | ||||
-rw-r--r-- | platform/linux-generic/test/example/classifier/Makefile.am | 1 | ||||
-rw-r--r-- | platform/linux-generic/test/example/classifier/pktio_env | 44 |
7 files changed, 110 insertions, 0 deletions
diff --git a/example/classifier/Makefile.am b/example/classifier/Makefile.am index a0003e9a4..4be6648b6 100644 --- a/example/classifier/Makefile.am +++ b/example/classifier/Makefile.am @@ -3,3 +3,32 @@ include $(top_srcdir)/example/Makefile.inc bin_PROGRAMS = odp_classifier odp_classifier_SOURCES = odp_classifier.c + +if test_example +if ODP_PKTIO_PCAP +TESTS = odp_classifier_run.sh +endif +endif +EXTRA_DIST = odp_classifier_run.sh udp64.pcap + +# If building out-of-tree, make check will not copy the scripts and data to the +# $(builddir) assuming that all commands are run locally. However this prevents +# running tests on a remote target using LOG_COMPILER. +# So copy all script and data files explicitly here. +all-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + if [ -e $(srcdir)/$$f ]; then \ + mkdir -p $(builddir)/$$(dirname $$f); \ + cp -f $(srcdir)/$$f $(builddir)/$$f; \ + fi \ + done \ + fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/classifier/pktio_env \ + pktio_env +clean-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + rm -f $(builddir)/$$f; \ + done \ + fi diff --git a/example/classifier/odp_classifier_run.sh b/example/classifier/odp_classifier_run.sh new file mode 100755 index 000000000..2b5fe7ebb --- /dev/null +++ b/example/classifier/odp_classifier_run.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright (c) 2020, Marvell +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +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 + +setup_interfaces + +./odp_classifier${EXEEXT} -t $TIME_OUT_VAL -i $IF0 -m 0 -p \ + "ODP_PMR_SIP_ADDR:10.10.10.0:0xFFFFFF00:queue1" -P -C "queue1:${CPASS_COUNT_ARG1}" \ + -C "DefaultCos:${CPASS_COUNT_ARG2}" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/classifier/udp64.pcap b/example/classifier/udp64.pcap Binary files differnew file mode 100644 index 000000000..fb05ef0f7 --- /dev/null +++ b/example/classifier/udp64.pcap diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index a51a1a80c..4b30f09e3 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -44,6 +44,7 @@ AC_CONFIG_FILES([platform/linux-generic/Makefile platform/linux-generic/dumpconfig/Makefile platform/linux-generic/test/Makefile platform/linux-generic/test/example/Makefile + platform/linux-generic/test/example/classifier/Makefile platform/linux-generic/test/example/generator/Makefile platform/linux-generic/test/example/l2fwd_simple/Makefile platform/linux-generic/test/example/l3fwd/Makefile diff --git a/platform/linux-generic/test/example/Makefile.am b/platform/linux-generic/test/example/Makefile.am index 7c0097506..22b254cd7 100644 --- a/platform/linux-generic/test/example/Makefile.am +++ b/platform/linux-generic/test/example/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = \ + classifier \ generator \ l2fwd_simple \ l3fwd \ diff --git a/platform/linux-generic/test/example/classifier/Makefile.am b/platform/linux-generic/test/example/classifier/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-generic/test/example/classifier/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-generic/test/example/classifier/pktio_env b/platform/linux-generic/test/example/classifier/pktio_env new file mode 100644 index 000000000..429fef9ae --- /dev/null +++ b/platform/linux-generic/test/example/classifier/pktio_env @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-generic. +# +# For linux-generic the default behavior is to create one pcap interface +# which uses udp64.pcap to inject traffic. +# +# Network set-up +# +---------+ +-----------+ +# |pcap intf| IF0<---> | Classifier| +# +--------- +-----------+ +# + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +echo "using PCAP in=${PCAP_IN}" + +IF0=pcap:in=${PCAP_IN} +TIME_OUT_VAL=10 +CPASS_COUNT_ARG1=100 +CPASS_COUNT_ARG2=100 + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + return 0; +} + +setup_interfaces() +{ + return 0 +} + +cleanup_interfaces() +{ + return 0 +} |